Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,049 changes: 524 additions & 525 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,13 @@ report.html
howso/examples/output.csv

# IDE files
.vscode
# VSCode
.vscode/*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause local .vscode entries to have to be removed before pulling main if merged.

!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Cache files
.howso_recent_cache*
Expand Down
22 changes: 22 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"cSpell.words": [
"autouse",
"caml",
"camls",
"dateutil",
"finfo",
"howsoai",
"iinfo",
"isinstance",
"isoparse",
"issubdtype",
"itemsize",
"jsonifiable",
"pyright",
"pytest",
"setosa",
"SMAPE",
"subdtype",
"targetless"
]
}
2 changes: 1 addition & 1 deletion howso/client/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def test_copy(self, trainee, trainee_builder):
copy_features = self.client.get_feature_attributes(new_trainee.id)
assert orig_features == copy_features

def test_trainee_conviction(self, trainee, trainee_builder):
def test_trainee_conviction(self, trainee):
"""
Test the /copy/{trainee_id} endpoint.

Expand Down
30 changes: 15 additions & 15 deletions howso/direct/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __init__(
train_initial_batch_size: int = 100,
verbose: bool = False,
version_check: bool = True,
**kwargs
**kwargs # noqa ARG002
):
global _VERSION_CHECKED

Expand Down Expand Up @@ -378,10 +378,10 @@ def _deserialize(self, label: str, payload: str | bytes | None) -> t.Any:
return data
except HowsoError:
raise
except Exception: # noqa: Deliberately broad
except Exception: # Deliberately broad
raise HowsoError('Failed to deserialize the Howso Engine response.')

def _resolve_trainee(self, trainee_id: str, **kwargs) -> DirectTrainee:
def _resolve_trainee(self, trainee_id: str, **kwargs) -> DirectTrainee: # noqa ARG002
"""
Resolve a Trainee and acquire its resources.

Expand Down Expand Up @@ -538,7 +538,7 @@ def _get_trainee_from_engine(self, trainee_id: str) -> DirectTrainee:
file_size=file_size
)

def _get_trainee_thread_count(self, trainee_id: str) -> int:
def _get_trainee_thread_count(self, trainee_id: str) -> int: # noqa ARG002
"""
Get the number of available cpu threads a Trainee has access to.

Expand Down Expand Up @@ -612,7 +612,7 @@ def _trainee_size(self, filename: str) -> int | None:
return None
return path.stat().st_size

def execute(self, trainee_id: str, label: str, payload: t.Any, **kwargs) -> t.Any:
def execute(self, trainee_id: str, label: str, payload: t.Any, **kwargs) -> t.Any: # noqa ARG002
"""
Execute a label in Howso engine.

Expand All @@ -638,7 +638,7 @@ def execute(self, trainee_id: str, label: str, payload: t.Any, **kwargs) -> t.An
raise HowsoError('Invalid payload - please check for infinity or NaN values') from err
return self._deserialize(label, result)

def execute_sized(self, trainee_id: str, label: str, payload: t.Any, **kwargs) -> tuple[t.Any, int, int]:
def execute_sized(self, trainee_id: str, label: str, payload: t.Any, **kwargs) -> tuple[t.Any, int, int]: # noqa ARG002
"""
Execute a label in Howso engine and return the request and response sizes.

Expand Down Expand Up @@ -668,7 +668,7 @@ def execute_sized(self, trainee_id: str, label: str, payload: t.Any, **kwargs) -
raise HowsoError('Invalid payload - please check for infinity or NaN values') from err
return self._deserialize(label, result), len(json_payload), len(result)

def is_tracing_enabled(self, trainee_id: str) -> bool:
def is_tracing_enabled(self, trainee_id: str) -> bool: # noqa ARG002
"""
Get if tracing is enabled for Trainee.

Expand Down Expand Up @@ -747,7 +747,7 @@ def check_name_valid_for_save(
):
return False, 'Cannot write to this path'

except Exception as e: # noqa: Deliberately broad
except Exception as e: # Deliberately broad
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's many of these warnings in the output in pipeline. The comment is meaningful, but it's not the same as a QA check disable. We probably want to correct the entire list at some point.

warning: Invalid `# noqa` directive on howso/client/client.py:220: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/client/client.py:354: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/features.py:314: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/features.py:392: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/features.py:432: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/features.py:504: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/features.py:557: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/features.py:608: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/scikit/scikit.py:216: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/scikit/scikit.py:233: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/scikit/scikit.py:317: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/scikit/scikit.py:1266: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/feature_attributes/relational.py:498: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/feature_attributes/relational.py:881: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/client/base.py:4264: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/client/base.py:4266: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/utilities.py:604: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/utilities.py:724: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/utilities.py:1057: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/feature_attributes/pandas.py:231: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/feature_attributes/pandas.py:336: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/feature_attributes/pandas.py:363: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/feature_attributes/pandas.py:450: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/internals.py:561: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/internals.py:862: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/tests/__init__.py:39: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:45: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:49: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:56: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:266: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:691: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:724: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:767: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:777: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:820: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:831: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:890: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:948: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:1012: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:1022: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).
warning: Invalid `# noqa` directive on howso/utilities/installation_verification.py:1142: expected a comma-separated list of codes (e.g., `# noqa: F401, F841`).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes a problem with Martin's tooling setup. Will need to review the issue for ways to coexist.

return False, f'Exception {e} while checking file'
else:
return True, 'OK'
Expand All @@ -759,13 +759,13 @@ def create_trainee( # noqa: C901
*,
id: t.Optional[str | uuid.UUID] = None,
library_type: t.Optional[LibraryType] = None,
max_wait_time: t.Optional[int | float] = None,
max_wait_time: t.Optional[int | float] = None, # noqa ARG002
metadata: t.Optional[MutableMapping[str, t.Any]] = None,
overwrite_trainee: bool = False,
persistence: Persistence = "allow",
project: t.Optional[str | Project] = None,
project: t.Optional[str | Project] = None, # noqa ARG002
resources: t.Optional[Mapping[str, t.Any]] = None,
runtime: t.Optional[TraineeRuntimeOptions] = None,
runtime: t.Optional[TraineeRuntimeOptions] = None, # noqa ARG002
) -> Trainee:
"""
Create a Trainee on the Howso service.
Expand Down Expand Up @@ -856,7 +856,7 @@ def create_trainee( # noqa: C901
self.configuration.verbose,
f'Deleting existing Trainee "{trainee_id}" before creating.')
self.amlg.destroy_entity(trainee_id)
except Exception: # noqa: Deliberately broad
except Exception: # Deliberately broad
util.dprint(
self.configuration.verbose,
f'Unable to delete Trainee "{trainee_id}". Continuing.')
Expand Down Expand Up @@ -1246,7 +1246,7 @@ def copy_trainee(
*,
library_type: t.Optional[LibraryType] = None,
resources: t.Optional[Mapping[str, t.Any]] = None,
runtime: t.Optional[TraineeRuntimeOptions] = None
runtime: t.Optional[TraineeRuntimeOptions] = None # noqa ARG002
) -> Trainee:
"""
Copies a trainee to a new trainee id in the Howso service.
Expand Down Expand Up @@ -1349,7 +1349,7 @@ def acquire_trainee_resources(
self,
trainee_id: str,
*,
max_wait_time: t.Optional[int | float] = None
max_wait_time: t.Optional[int | float] = None # noqa ARG002
):
"""
Acquire resources for a trainee in the Howso service.
Expand Down Expand Up @@ -1511,7 +1511,7 @@ def query_sessions(
search_terms: t.Optional[str] = None,
*,
trainee: t.Optional[str | Trainee] = None,
**kwargs
**kwargs # noqa ARG002
) -> list[Session]:
"""
Return a list of all accessible sessions.
Expand Down
6 changes: 3 additions & 3 deletions howso/engine/tests/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_pairwise_distances(self, trainee, from_values, to_values, expected):
([11, 41, 102], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]),
],
)
def test_distances_same(self, trainee, features, case_indices, expected):
def test_distances_same(self, trainee, case_indices, expected):
"""
Test that get_distances returns values as expected.

Expand All @@ -80,7 +80,7 @@ def test_distances_same(self, trainee, features, case_indices, expected):
([2, 3, 4], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]),
],
)
def test_distances_different(self, trainee, features, case_indices, unexpected):
def test_distances_different(self, trainee, case_indices, unexpected):
"""
Test that get_distances returns values as expected.

Expand Down Expand Up @@ -224,7 +224,7 @@ def test_load_status_message(self, mocker, monkeypatch, status_msg, expected_msg
"""Test load_trainee raises status message from Amalgam."""
file_path = Path(Path.cwd(), "test_load.caml")

monkeypatch.setattr(Path, "exists", lambda *args: True)
monkeypatch.setattr(Path, "exists", lambda *args: True) # noqa ARG005
mocker.patch(
"amalgam.api.Amalgam.load_entity",
return_value=SimpleNamespace(loaded=False, message=status_msg, version="")
Expand Down
4 changes: 2 additions & 2 deletions howso/engine/trainee.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ def set_auto_ablation_params(
relative_prediction_threshold_map: t.Optional[Mapping[str, float]] = None,
residual_prediction_features: t.Optional[Collection[str]] = None,
tolerance_prediction_threshold_map: t.Optional[Mapping[str, tuple[float, float]]] = None,
**kwargs
**kwargs # noqa ARG002
):
"""
Set trainee parameters for auto-ablation.
Expand Down Expand Up @@ -1705,7 +1705,7 @@ def react(
be used if the Trainee has them.
use_regional_residuals : bool, default True
When False, uses global residuals. When True, calculates and uses
regional residuals, which may increase runtime noticably.
regional residuals, which may increase runtime noticeably.
weight_feature : str, optional
Name of feature whose values to use as case weights.
When left unspecified uses the internally managed case weight.
Expand Down
8 changes: 4 additions & 4 deletions howso/utilities/feature_attributes/abstract_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def _infer_datetime_attributes(self, feature_name: str) -> dict:
'date_time_format': dt_format,
}

def _infer_date_attributes(self, feature_name: str) -> dict:
def _infer_date_attributes(self, feature_name: str) -> dict: # noqa ARG002
return {
'type': 'continuous',
'data_type': 'formatted_date_time',
Expand Down Expand Up @@ -543,13 +543,13 @@ def _infer_time_attributes(self, feature_name: str, user_time_format: str = None
'date_time_format': time_format,
}

def _infer_timedelta_attributes(self, feature_name: str) -> dict:
def _infer_timedelta_attributes(self, feature_name: str) -> dict: # noqa ARG002
return {
'type': 'continuous',
'data_type': 'number',
}

def _infer_boolean_attributes(self, feature_name: str) -> dict:
def _infer_boolean_attributes(self, feature_name: str) -> dict: # noqa ARG002
return {
'type': 'nominal',
'data_type': 'boolean',
Expand Down Expand Up @@ -628,7 +628,7 @@ def _infer_string_attributes(self, feature_name: str) -> dict:
else:
return self._infer_unknown_attributes(feature_name)

def _infer_unknown_attributes(self, feature_name: str) -> dict:
def _infer_unknown_attributes(self, feature_name: str) -> dict: # noqa ARG002
return {
'type': 'nominal',
}
Expand Down
14 changes: 7 additions & 7 deletions howso/utilities/feature_attributes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def _validate_dtype(self, data: pd.DataFrame, feature: str, # noqa: C901
if coerce:
coerced_df[feature] = series
is_valid = True
except Exception: # noqa: Intentionally broad
except Exception: # Intentionally broad
pass
elif expected_dtype == 'datetime64':
try:
Expand All @@ -317,7 +317,7 @@ def _validate_dtype(self, data: pd.DataFrame, feature: str, # noqa: C901
else:
coerced_df[feature] = series
is_valid = True
except Exception: # noqa: Intentionally broad
except Exception: # Intentionally broad
pass
else:
# Else, compare the dtype directly
Expand All @@ -334,7 +334,7 @@ def _validate_dtype(self, data: pd.DataFrame, feature: str, # noqa: C901
# If this happens, there is a null value, thus a float dtype is OK
if pd.api.types.is_float_dtype(series):
is_valid = True
except Exception: # noqa: Intentionally broad
except Exception: # Intentionally broad
pass

# Raise warnings if the types do not match
Expand Down Expand Up @@ -617,7 +617,7 @@ def has_unsupported_data(self, feature_name: str) -> bool:
"""
return feature_name in self.unsupported

def to_dataframe(self, *, include_all: bool = False) -> pd.DataFrame:
def to_dataframe(self, *, include_all: bool = False) -> pd.DataFrame: # noqa ARG002
"""
Return a DataFrame of the feature attributes.

Expand Down Expand Up @@ -704,7 +704,7 @@ def _process(self, # noqa: C901
include_extended_nominal_probabilities: t.Optional[bool] = False,
include_sample: bool = False,
infer_bounds: bool = True,
max_workers: t.Optional[int] = None,
max_workers: t.Optional[int] = None, # noqa ARG002
mode_bound_features: t.Optional[Iterable[str]] = None,
nominal_substitution_config: t.Optional[dict[str, dict]] = None,
ordinal_feature_values: t.Optional[dict[str, list[str]]] = None,
Expand Down Expand Up @@ -1228,7 +1228,7 @@ def _is_datetime(string: str):
try:
dt_parse(string)
return True
except Exception: # noqa: Intentionally broad
except Exception: # Intentionally broad
return False

def _is_iso8601_datetime_column(self, feature: str) -> bool:
Expand Down Expand Up @@ -1264,7 +1264,7 @@ def _is_iso8601_datetime_column(self, feature: str) -> bool:
if not self._is_datetime(rand_val):
return False
isoparse(rand_val)
except Exception: # noqa: Intentionally broad
except Exception: # Intentionally broad
return False

# No issues; it's valid
Expand Down
10 changes: 5 additions & 5 deletions howso/utilities/feature_attributes/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def _get_feature_names(self) -> list[str]:
'your DataFrame to use string column names.')
return feature_names

def _has_unique_constraint(self, feature_name: str) -> bool:
def _has_unique_constraint(self, feature_name: str) -> bool: # noqa ARG002
# This always returns False for DataFrames, which don't support such
# constraints.
return False
Expand Down Expand Up @@ -648,7 +648,7 @@ def _infer_datetime_attributes(self, feature_name: str) -> dict:
'date_time_format': dt_format,
}

def _infer_date_attributes(self, feature_name: str) -> dict:
def _infer_date_attributes(self, feature_name: str) -> dict: # noqa ARG002
return {
'type': 'continuous',
'data_type': 'formatted_date_time',
Expand Down Expand Up @@ -684,13 +684,13 @@ def _infer_time_attributes(self, feature_name: str, user_time_format: str = None
'date_time_format': time_format,
}

def _infer_timedelta_attributes(self, feature_name: str) -> dict:
def _infer_timedelta_attributes(self, feature_name: str) -> dict: # noqa ARG002
return {
'type': 'continuous',
'data_type': 'number',
}

def _infer_boolean_attributes(self, feature_name: str) -> dict:
def _infer_boolean_attributes(self, feature_name: str) -> dict: # noqa ARG002
return {
'type': 'nominal',
'data_type': 'boolean',
Expand Down Expand Up @@ -770,7 +770,7 @@ def _infer_string_attributes(self, feature_name: str) -> dict:
else:
return self._infer_unknown_attributes(feature_name)

def _infer_unknown_attributes(self, feature_name: str) -> dict:
def _infer_unknown_attributes(self, feature_name: str) -> dict: # noqa ARG002
return {
'type': 'nominal',
}
Expand Down
4 changes: 2 additions & 2 deletions howso/utilities/feature_attributes/relational.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ def _infer_timedelta_attributes(self, feature_name: str) -> dict:
'data_type': 'number',
}

def _infer_boolean_attributes(self, feature_name: str) -> dict:
def _infer_boolean_attributes(self, feature_name: str) -> dict: # noqa ARG002
return {
'type': 'nominal',
'data_type': 'boolean',
Expand Down Expand Up @@ -786,7 +786,7 @@ def _infer_string_attributes(self, feature_name: str) -> dict:
else:
return self._infer_unknown_attributes(feature_name)

def _infer_unknown_attributes(self, feature_name: str) -> dict:
def _infer_unknown_attributes(self, feature_name: str) -> dict: # noqa ARG002
return {
'type': 'nominal'
}
Expand Down
Loading
Loading