Skip to content

Commit

Permalink
Fix warning message + update lint versions
Browse files Browse the repository at this point in the history
  • Loading branch information
fealho committed Apr 18, 2024
1 parent a48a3ef commit 9b88634
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ lint-docs: ## check docs formatting with doc8 and pydocstyle
fix-lint: ## fix lint issues using autoflake, autopep8, and isort
find copulas tests -name '*.py' | xargs autoflake --in-place --remove-all-unused-imports --remove-unused-variables
autopep8 --in-place --recursive --aggressive copulas tests
isort --apply --atomic --recursive copulas tests
isort --apply --atomic copulas tests


# TEST TARGETS
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ And you will see something like this:
```
============================ 169 passed, 1 skipped, 3 warnings in 7.10s ============================
flake8 copulas tests examples
isort -c --recursive copulas tests examples
isort -c copulas tests examples
```

The execution has finished with no errors, 1 test skipped and 3 warnings.
Expand Down
2 changes: 1 addition & 1 deletion copulas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def _find_addons():
try:
addon = entry_point.load()
except Exception: # pylint: disable=broad-exception-caught
msg = f'Failed to load "{entry_point.name}" from "{entry_point.module_name}".'
msg = f'Failed to load "{entry_point.name}" from "{entry_point.version}".'
warnings.warn(msg)
continue

Expand Down
41 changes: 20 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,32 +90,32 @@ dev = [
"Jinja2>=2,<4;python_version>='3.12'",

# style check
'flake8>=3.7.7,<4',
'isort>=4.3.4,<5',
'flake8-debugger>=4.0.0,<4.1',
'flake8-mock>=0.3,<0.4',
'flake8-mutable>=1.2.0,<1.3',
'flake8-fixme>=1.1.1,<1.2',
'pep8-naming>=0.12.1,<0.13',
'dlint>=0.11.0,<0.12',
'flake8>=3.7.7,<8',
'flake8-absolute-import>=1.0,<2',
'flake8-builtins>=1.5.3,<3',
'flake8-comprehensions>=3.6.1,<4',
'flake8-debugger>=4.0.0,<5',
'flake8-docstrings>=1.5.0,<2',
'pydocstyle>=6.1.1,<6.2',
'flake8-pytest-style>=1.5.0,<2',
'flake8-comprehensions>=3.6.1,<3.7',
'flake8-print>=4.0.0,<4.1',
'flake8-expression-complexity>=0.0.9,<0.1',
'flake8-eradicate>=1.1.0,<2',
'flake8-fixme>=1.1.1,<1.2',
'flake8-mock>=0.3,<1',
'flake8-multiline-containers>=0.0.18,<0.1',
'pandas-vet>=0.2.2,<0.3',
'flake8-builtins>=1.5.3,<1.6',
'flake8-eradicate>=1.1.0,<1.2',
'flake8-mutable>=1.2.0,<1.3',
'flake8-expression-complexity>=0.0.9,<0.1',
'flake8-print>=4.0.0,<4.1',
'flake8-pytest-style>=2.0.0,<3',
'flake8-quotes>=3.3.0,<4',
'flake8-sfs>=0.0.3,<2',
'flake8-variables-names>=0.0.4,<0.1',
'flake8-sfs>=0.0.3,<0.1',
'flake8-absolute-import>=1.0,<2',
'dlint>=0.11.0,<1',
'isort>=5.13.2,<6',
'pandas-vet>=0.2.3,<2024',
'pep8-naming>=0.12.1,<1',
'pydocstyle>=6.1.1,<7',

# fix style issues
'autoflake>=1.1,<2',
'autopep8>=1.4.3,<1.6',
'autoflake>=1.1,<3',
'autopep8>=1.4.3,<3',

# distribute on PyPI
'twine>=1.10.0,<4',
Expand All @@ -141,7 +141,6 @@ line_length = 99
lines_between_types = 0
multi_line_output = 4
use_parentheses = true
not_skip = ['__init__.py']

[tool.pydocstyle]
convention = 'google'
Expand Down
24 changes: 17 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
[flake8]
max-line-length = 99
exclude = docs, .git, __pycache__, .ipynb_checkpoints
extend-ignore = D107, # Missing docstring in __init__
D413, # Missing blank line after last section
DUO103, # insecure use of "pickle" or "cPickle"
N803, # argument name 'X' should be lowercase
N806, # variable 'X' in function should be lowercase
SFS3, # String literal formatting using f-string.
VNE001 # Single letter variable names are not allowed
extend-ignore =
# Missing docstring in __init__
D107,
# Missing blank line after last section
D413,
# insecure use of "pickle" or "cPickle"
DUO103
# argument name 'X' should be lowercase
N803,
# variable 'X' in function should be lowercase
N806,
# String literal formatting using f-string.
SFS3,
# Single letter variable names are not allowed
VNE001,
# TokenError: unterminated string literal
E902
per-file-ignores =
large_scale_evaluation.py:T001

Expand Down
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def lint(c):
c.run('pydocstyle copulas')
c.run('flake8 tests --ignore=D,SFS2')
c.run('pydocstyle tests')
c.run('isort -c --recursive copulas tests')
c.run('isort -c copulas tests')


def remove_readonly(func, path, _):
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/multivariate/test_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def test_first_tree(self):
"""Assert 0 is the center node on the first tree."""
assert self.tree.edges[0].L == 0

@pytest.mark.xfail()
@pytest.mark.xfail
def test_first_tree_likelihood(self):
"""Assert first tree likehood is correct."""
uni_matrix = np.array([[0.1, 0.2, 0.3, 0.4]])
Expand All @@ -288,7 +288,7 @@ def test_get_tau_matrix(self):

assert not test.all()

@pytest.mark.xfail()
@pytest.mark.xfail
def test_second_tree_likelihood(self):
"""Assert second tree likelihood is correct."""
# Setup
Expand Down Expand Up @@ -350,7 +350,7 @@ def test_first_tree(self):
assert sorted_edges[2].L == 2
assert sorted_edges[2].R == 3

@pytest.mark.xfail()
@pytest.mark.xfail
def test_first_tree_likelihood(self):
""" Assert first tree likehood is correct"""
uni_matrix = np.array([[0.1, 0.2, 0.3, 0.4]])
Expand Down Expand Up @@ -407,7 +407,7 @@ def test_first_tree(self):
""" Assert 0 is the center node"""
assert self.tree.edges[0].L == 0

@pytest.mark.xfail()
@pytest.mark.xfail
def test_first_tree_likelihood(self):
""" Assert first tree likehood is correct"""
uni_matrix = np.array([[0.1, 0.2, 0.3, 0.4]])
Expand Down Expand Up @@ -444,7 +444,7 @@ def test_get_tau_matrix(self):

assert bool(test.all()) is False

@pytest.mark.xfail()
@pytest.mark.xfail
def test_second_tree_likelihood(self):
"""Assert second tree likelihood is correct."""
tau = self.tree.get_tau_matrix()
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test___init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def test_get_instance_with_kwargs(self):
assert instance.distribution == 'copulas.univariate.truncnorm.TruncNorm'


@pytest.fixture()
@pytest.fixture
def mock_copulas():
copulas_module = sys.modules['copulas']
copulas_mock = MagicMock()
Expand Down Expand Up @@ -479,7 +479,7 @@ def entry_point_error():

bad_entry_point = MagicMock()
bad_entry_point.name = 'bad_entry_point'
bad_entry_point.module_name = 'bad_module'
bad_entry_point.version = 'bad_module'
bad_entry_point.load.side_effect = entry_point_error
entry_points_mock.return_value = [bad_entry_point]
msg = 'Failed to load "bad_entry_point" from "bad_module".'
Expand Down

0 comments on commit 9b88634

Please sign in to comment.