Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codespell in lint #14

Merged
merged 1 commit into from
Feb 9, 2022
Merged
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
14 changes: 7 additions & 7 deletions data_validation_framework/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def inputs(self):
),
)

# User attributs
# User attributes
output_columns = None
"""dict: A dict with names as keys and empty values as values for new columns created by the
current task.
Expand All @@ -186,7 +186,7 @@ def inputs(self):
:meth:`validation_function`.
"""

# Internal attributs
# Internal attributes
nb_total = None
"""int: Total number of processed elements."""
nb_valid = None
Expand Down Expand Up @@ -292,8 +292,8 @@ def kwargs(self):
def read_dataset(self):
"""Import the dataset to a :class:`pandas.DataFrame`.

This method can be overriden to load custom data (e.g. GeoDataFrame, etc.).
The dataset should alway be loaded from the path given by `self.dataset_df`.
This method can be overridden to load custom data (e.g. GeoDataFrame, etc.).
The dataset should always be loaded from the path given by `self.dataset_df`.
"""
return pd.read_csv(self.dataset_df, index_col=self.input_index_col)

Expand Down Expand Up @@ -653,7 +653,7 @@ def _process(self, df, *args, **kwargs):


class SetValidationTask(BaseValidationTask):
"""A class to validate an entire data set (usefull for global properties).
"""A class to validate an entire data set (useful for global properties).

The ``validation_function`` will receive the DataFrame and the output_path as first arguments.

Expand Down Expand Up @@ -807,8 +807,8 @@ def __init__(self, *args, **kwargs):
)
else:
raise TypeError(
"The SkippableMixin can only be associated with childs of ElementValidationTask"
" or SetValidationTask"
"The SkippableMixin can only be associated with children of "
"ElementValidationTask or SetValidationTask"
)
self._skippable_validation_function = self.validation_function
self.validation_function = new_validation_function
Expand Down
9 changes: 6 additions & 3 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ def check_files_exist(directory, pattern_list):
assert re.match(str(pattern), path)
except Exception as exc:
raise RuntimeError(
f"Error when checking the files.\n\tThe directory is: {directory}\n"
f"\tThe found files are: {existing_files}\n"
f"\tThe patterns are: {pattern_list}"
"Error when checking the files.\n\t"
f"The directory is: {directory}\n"
"\t"
f"The found files are: {existing_files}\n"
"\t"
f"The patterns are: {pattern_list}"
) from exc
return True
2 changes: 1 addition & 1 deletion tests/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -2254,7 +2254,7 @@ class TestSkippableMixin:

def test_fail_parent_type(self):
err_msg = (
"The SkippableMixin can only be associated with childs of ElementValidationTask"
"The SkippableMixin can only be associated with children of ElementValidationTask"
" or SetValidationTask"
)

Expand Down
11 changes: 7 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,29 @@ commands =
[testenv:lint]
basepython = python3.8
deps =
black==21.4b2
codespell
isort
pycodestyle
pydocstyle
pylint
isort
black==21.4b2
commands =
codespell {[base]files}
pycodestyle {[base]files}
pydocstyle {[base]files}
isort --check-only --diff {[base]files}
black --check {[base]files}
pylint {[base]files}
pylint -j {env:PYLINT_NPROCS:1} {[base]files}

[testenv:format]
basepython = python3.8
skip_install = true
deps =
black==21.4b2
codespell
isort

commands =
codespell -i 2 -w {[base]files}
isort {[base]files}
black {[base]files}

Expand Down