flake8_simplify 0.30.0__tar.gz → 0.31.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/PKG-INFO +10 -10
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/README.md +1 -2
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/rules/ast_assign.py +17 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/rules/ast_if.py +3 -3
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/utils.py +4 -5
- flake8_simplify-0.31.0/pyproject.toml +115 -0
- flake8_simplify-0.30.0/pyproject.toml → flake8_simplify-0.31.0/pyproject.toml.orig +27 -23
- flake8_simplify-0.30.0/.coveragerc +0 -22
- flake8_simplify-0.30.0/.flake8 +0 -6
- flake8_simplify-0.30.0/.github/ISSUE_TEMPLATE/adjust-rule.md +0 -25
- flake8_simplify-0.30.0/.github/ISSUE_TEMPLATE/rule-request.md +0 -22
- flake8_simplify-0.30.0/.github/dependabot.yml +0 -9
- flake8_simplify-0.30.0/.github/workflows/lint.yml +0 -36
- flake8_simplify-0.30.0/.github/workflows/unit-test.yml +0 -34
- flake8_simplify-0.30.0/.gitignore +0 -142
- flake8_simplify-0.30.0/.pre-commit-config.yaml +0 -43
- flake8_simplify-0.30.0/CHANGELOG.md +0 -109
- flake8_simplify-0.30.0/Makefile +0 -26
- flake8_simplify-0.30.0/mutmut-test.sh +0 -3
- flake8_simplify-0.30.0/requirements/dev.in +0 -8
- flake8_simplify-0.30.0/requirements/dev.txt +0 -91
- flake8_simplify-0.30.0/requirements/lint.in +0 -14
- flake8_simplify-0.30.0/requirements/lint.txt +0 -62
- flake8_simplify-0.30.0/tests/__init__.py +0 -10
- flake8_simplify-0.30.0/tests/test_100_rules.py +0 -517
- flake8_simplify-0.30.0/tests/test_200_rules.py +0 -70
- flake8_simplify-0.30.0/tests/test_300_rules.py +0 -18
- flake8_simplify-0.30.0/tests/test_400_rules.py +0 -130
- flake8_simplify-0.30.0/tests/test_900_rules.py +0 -243
- flake8_simplify-0.30.0/tests/test_simplify.py +0 -112
- flake8_simplify-0.30.0/tox.ini +0 -18
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/LICENSE +0 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/__init__.py +0 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/constants.py +0 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/rules/__init__.py +0 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/rules/ast_bool_op.py +0 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/rules/ast_call.py +0 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/rules/ast_classdef.py +0 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/rules/ast_compare.py +0 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/rules/ast_expr.py +0 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/rules/ast_for.py +0 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/rules/ast_ifexp.py +0 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/rules/ast_subscript.py +0 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/rules/ast_try.py +0 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/rules/ast_unary_op.py +0 -0
- {flake8_simplify-0.30.0 → flake8_simplify-0.31.0}/flake8_simplify/rules/ast_with.py +0 -0
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flake8_simplify
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.31.0
|
|
4
4
|
Summary: flake8 plugin which checks for code that can be simplified
|
|
5
5
|
Keywords: flake8
|
|
6
|
+
Author: Martin Thoma
|
|
6
7
|
Author-email: Martin Thoma <info@martin-thoma.de>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Description-Content-Type: text/markdown
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
10
|
Classifier: Development Status :: 4 - Beta
|
|
11
11
|
Classifier: Environment :: Console
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
14
13
|
Classifier: Natural Language :: English
|
|
15
14
|
Classifier: Operating System :: OS Independent
|
|
16
15
|
Classifier: Programming Language :: Python :: 3
|
|
17
16
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
22
|
Classifier: Topic :: Software Development
|
|
24
23
|
Classifier: Framework :: Flake8
|
|
25
|
-
License-File: LICENSE
|
|
26
24
|
Requires-Dist: flake8>=3.7
|
|
25
|
+
Maintainer: Martin Thoma
|
|
26
|
+
Maintainer-email: Martin Thoma <info@martin-thoma.de>
|
|
27
|
+
Requires-Python: >=3.10
|
|
27
28
|
Project-URL: Homepage, https://github.com/MartinThoma/flake8-simplify
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
28
30
|
|
|
29
31
|
[](https://badge.fury.io/py/flake8-simplify)
|
|
30
32
|
[](https://github.com/MartinThoma/flake8-simplify)
|
|
31
33
|
[](https://github.com/MartinThoma/flake8-simplify/actions)
|
|
32
|
-
[](https://github.com/psf/black)
|
|
33
34
|
|
|
34
35
|
# flake8-simplify
|
|
35
36
|
|
|
@@ -43,7 +44,7 @@ Install with `pip`:
|
|
|
43
44
|
pip install flake8-simplify
|
|
44
45
|
```
|
|
45
46
|
|
|
46
|
-
Python 3.
|
|
47
|
+
Python 3.10 to 3.14 are supported.
|
|
47
48
|
|
|
48
49
|
|
|
49
50
|
## Usage
|
|
@@ -653,4 +654,3 @@ dict.get(key, None)
|
|
|
653
654
|
# Good
|
|
654
655
|
dict.get(key)
|
|
655
656
|
```
|
|
656
|
-
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
[](https://badge.fury.io/py/flake8-simplify)
|
|
2
2
|
[](https://github.com/MartinThoma/flake8-simplify)
|
|
3
3
|
[](https://github.com/MartinThoma/flake8-simplify/actions)
|
|
4
|
-
[](https://github.com/psf/black)
|
|
5
4
|
|
|
6
5
|
# flake8-simplify
|
|
7
6
|
|
|
@@ -15,7 +14,7 @@ Install with `pip`:
|
|
|
15
14
|
pip install flake8-simplify
|
|
16
15
|
```
|
|
17
16
|
|
|
18
|
-
Python 3.
|
|
17
|
+
Python 3.10 to 3.14 are supported.
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
## Usage
|
|
@@ -3,6 +3,22 @@ import ast
|
|
|
3
3
|
from flake8_simplify.utils import Assign, expression_uses_variable, to_source
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
def _in_same_block(first: ast.stmt, second: ast.stmt) -> bool:
|
|
7
|
+
"""
|
|
8
|
+
Check that both statements are part of the same statement list.
|
|
9
|
+
|
|
10
|
+
Siblings are linked across the fields of a node, so the last statement of
|
|
11
|
+
``body`` has the first statement of ``orelse`` as next sibling.
|
|
12
|
+
"""
|
|
13
|
+
parent = getattr(first, "parent", None)
|
|
14
|
+
if parent is None:
|
|
15
|
+
return True
|
|
16
|
+
for _, value in ast.iter_fields(parent):
|
|
17
|
+
if isinstance(value, list) and first in value:
|
|
18
|
+
return second in value
|
|
19
|
+
return True
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
def get_sim904(node: ast.Assign) -> list[tuple[int, int, str]]:
|
|
7
23
|
"""
|
|
8
24
|
Assign values to dictionary directly at initialization.
|
|
@@ -48,6 +64,7 @@ def get_sim904(node: ast.Assign) -> list[tuple[int, int, str]]:
|
|
|
48
64
|
and isinstance(n2.targets[0].value, ast.Name)
|
|
49
65
|
and isinstance(node.targets[0], ast.Name)
|
|
50
66
|
and n2.targets[0].value.id == node.targets[0].id
|
|
67
|
+
and _in_same_block(node, n2)
|
|
51
68
|
):
|
|
52
69
|
return errors
|
|
53
70
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ast
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any
|
|
3
3
|
|
|
4
4
|
from flake8_simplify.constants import AST_CONST_TYPES, BOOL_CONST_TYPES
|
|
5
5
|
from flake8_simplify.utils import (
|
|
@@ -243,9 +243,9 @@ def get_sim116(node: ast.If) -> list[tuple[int, int, str]]:
|
|
|
243
243
|
):
|
|
244
244
|
return errors
|
|
245
245
|
variable = node.test.left
|
|
246
|
-
child:
|
|
246
|
+
child: ast.If | None = node.orelse[0]
|
|
247
247
|
assert isinstance(child, ast.If), "hint for mypy"
|
|
248
|
-
else_value:
|
|
248
|
+
else_value: str | None = None
|
|
249
249
|
key_value_pairs: dict[Any, Any]
|
|
250
250
|
if isinstance(node.test.comparators[0], ast.Constant) and isinstance(
|
|
251
251
|
node.test.comparators[0].value, str
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import ast
|
|
2
2
|
import itertools
|
|
3
3
|
from collections import defaultdict
|
|
4
|
-
from typing import DefaultDict, Union
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
# The following types were created to help mypy understand that there is a
|
|
@@ -81,7 +80,7 @@ class Assign(ast.Assign):
|
|
|
81
80
|
|
|
82
81
|
|
|
83
82
|
def to_source(
|
|
84
|
-
node:
|
|
83
|
+
node: None | ast.expr | ast.Expr | ast.withitem | ast.slice | ast.Assign,
|
|
85
84
|
) -> str:
|
|
86
85
|
if node is None:
|
|
87
86
|
return "None"
|
|
@@ -118,7 +117,7 @@ def is_body_same(body1: list[ast.stmt], body2: list[ast.stmt]) -> bool:
|
|
|
118
117
|
"""Check if two lists of expressions are equivalent."""
|
|
119
118
|
if len(body1) != len(body2):
|
|
120
119
|
return False
|
|
121
|
-
for a, b in zip(body1, body2):
|
|
120
|
+
for a, b in zip(body1, body2, strict=True):
|
|
122
121
|
try:
|
|
123
122
|
stmt_equal = is_stmt_equal(a, b)
|
|
124
123
|
except RecursionError: # maximum recursion depth
|
|
@@ -150,7 +149,7 @@ def is_stmt_equal(a: ast.stmt, b: ast.stmt) -> bool:
|
|
|
150
149
|
elif isinstance(a, list):
|
|
151
150
|
if len(a) != len(b):
|
|
152
151
|
return False
|
|
153
|
-
return all(itertools.starmap(is_stmt_equal, zip(a, b)))
|
|
152
|
+
return all(itertools.starmap(is_stmt_equal, zip(a, b, strict=True)))
|
|
154
153
|
else:
|
|
155
154
|
return a == b
|
|
156
155
|
|
|
@@ -215,7 +214,7 @@ def _get_duplicated_isinstance_call_by_node(node: ast.BoolOp) -> list[str]:
|
|
|
215
214
|
>> g("isinstance(a, int) or isinstance(b, float) or isinstance(b, int)
|
|
216
215
|
['b']
|
|
217
216
|
"""
|
|
218
|
-
counter:
|
|
217
|
+
counter: defaultdict[str, int] = defaultdict(int)
|
|
219
218
|
|
|
220
219
|
for call in node.values:
|
|
221
220
|
# Make sure that this function call is actually a call of the built-in
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
build-backend = "uv_build"
|
|
3
|
+
requires = ["uv_build>=0.9,<0.13"]
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "flake8_simplify"
|
|
7
|
+
version = "0.31.0"
|
|
8
|
+
description = "flake8 plugin which checks for code that can be simplified"
|
|
9
|
+
keywords = ["flake8"]
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
dependencies = ["flake8>=3.7"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Environment :: Console",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Natural Language :: English",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Programming Language :: Python :: 3.14",
|
|
27
|
+
"Topic :: Software Development",
|
|
28
|
+
"Framework :: Flake8",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[[project.maintainers]]
|
|
32
|
+
name = "Martin Thoma"
|
|
33
|
+
email = "info@martin-thoma.de"
|
|
34
|
+
|
|
35
|
+
[[project.authors]]
|
|
36
|
+
name = "Martin Thoma"
|
|
37
|
+
email = "info@martin-thoma.de"
|
|
38
|
+
|
|
39
|
+
[project.readme]
|
|
40
|
+
file = "README.md"
|
|
41
|
+
content-type = "text/markdown"
|
|
42
|
+
|
|
43
|
+
[project.entry-points."flake8.extension"]
|
|
44
|
+
SIM = "flake8_simplify:Plugin"
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://github.com/MartinThoma/flake8-simplify"
|
|
48
|
+
|
|
49
|
+
[dependency-groups]
|
|
50
|
+
dev = [
|
|
51
|
+
"mypy",
|
|
52
|
+
"pytest",
|
|
53
|
+
"pytest-cov",
|
|
54
|
+
"pytest-timeout",
|
|
55
|
+
"ruff",
|
|
56
|
+
]
|
|
57
|
+
mutation = ["mutmut>=3"]
|
|
58
|
+
|
|
59
|
+
[tool.uv.build-backend]
|
|
60
|
+
module-name = "flake8_simplify"
|
|
61
|
+
module-root = ""
|
|
62
|
+
|
|
63
|
+
[tool.mutmut]
|
|
64
|
+
paths_to_mutate = ["flake8_simplify/"]
|
|
65
|
+
tests_dir = ["tests/"]
|
|
66
|
+
|
|
67
|
+
[tool.mypy]
|
|
68
|
+
exclude = "build/lib/flake8_simplify.py"
|
|
69
|
+
ignore_missing_imports = true
|
|
70
|
+
strict = true
|
|
71
|
+
check_untyped_defs = true
|
|
72
|
+
disallow_any_generics = true
|
|
73
|
+
disallow_incomplete_defs = true
|
|
74
|
+
disallow_untyped_defs = true
|
|
75
|
+
no_implicit_optional = true
|
|
76
|
+
warn_unused_ignores = false
|
|
77
|
+
show_error_codes = true
|
|
78
|
+
|
|
79
|
+
[[tool.mypy.overrides]]
|
|
80
|
+
disallow_untyped_defs = false
|
|
81
|
+
module = [
|
|
82
|
+
"testing.*",
|
|
83
|
+
"tests.*",
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
[tool.pytest.ini_options]
|
|
87
|
+
addopts = "--doctest-modules --cov=. --cov-report html:tests/reports/coverage-html --cov-report term-missing --ignore=docs/ --ignore=mutants/ --durations=3 --timeout=30"
|
|
88
|
+
doctest_encoding = "utf-8"
|
|
89
|
+
|
|
90
|
+
[tool.ruff]
|
|
91
|
+
line-length = 79
|
|
92
|
+
target-version = "py310"
|
|
93
|
+
|
|
94
|
+
[tool.ruff.lint]
|
|
95
|
+
select = [
|
|
96
|
+
"A",
|
|
97
|
+
"B",
|
|
98
|
+
"C4",
|
|
99
|
+
"E",
|
|
100
|
+
"ERA",
|
|
101
|
+
"F",
|
|
102
|
+
"I",
|
|
103
|
+
"ISC",
|
|
104
|
+
"PT",
|
|
105
|
+
"RSE",
|
|
106
|
+
"UP",
|
|
107
|
+
]
|
|
108
|
+
ignore = [
|
|
109
|
+
"PT007",
|
|
110
|
+
"ISC004",
|
|
111
|
+
]
|
|
112
|
+
|
|
113
|
+
[tool.ruff.lint.isort]
|
|
114
|
+
known-first-party = ["flake8_simplify"]
|
|
115
|
+
combine-as-imports = true
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
build-backend = "
|
|
2
|
+
build-backend = "uv_build"
|
|
3
3
|
requires = [
|
|
4
|
-
"
|
|
4
|
+
"uv_build>=0.9,<0.13",
|
|
5
5
|
]
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "flake8_simplify"
|
|
9
|
-
version = "0.
|
|
9
|
+
version = "0.31.0"
|
|
10
10
|
description = "flake8 plugin which checks for code that can be simplified"
|
|
11
11
|
keywords = [
|
|
12
12
|
"flake8",
|
|
13
13
|
]
|
|
14
|
-
license =
|
|
14
|
+
license = "MIT"
|
|
15
|
+
license-files = ["LICENSE"]
|
|
15
16
|
maintainers = [{name = "Martin Thoma", email = "info@martin-thoma.de"}]
|
|
16
17
|
authors = [{name = "Martin Thoma", email = "info@martin-thoma.de"}]
|
|
17
|
-
requires-python = ">=3.
|
|
18
|
+
requires-python = ">=3.10"
|
|
18
19
|
dependencies = [
|
|
19
20
|
"flake8>=3.7",
|
|
20
21
|
]
|
|
@@ -22,16 +23,15 @@ classifiers = [
|
|
|
22
23
|
"Development Status :: 4 - Beta",
|
|
23
24
|
"Environment :: Console",
|
|
24
25
|
"Intended Audience :: Developers",
|
|
25
|
-
"License :: OSI Approved :: MIT License",
|
|
26
26
|
"Natural Language :: English",
|
|
27
27
|
"Operating System :: OS Independent",
|
|
28
28
|
"Programming Language :: Python :: 3",
|
|
29
29
|
"Programming Language :: Python :: 3 :: Only",
|
|
30
|
-
"Programming Language :: Python :: 3.9",
|
|
31
30
|
"Programming Language :: Python :: 3.10",
|
|
32
31
|
"Programming Language :: Python :: 3.11",
|
|
33
32
|
"Programming Language :: Python :: 3.12",
|
|
34
33
|
"Programming Language :: Python :: 3.13",
|
|
34
|
+
"Programming Language :: Python :: 3.14",
|
|
35
35
|
"Topic :: Software Development",
|
|
36
36
|
"Framework :: Flake8",
|
|
37
37
|
]
|
|
@@ -46,23 +46,25 @@ content-type = "text/markdown"
|
|
|
46
46
|
[project.urls]
|
|
47
47
|
Homepage = "https://github.com/MartinThoma/flake8-simplify"
|
|
48
48
|
|
|
49
|
-
[
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
[dependency-groups]
|
|
50
|
+
dev = [
|
|
51
|
+
"mypy",
|
|
52
|
+
"pytest",
|
|
53
|
+
"pytest-cov",
|
|
54
|
+
"pytest-timeout",
|
|
55
|
+
"ruff",
|
|
56
|
+
]
|
|
57
|
+
mutation = [
|
|
58
|
+
"mutmut>=3",
|
|
59
|
+
]
|
|
56
60
|
|
|
57
|
-
[tool.
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
[tool.uv.build-backend]
|
|
62
|
+
module-name = "flake8_simplify"
|
|
63
|
+
module-root = ""
|
|
60
64
|
|
|
61
65
|
[tool.mutmut]
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
tests_dir = "tests/"
|
|
65
|
-
paths_to_mutate = "flake8_simplify.py"
|
|
66
|
+
paths_to_mutate = ["flake8_simplify/"]
|
|
67
|
+
tests_dir = ["tests/"]
|
|
66
68
|
|
|
67
69
|
[tool.mypy]
|
|
68
70
|
exclude = "build/lib/flake8_simplify.py"
|
|
@@ -84,14 +86,16 @@ module = [
|
|
|
84
86
|
]
|
|
85
87
|
|
|
86
88
|
[tool.pytest.ini_options]
|
|
87
|
-
addopts = "--doctest-modules --cov=. --cov-report html:tests/reports/coverage-html --cov-report term-missing --ignore=docs/ --durations=3 --timeout=30"
|
|
89
|
+
addopts = "--doctest-modules --cov=. --cov-report html:tests/reports/coverage-html --cov-report term-missing --ignore=docs/ --ignore=mutants/ --durations=3 --timeout=30"
|
|
88
90
|
doctest_encoding = "utf-8"
|
|
89
91
|
|
|
90
92
|
[tool.ruff]
|
|
91
93
|
line-length = 79
|
|
94
|
+
target-version = "py310"
|
|
92
95
|
|
|
93
96
|
[tool.ruff.lint]
|
|
94
|
-
select = ["E", "F", "I"]
|
|
97
|
+
select = ["A", "B", "C4", "E", "ERA", "F", "I", "ISC", "PT", "RSE", "UP"]
|
|
98
|
+
ignore = ["PT007", "ISC004"]
|
|
95
99
|
|
|
96
100
|
[tool.ruff.lint.isort]
|
|
97
101
|
known-first-party = ["flake8_simplify"]
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
[run]
|
|
2
|
-
branch = True
|
|
3
|
-
omit = setup.py,tests/*
|
|
4
|
-
|
|
5
|
-
[report]
|
|
6
|
-
# Regexes for lines to exclude from consideration
|
|
7
|
-
exclude_lines =
|
|
8
|
-
# Have to re-enable the standard pragma
|
|
9
|
-
pragma: no cover
|
|
10
|
-
|
|
11
|
-
# Don't complain about missing debug-only code:
|
|
12
|
-
def __repr__
|
|
13
|
-
def __str__
|
|
14
|
-
if self\.debug
|
|
15
|
-
|
|
16
|
-
# Don't complain if tests don't hit defensive assertion code:
|
|
17
|
-
raise AssertionError
|
|
18
|
-
raise NotImplementedError
|
|
19
|
-
|
|
20
|
-
# Don't complain if non-runnable code isn't run:
|
|
21
|
-
if 0:
|
|
22
|
-
if __name__ == .__main__.:
|
flake8_simplify-0.30.0/.flake8
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Adjust rule
|
|
3
|
-
about: Ask for an adjustment of an existing rule
|
|
4
|
-
title: "[Adjust Rule]"
|
|
5
|
-
labels: enhancement
|
|
6
|
-
assignees: MartinThoma
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Desired change
|
|
11
|
-
|
|
12
|
-
* **Rule(s)**: SIM986, SIM987
|
|
13
|
-
* **Adjustment**: In which way should it/they be adjusted?
|
|
14
|
-
|
|
15
|
-
## Explanation
|
|
16
|
-
|
|
17
|
-
Why is the adjustment necessary / better?
|
|
18
|
-
|
|
19
|
-
## Example
|
|
20
|
-
|
|
21
|
-
This is an example where the mentioned rule(s) would currently be suboptimal:
|
|
22
|
-
|
|
23
|
-
```python
|
|
24
|
-
# Your code goes here
|
|
25
|
-
```
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Rule request
|
|
3
|
-
about: Suggest a new rule to add to flake8-simplify
|
|
4
|
-
title: "[New Rule]"
|
|
5
|
-
labels: enhancement
|
|
6
|
-
assignees: MartinThoma
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Explanation
|
|
11
|
-
|
|
12
|
-
Explain briefly why you think this makes the code simpler.
|
|
13
|
-
|
|
14
|
-
## Example
|
|
15
|
-
|
|
16
|
-
```python
|
|
17
|
-
# Bad
|
|
18
|
-
... # your bad code goes here
|
|
19
|
-
|
|
20
|
-
# Good
|
|
21
|
-
... # your improved code goes here
|
|
22
|
-
```
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
|
2
|
-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
|
3
|
-
|
|
4
|
-
name: Lint
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches: [ main ]
|
|
9
|
-
pull_request:
|
|
10
|
-
branches: [ main ]
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
build:
|
|
14
|
-
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
strategy:
|
|
17
|
-
matrix:
|
|
18
|
-
python-version: [3.9]
|
|
19
|
-
|
|
20
|
-
steps:
|
|
21
|
-
- uses: actions/checkout@v6
|
|
22
|
-
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
-
uses: actions/setup-python@v6
|
|
24
|
-
with:
|
|
25
|
-
python-version: ${{ matrix.python-version }}
|
|
26
|
-
- name: Install dependencies
|
|
27
|
-
run: |
|
|
28
|
-
python -m pip install --upgrade pip
|
|
29
|
-
pip install -r requirements/lint.txt
|
|
30
|
-
pip install .
|
|
31
|
-
- name: Test with mypy
|
|
32
|
-
run: |
|
|
33
|
-
mypy flake8_simplify
|
|
34
|
-
- name: Test with flake8
|
|
35
|
-
run: |
|
|
36
|
-
flake8 .
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
|
2
|
-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
|
3
|
-
|
|
4
|
-
name: Unit Tests
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches: [ main ]
|
|
9
|
-
pull_request:
|
|
10
|
-
branches: [ main ]
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
build:
|
|
14
|
-
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
strategy:
|
|
17
|
-
matrix:
|
|
18
|
-
python-version: [3.9, "3.10", 3.11, 3.12, 3.13]
|
|
19
|
-
|
|
20
|
-
steps:
|
|
21
|
-
- uses: actions/checkout@v6
|
|
22
|
-
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
-
uses: actions/setup-python@v6
|
|
24
|
-
with:
|
|
25
|
-
python-version: ${{ matrix.python-version }}
|
|
26
|
-
allow-prereleases: true
|
|
27
|
-
- name: Install dependencies
|
|
28
|
-
run: |
|
|
29
|
-
python -m pip install --upgrade pip
|
|
30
|
-
pip install -r requirements/dev.txt
|
|
31
|
-
pip install .
|
|
32
|
-
- name: Test with pytest
|
|
33
|
-
run: |
|
|
34
|
-
pytest -vv
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
# Byte-compiled / optimized / DLL files
|
|
2
|
-
__pycache__/
|
|
3
|
-
*.py[cod]
|
|
4
|
-
*$py.class
|
|
5
|
-
|
|
6
|
-
# C extensions
|
|
7
|
-
*.so
|
|
8
|
-
|
|
9
|
-
# Distribution / packaging
|
|
10
|
-
.Python
|
|
11
|
-
build/
|
|
12
|
-
develop-eggs/
|
|
13
|
-
dist/
|
|
14
|
-
downloads/
|
|
15
|
-
eggs/
|
|
16
|
-
.eggs/
|
|
17
|
-
lib/
|
|
18
|
-
lib64/
|
|
19
|
-
parts/
|
|
20
|
-
sdist/
|
|
21
|
-
var/
|
|
22
|
-
wheels/
|
|
23
|
-
pip-wheel-metadata/
|
|
24
|
-
share/python-wheels/
|
|
25
|
-
*.egg-info/
|
|
26
|
-
.installed.cfg
|
|
27
|
-
*.egg
|
|
28
|
-
MANIFEST
|
|
29
|
-
|
|
30
|
-
# PyInstaller
|
|
31
|
-
# Usually these files are written by a python script from a template
|
|
32
|
-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
-
*.manifest
|
|
34
|
-
*.spec
|
|
35
|
-
|
|
36
|
-
# Installer logs
|
|
37
|
-
pip-log.txt
|
|
38
|
-
pip-delete-this-directory.txt
|
|
39
|
-
|
|
40
|
-
# Unit test / coverage reports
|
|
41
|
-
htmlcov/
|
|
42
|
-
.tox/
|
|
43
|
-
.nox/
|
|
44
|
-
.coverage
|
|
45
|
-
.coverage.*
|
|
46
|
-
.cache
|
|
47
|
-
nosetests.xml
|
|
48
|
-
coverage.xml
|
|
49
|
-
*.cover
|
|
50
|
-
*.py,cover
|
|
51
|
-
.hypothesis/
|
|
52
|
-
.pytest_cache/
|
|
53
|
-
|
|
54
|
-
# Translations
|
|
55
|
-
*.mo
|
|
56
|
-
*.pot
|
|
57
|
-
|
|
58
|
-
# Django stuff:
|
|
59
|
-
*.log
|
|
60
|
-
local_settings.py
|
|
61
|
-
db.sqlite3
|
|
62
|
-
db.sqlite3-journal
|
|
63
|
-
|
|
64
|
-
# Flask stuff:
|
|
65
|
-
instance/
|
|
66
|
-
.webassets-cache
|
|
67
|
-
|
|
68
|
-
# Scrapy stuff:
|
|
69
|
-
.scrapy
|
|
70
|
-
|
|
71
|
-
# Sphinx documentation
|
|
72
|
-
docs/_build/
|
|
73
|
-
|
|
74
|
-
# PyBuilder
|
|
75
|
-
target/
|
|
76
|
-
|
|
77
|
-
# Jupyter Notebook
|
|
78
|
-
.ipynb_checkpoints
|
|
79
|
-
|
|
80
|
-
# IPython
|
|
81
|
-
profile_default/
|
|
82
|
-
ipython_config.py
|
|
83
|
-
|
|
84
|
-
# pyenv
|
|
85
|
-
.python-version
|
|
86
|
-
|
|
87
|
-
# pipenv
|
|
88
|
-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
89
|
-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
90
|
-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
91
|
-
# install all needed dependencies.
|
|
92
|
-
#Pipfile.lock
|
|
93
|
-
|
|
94
|
-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
95
|
-
__pypackages__/
|
|
96
|
-
|
|
97
|
-
# Celery stuff
|
|
98
|
-
celerybeat-schedule
|
|
99
|
-
celerybeat.pid
|
|
100
|
-
|
|
101
|
-
# SageMath parsed files
|
|
102
|
-
*.sage.py
|
|
103
|
-
|
|
104
|
-
# Environments
|
|
105
|
-
.env
|
|
106
|
-
.venv
|
|
107
|
-
env/
|
|
108
|
-
venv/
|
|
109
|
-
ENV/
|
|
110
|
-
env.bak/
|
|
111
|
-
venv.bak/
|
|
112
|
-
|
|
113
|
-
# Spyder project settings
|
|
114
|
-
.spyderproject
|
|
115
|
-
.spyproject
|
|
116
|
-
|
|
117
|
-
# Rope project settings
|
|
118
|
-
.ropeproject
|
|
119
|
-
|
|
120
|
-
# mkdocs documentation
|
|
121
|
-
/site
|
|
122
|
-
|
|
123
|
-
# mypy
|
|
124
|
-
.mypy_cache/
|
|
125
|
-
.dmypy.json
|
|
126
|
-
dmypy.json
|
|
127
|
-
|
|
128
|
-
# Pyre type checker
|
|
129
|
-
.pyre/
|
|
130
|
-
|
|
131
|
-
# mutmut
|
|
132
|
-
.mutmut-cache
|
|
133
|
-
mutmut-results.xml
|
|
134
|
-
mutmut-results.html
|
|
135
|
-
tests/reports/
|
|
136
|
-
|
|
137
|
-
.vscode/
|
|
138
|
-
*.code-workspace
|
|
139
|
-
|
|
140
|
-
html/
|
|
141
|
-
|
|
142
|
-
.envrc
|