Skip to content

Commit 43a1fb5

Browse files
committed
fix mypy and flake
1 parent 80548dc commit 43a1fb5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

autoPyTorch/data/tabular_feature_validator.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,11 +397,12 @@ def get_columns_to_encode(
397397
else:
398398
return transformed_columns, feat_types
399399

400-
def _validate_feat_types(self, X: pd.DataFrame):
400+
def _validate_feat_types(self, X: pd.DataFrame) -> None:
401401
"""
402-
Checks if the passed `feat_types` is compatible with what
403-
AutoPyTorch expects, i.e, it should only contain `numerical`
404-
or `categorical`. The case does not matter.
402+
Checks if the passed `feat_types` is compatible with what
403+
AutoPyTorch expects, i.e, it should only contain `numerical`
404+
or `categorical` and the number of feature types is equal to
405+
the number of features. The case does not matter.
405406
406407
Args:
407408
X (pd.DataFrame):
@@ -411,8 +412,9 @@ def _validate_feat_types(self, X: pd.DataFrame):
411412
ValueError:
412413
if the number of feat_types is not equal to the number of features
413414
if the feature type are not one of "numerical", "categorical"
414-
415415
"""
416+
assert self.feat_types is not None # mypy check
417+
416418
if len(self.feat_types) != len(X.columns):
417419
raise ValueError(f"Expected number of `feat_types`: {len(self.feat_types)}"
418420
f" to be the same as the number of features {len(X.columns)}")

0 commit comments

Comments
 (0)