Skip to content

Commit

Permalink
Fix lint + Pin ruff version (#900)
Browse files Browse the repository at this point in the history
  • Loading branch information
R-Palazzo authored Oct 28, 2024
1 parent 22dfc72 commit e15cb50
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,11 @@ select = [
# print statements
"T201",
# pandas-vet
"PD"
"PD",
# numpy 2.0
"NPY201"
]
ignore = [
"E501",
# pydocstyle
"D107", # Missing docstring in __init__
"D417", # Missing argument descriptions in the docstring, this is a bug from pydocstyle: https://github.com/PyCQA/pydocstyle/issues/449
Expand Down
3 changes: 1 addition & 2 deletions rdt/transformers/pii/anonymizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ def __init__(
self.provider_name = provider_name if provider_name else 'BaseProvider'
if self.provider_name != 'BaseProvider' and function_name is None:
raise TransformerInputError(
'Please specify the function name to use from the '
f"'{self.provider_name}' provider."
f"Please specify the function name to use from the '{self.provider_name}' provider."
)

self.function_name = function_name if function_name else 'lexify'
Expand Down
17 changes: 6 additions & 11 deletions tests/unit/test_hyper_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ def test_validate_config_not_unique_field(self):

# Run
error_msg = re.escape(
'Error: Invalid config. Please provide unique keys for the sdtypes ' 'and transformers.'
'Error: Invalid config. Please provide unique keys for the sdtypes and transformers.'
)
with pytest.raises(InvalidConfigError, match=error_msg):
HyperTransformer._validate_config(config)
Expand Down Expand Up @@ -858,8 +858,7 @@ def test_set_config_already_fitted(self, mock_warnings):

# Assert
expected_warnings_msg = (
'For this change to take effect, please refit your data using '
"'fit' or 'fit_transform'."
"For this change to take effect, please refit your data using 'fit' or 'fit_transform'."
)
mock_warnings.warn.assert_called_once_with(expected_warnings_msg)

Expand Down Expand Up @@ -2511,8 +2510,7 @@ def test_update_transformers_fitted(self, mock_warnings):

# Assert
expected_message = (
"For this change to take effect, please refit your data using 'fit' "
"or 'fit_transform'."
"For this change to take effect, please refit your data using 'fit' or 'fit_transform'."
)

mock_warnings.warn.assert_called_once_with(expected_message)
Expand Down Expand Up @@ -2921,8 +2919,7 @@ def test_update_sdtypes_fitted(self, mock_warnings, mock_logger):

# Assert
expected_message = (
"For this change to take effect, please refit your data using 'fit' "
"or 'fit_transform'."
"For this change to take effect, please refit your data using 'fit' or 'fit_transform'."
)
user_message = (
'The transformers for these columns may change based on the new sdtype.\n'
Expand Down Expand Up @@ -3470,8 +3467,7 @@ def test_remove_transformers_fitted(self, mock_warnings):

# Assert
expected_warnings_msg = (
'For this change to take effect, please refit your data using '
"'fit' or 'fit_transform'."
"For this change to take effect, please refit your data using 'fit' or 'fit_transform'."
)
mock_warnings.warn.assert_called_once_with(expected_warnings_msg)
assert ht.field_transformers == {
Expand Down Expand Up @@ -3558,8 +3554,7 @@ def test_remove_transformers_by_sdtype(self, mock_warnings):
'column3': None,
}
expected_warnings_msg = (
'For this change to take effect, please refit your data using '
"'fit' or 'fit_transform'."
"For this change to take effect, please refit your data using 'fit' or 'fit_transform'."
)
mock_warnings.warn.assert_called_once_with(expected_warnings_msg)

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/transformers/pii/test_anonymizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def test___init__no_function_name(self):
"""
# Run / Assert
expected_message = (
'Please specify the function name to use from the ' "'credit_card' provider."
"Please specify the function name to use from the 'credit_card' provider."
)
with pytest.raises(TransformerInputError, match=expected_message):
AnonymizedFaker(provider_name='credit_card', locales=['en_US', 'fr_FR'])
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/transformers/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def test_get_input_sdtype_raises_warning(self, mock_get_supported_sdtypes):

# Run
expected_message = (
'`get_input_sdtype` is deprecated. Please use ' '`get_supported_sdtypes` instead.'
'`get_input_sdtype` is deprecated. Please use `get_supported_sdtypes` instead.'
)
with pytest.warns(FutureWarning, match=expected_message):
input_sdtype = BaseTransformer.get_input_sdtype()
Expand Down

0 comments on commit e15cb50

Please sign in to comment.