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

Fix lint during dependency workflow #435

Merged
merged 4 commits into from
Oct 29, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/dependency_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
run: |
python -m pip install .[dev]
make check-deps OUTPUT_FILEPATH=latest_requirements.txt
make fix-lint
- name: Create pull request
id: cpr
uses: peter-evans/create-pull-request@v4
Expand Down
5 changes: 1 addition & 4 deletions copulas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ def _find_addons():
try:
addon = entry_point.load()
except Exception as e: # pylint: disable=broad-exception-caught
msg = (
f'Failed to load "{entry_point.name}" from "{entry_point.value}" '
f'with error:\n{e}'
)
msg = f'Failed to load "{entry_point.name}" from "{entry_point.value}" with error:\n{e}'
warnings.warn(msg)
continue

Expand Down
3 changes: 1 addition & 2 deletions copulas/multivariate/vine.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ class VineCopula(Multivariate):
def __init__(self, vine_type, random_state=None):
if sys.version_info > (3, 8):
warnings.warn(
'Vines have not been fully tested on Python >= 3.8 and might '
'produce wrong results.'
'Vines have not been fully tested on Python >= 3.8 and might produce wrong results.'
)

self.random_state = validate_random_state(random_state)
Expand Down
26 changes: 20 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ exclude = [
".git",
"__pycache__",
".ipynb_checkpoints",
"*.ipynb"
"*.ipynb",
"tasks.py",
]

[tool.ruff.lint]
Expand All @@ -192,14 +193,23 @@ select = [
# Pycodestyle
"E",
"W",
"D200",
# pydocstyle
"D",
# isort
"I001",
# print statements
"T201",
# pandas-vet
"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
"PD901",
"PD101",
]

[tool.ruff.format]
Expand All @@ -209,14 +219,18 @@ preview = true
docstring-code-format = true
docstring-code-line-length = "dynamic"

[tool.ruff.lint.pep8-naming]
extend-ignore-names = ["X", "C", "X_padded", "Y", "Y_padded"]

[tool.ruff.lint.isort]
known-first-party = ["copulas"]
lines-between-types = 0

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401", "E402", "F403", "F405", "E501", "I001"]
"errors.py" = ["D105"]
"tests/**.py" = ["D"]

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.pycodestyle]
max-doc-length = 100
max-line-length = 100
4 changes: 2 additions & 2 deletions tests/large_scale_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def _get_parser():
'-s',
'--sample',
type=int,
help=('Limit the test to a number of datasets (sampled randomly)' ' specified by SAMPLE.'),
help=('Limit the test to a number of datasets (sampled randomly) specified by SAMPLE.'),
)
parser.add_argument('-r', '--max-rows', type=int, help='Limit the number of rows per dataset.')
parser.add_argument(
Expand Down Expand Up @@ -285,7 +285,7 @@ def main():

results = run_evaluation(model_names, dataset_names, args.max_rows, args.max_columns)

print(tabulate.tabulate(results, tablefmt='github', headers=results.columns, showindex=False))
print(tabulate.tabulate(results, tablefmt='github', headers=results.columns, showindex=False)) # noqa

if args.output_path:
LOGGER.info('Saving report to %s', args.output_path)
Expand Down
Loading