flake8-author 2.2.0__tar.gz → 2.3.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_author-2.2.0/src/flake8_author.egg-info → flake8_author-2.3.0}/PKG-INFO +6 -6
- {flake8_author-2.2.0 → flake8_author-2.3.0}/README.rst +1 -1
- {flake8_author-2.2.0 → flake8_author-2.3.0}/pyproject.toml +5 -5
- {flake8_author-2.2.0 → flake8_author-2.3.0/src/flake8_author.egg-info}/PKG-INFO +6 -6
- flake8_author-2.3.0/src/flake8_author.egg-info/requires.txt +1 -0
- {flake8_author-2.2.0 → flake8_author-2.3.0}/src/flake8_author.py +12 -17
- {flake8_author-2.2.0 → flake8_author-2.3.0}/tests/test_checker.py +9 -4
- flake8_author-2.2.0/src/flake8_author.egg-info/requires.txt +0 -1
- {flake8_author-2.2.0 → flake8_author-2.3.0}/LICENSE +0 -0
- {flake8_author-2.2.0 → flake8_author-2.3.0}/setup.cfg +0 -0
- {flake8_author-2.2.0 → flake8_author-2.3.0}/src/flake8_author.egg-info/SOURCES.txt +0 -0
- {flake8_author-2.2.0 → flake8_author-2.3.0}/src/flake8_author.egg-info/dependency_links.txt +0 -0
- {flake8_author-2.2.0 → flake8_author-2.3.0}/src/flake8_author.egg-info/entry_points.txt +0 -0
- {flake8_author-2.2.0 → flake8_author-2.3.0}/src/flake8_author.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flake8-author
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Summary: Flake8 __author__ checker
|
|
5
5
|
Author-email: Jon Parise <jon@indelible.org>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -15,17 +15,17 @@ Classifier: Framework :: Flake8
|
|
|
15
15
|
Classifier: Intended Audience :: Developers
|
|
16
16
|
Classifier: Programming Language :: Python
|
|
17
17
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
-
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
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
23
23
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
24
|
Classifier: Topic :: Software Development :: Quality Assurance
|
|
25
|
-
Requires-Python: >=3.
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
26
|
Description-Content-Type: text/x-rst
|
|
27
27
|
License-File: LICENSE
|
|
28
|
-
Requires-Dist: flake8>=
|
|
28
|
+
Requires-Dist: flake8>=6.0.0
|
|
29
29
|
Dynamic: license-file
|
|
30
30
|
|
|
31
31
|
=========================
|
|
@@ -77,7 +77,7 @@ that it has been loaded by inspecting the ``flake8 --version`` string.
|
|
|
77
77
|
.. code-block:: sh
|
|
78
78
|
|
|
79
79
|
$ flake8 --version
|
|
80
|
-
|
|
80
|
+
7.3.0 (author: 2.3.0, ...) CPython 3.11.13 on Darwin
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
Error Codes
|
|
@@ -19,23 +19,23 @@ classifiers = [
|
|
|
19
19
|
"Intended Audience :: Developers",
|
|
20
20
|
"Programming Language :: Python",
|
|
21
21
|
"Programming Language :: Python :: 3 :: Only",
|
|
22
|
-
"Programming Language :: Python :: 3.9",
|
|
23
|
-
"Programming Language :: Python :: 3.10",
|
|
24
22
|
"Programming Language :: Python :: 3.11",
|
|
25
23
|
"Programming Language :: Python :: 3.12",
|
|
26
24
|
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Programming Language :: Python :: 3.14",
|
|
26
|
+
"Programming Language :: Python :: 3.15",
|
|
27
27
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
28
28
|
"Topic :: Software Development :: Quality Assurance",
|
|
29
29
|
]
|
|
30
|
-
requires-python = ">= 3.
|
|
30
|
+
requires-python = ">= 3.11"
|
|
31
31
|
dependencies = [
|
|
32
|
-
"flake8>=
|
|
32
|
+
"flake8>=6.0.0",
|
|
33
33
|
]
|
|
34
34
|
|
|
35
35
|
[dependency-groups]
|
|
36
36
|
dev = [
|
|
37
37
|
"pytest>=8",
|
|
38
|
-
"ruff==0.
|
|
38
|
+
"ruff==0.17.0",
|
|
39
39
|
]
|
|
40
40
|
|
|
41
41
|
[project.entry-points."flake8.extension"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flake8-author
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Summary: Flake8 __author__ checker
|
|
5
5
|
Author-email: Jon Parise <jon@indelible.org>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -15,17 +15,17 @@ Classifier: Framework :: Flake8
|
|
|
15
15
|
Classifier: Intended Audience :: Developers
|
|
16
16
|
Classifier: Programming Language :: Python
|
|
17
17
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
-
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
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
23
23
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
24
|
Classifier: Topic :: Software Development :: Quality Assurance
|
|
25
|
-
Requires-Python: >=3.
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
26
|
Description-Content-Type: text/x-rst
|
|
27
27
|
License-File: LICENSE
|
|
28
|
-
Requires-Dist: flake8>=
|
|
28
|
+
Requires-Dist: flake8>=6.0.0
|
|
29
29
|
Dynamic: license-file
|
|
30
30
|
|
|
31
31
|
=========================
|
|
@@ -77,7 +77,7 @@ that it has been loaded by inspecting the ``flake8 --version`` string.
|
|
|
77
77
|
.. code-block:: sh
|
|
78
78
|
|
|
79
79
|
$ flake8 --version
|
|
80
|
-
|
|
80
|
+
7.3.0 (author: 2.3.0, ...) CPython 3.11.13 on Darwin
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
Error Codes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
flake8>=6.0.0
|
|
@@ -9,15 +9,16 @@ configurable regular expression pattern (defaults to '.*').
|
|
|
9
9
|
|
|
10
10
|
import ast
|
|
11
11
|
import re
|
|
12
|
-
from typing import Literal,
|
|
12
|
+
from typing import Literal, get_args
|
|
13
13
|
|
|
14
14
|
__author__ = "Jon Parise"
|
|
15
|
-
__version__ = "2.
|
|
15
|
+
__version__ = "2.3.0"
|
|
16
16
|
|
|
17
17
|
AttributePolicy = Literal["optional", "required", "forbidden"]
|
|
18
|
+
ATTRIBUTE_POLICIES = get_args(AttributePolicy)
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
class Checker
|
|
21
|
+
class Checker:
|
|
21
22
|
"""flake8 __author__ checker"""
|
|
22
23
|
|
|
23
24
|
name = "author"
|
|
@@ -25,7 +26,7 @@ class Checker(object):
|
|
|
25
26
|
|
|
26
27
|
# Options
|
|
27
28
|
attribute: AttributePolicy = "optional"
|
|
28
|
-
pattern:
|
|
29
|
+
pattern: re.Pattern | None = None
|
|
29
30
|
|
|
30
31
|
def __init__(self, tree, filename):
|
|
31
32
|
self.tree = tree
|
|
@@ -37,9 +38,7 @@ class Checker(object):
|
|
|
37
38
|
parser.add_option(
|
|
38
39
|
"--author-attribute",
|
|
39
40
|
default=cls.attribute,
|
|
40
|
-
help="__author__ attribute: {
|
|
41
|
-
", ".join(get_args(AttributePolicy))
|
|
42
|
-
),
|
|
41
|
+
help=f"__author__ attribute: {', '.join(ATTRIBUTE_POLICIES)}",
|
|
43
42
|
**extra_kwargs,
|
|
44
43
|
)
|
|
45
44
|
parser.add_option(
|
|
@@ -51,15 +50,15 @@ class Checker(object):
|
|
|
51
50
|
|
|
52
51
|
@classmethod
|
|
53
52
|
def parse_options(cls, options):
|
|
54
|
-
if options.author_attribute in
|
|
53
|
+
if options.author_attribute in ATTRIBUTE_POLICIES:
|
|
55
54
|
cls.attribute = options.author_attribute
|
|
56
55
|
else:
|
|
57
56
|
raise ValueError(
|
|
58
|
-
"author-attribute: '{
|
|
59
|
-
options.author_attribute, ", ".join(get_args(AttributePolicy))
|
|
60
|
-
)
|
|
57
|
+
f"author-attribute: '{options.author_attribute}' must be one of: {', '.join(ATTRIBUTE_POLICIES)}"
|
|
61
58
|
)
|
|
62
59
|
|
|
60
|
+
cls.pattern = None
|
|
61
|
+
|
|
63
62
|
# Only build a regular expression object when we've been configured
|
|
64
63
|
# with a pattern that doesn't match all strings. This naively just
|
|
65
64
|
# checks for the default empty pattern string as well as `.*`.
|
|
@@ -67,9 +66,7 @@ class Checker(object):
|
|
|
67
66
|
try:
|
|
68
67
|
cls.pattern = re.compile(options.author_pattern)
|
|
69
68
|
except re.error as e:
|
|
70
|
-
raise ValueError(
|
|
71
|
-
"author-pattern: '{0}': {1}".format(options.author_pattern, e)
|
|
72
|
-
)
|
|
69
|
+
raise ValueError(f"author-pattern: '{options.author_pattern}': {e}")
|
|
73
70
|
|
|
74
71
|
def find_author_node(self, tree):
|
|
75
72
|
for node in tree.body:
|
|
@@ -82,9 +79,7 @@ class Checker(object):
|
|
|
82
79
|
|
|
83
80
|
def _match_author_pattern(self, author, node):
|
|
84
81
|
if self.pattern is not None and not self.pattern.match(author):
|
|
85
|
-
message = 'A402 __author__ value "{
|
|
86
|
-
author, self.pattern.pattern
|
|
87
|
-
)
|
|
82
|
+
message = f'A402 __author__ value "{author}" does not match "{self.pattern.pattern}"'
|
|
88
83
|
yield (node.lineno, node.col_offset, message, type(self))
|
|
89
84
|
|
|
90
85
|
def run(self):
|
|
@@ -2,6 +2,7 @@ import ast
|
|
|
2
2
|
import unittest
|
|
3
3
|
|
|
4
4
|
from flake8.main.application import Application
|
|
5
|
+
|
|
5
6
|
from flake8_author import Checker
|
|
6
7
|
|
|
7
8
|
|
|
@@ -16,15 +17,15 @@ def make_linter(code, path="example.py", argv=None):
|
|
|
16
17
|
def check(author, attribute=None, pattern=None):
|
|
17
18
|
code = ""
|
|
18
19
|
if isinstance(author, (list, tuple, set)):
|
|
19
|
-
code = "__author__ = {
|
|
20
|
+
code = f"__author__ = {author}"
|
|
20
21
|
elif author:
|
|
21
|
-
code = '__author__ = "{
|
|
22
|
+
code = f'__author__ = "{author}"'
|
|
22
23
|
|
|
23
24
|
argv = []
|
|
24
25
|
if attribute:
|
|
25
|
-
argv.append("--author-attribute={
|
|
26
|
+
argv.append(f"--author-attribute={attribute}")
|
|
26
27
|
if pattern:
|
|
27
|
-
argv.append("--author-pattern={
|
|
28
|
+
argv.append(f"--author-pattern={pattern}")
|
|
28
29
|
|
|
29
30
|
linter = make_linter(code, argv=argv)
|
|
30
31
|
if isinstance(author, (list, tuple, set)):
|
|
@@ -192,6 +193,10 @@ class TestChecker(unittest.TestCase):
|
|
|
192
193
|
with self.assertRaises(ValueError):
|
|
193
194
|
check("Jon Parise", pattern=r"\[[")
|
|
194
195
|
|
|
196
|
+
def test_author_pattern_resets_to_default(self):
|
|
197
|
+
self.assertIsNotNone(check("Jon Parise <jon@example.com>", pattern=r"^[\w\s]+$"))
|
|
198
|
+
self.assertIsNone(check("Jon Parise <jon@example.com>"))
|
|
199
|
+
|
|
195
200
|
|
|
196
201
|
if __name__ == "__main__":
|
|
197
202
|
unittest.main()
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
flake8>=3.0.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|