docsig 0.63.0__tar.gz → 0.64.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.
- {docsig-0.63.0 → docsig-0.64.0}/PKG-INFO +4 -4
- {docsig-0.63.0 → docsig-0.64.0}/README.rst +3 -3
- {docsig-0.63.0 → docsig-0.64.0}/docsig/_core.py +71 -63
- {docsig-0.63.0 → docsig-0.64.0}/docsig/_files.py +3 -3
- {docsig-0.63.0 → docsig-0.64.0}/docsig/_module.py +4 -6
- {docsig-0.63.0 → docsig-0.64.0}/docsig/_report.py +2 -0
- {docsig-0.63.0 → docsig-0.64.0}/docsig/_version.py +1 -1
- {docsig-0.63.0 → docsig-0.64.0}/docsig/messages.py +6 -0
- {docsig-0.63.0 → docsig-0.64.0}/pyproject.toml +2 -2
- {docsig-0.63.0 → docsig-0.64.0}/LICENSE +0 -0
- {docsig-0.63.0 → docsig-0.64.0}/docsig/__init__.py +0 -0
- {docsig-0.63.0 → docsig-0.64.0}/docsig/__main__.py +0 -0
- {docsig-0.63.0 → docsig-0.64.0}/docsig/_config.py +0 -0
- {docsig-0.63.0 → docsig-0.64.0}/docsig/_decorators.py +0 -0
- {docsig-0.63.0 → docsig-0.64.0}/docsig/_directives.py +0 -0
- {docsig-0.63.0 → docsig-0.64.0}/docsig/_hooks.py +0 -0
- {docsig-0.63.0 → docsig-0.64.0}/docsig/_main.py +0 -0
- {docsig-0.63.0 → docsig-0.64.0}/docsig/_stub.py +0 -0
- {docsig-0.63.0 → docsig-0.64.0}/docsig/_utils.py +0 -0
- {docsig-0.63.0 → docsig-0.64.0}/docsig/plugin.py +0 -0
- {docsig-0.63.0 → docsig-0.64.0}/docsig/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: docsig
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.64.0
|
|
4
4
|
Summary: Check signature params for proper documentation
|
|
5
5
|
Home-page: https://pypi.org/project/docsig/
|
|
6
6
|
License: MIT
|
|
@@ -180,7 +180,7 @@ ensure your installation has registered `docsig`
|
|
|
180
180
|
.. code-block:: console
|
|
181
181
|
|
|
182
182
|
$ flake8 --version
|
|
183
|
-
7.1.0 (docsig: 0.
|
|
183
|
+
7.1.0 (docsig: 0.64.0, mccabe: 0.7.0, pycodestyle: 2.12.0, pyflakes: 3.2.0) CPython 3.8.13 on Darwin
|
|
184
184
|
|
|
185
185
|
And now use `flake8` to lint your files
|
|
186
186
|
|
|
@@ -269,7 +269,7 @@ Standalone
|
|
|
269
269
|
|
|
270
270
|
repos:
|
|
271
271
|
- repo: https://github.com/jshwi/docsig
|
|
272
|
-
rev: v0.
|
|
272
|
+
rev: v0.64.0
|
|
273
273
|
hooks:
|
|
274
274
|
- id: docsig
|
|
275
275
|
args:
|
|
@@ -288,7 +288,7 @@ or integrated with ``flake8``
|
|
|
288
288
|
hooks:
|
|
289
289
|
- id: flake8
|
|
290
290
|
additional_dependencies:
|
|
291
|
-
- docsig==0.
|
|
291
|
+
- docsig==0.64.0
|
|
292
292
|
args:
|
|
293
293
|
- "--sig-check-class"
|
|
294
294
|
- "--sig-check-dunders"
|
|
@@ -153,7 +153,7 @@ ensure your installation has registered `docsig`
|
|
|
153
153
|
.. code-block:: console
|
|
154
154
|
|
|
155
155
|
$ flake8 --version
|
|
156
|
-
7.1.0 (docsig: 0.
|
|
156
|
+
7.1.0 (docsig: 0.64.0, mccabe: 0.7.0, pycodestyle: 2.12.0, pyflakes: 3.2.0) CPython 3.8.13 on Darwin
|
|
157
157
|
|
|
158
158
|
And now use `flake8` to lint your files
|
|
159
159
|
|
|
@@ -242,7 +242,7 @@ Standalone
|
|
|
242
242
|
|
|
243
243
|
repos:
|
|
244
244
|
- repo: https://github.com/jshwi/docsig
|
|
245
|
-
rev: v0.
|
|
245
|
+
rev: v0.64.0
|
|
246
246
|
hooks:
|
|
247
247
|
- id: docsig
|
|
248
248
|
args:
|
|
@@ -261,7 +261,7 @@ or integrated with ``flake8``
|
|
|
261
261
|
hooks:
|
|
262
262
|
- id: flake8
|
|
263
263
|
additional_dependencies:
|
|
264
|
-
- docsig==0.
|
|
264
|
+
- docsig==0.64.0
|
|
265
265
|
args:
|
|
266
266
|
- "--sig-check-class"
|
|
267
267
|
- "--sig-check-dunders"
|
|
@@ -133,23 +133,44 @@ def _run_check( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
133
133
|
)
|
|
134
134
|
|
|
135
135
|
|
|
136
|
-
def
|
|
136
|
+
def _from_file(
|
|
137
|
+
root: _Path,
|
|
138
|
+
messages: _Messages,
|
|
139
|
+
ignore_args: bool,
|
|
140
|
+
ignore_kwargs: bool,
|
|
141
|
+
check_class_constructor,
|
|
142
|
+
) -> _Parent:
|
|
143
|
+
try:
|
|
144
|
+
string = root.read_text(encoding="utf-8")
|
|
145
|
+
parent = _from_str(
|
|
146
|
+
messages=messages,
|
|
147
|
+
string=string,
|
|
148
|
+
root=root,
|
|
149
|
+
ignore_args=ignore_args,
|
|
150
|
+
ignore_kwargs=ignore_kwargs,
|
|
151
|
+
check_class_constructor=check_class_constructor,
|
|
152
|
+
)
|
|
153
|
+
except UnicodeDecodeError as err:
|
|
154
|
+
logger = _logging.getLogger(__package__)
|
|
155
|
+
logger.debug(_FILE_INFO, root, str(err).replace("\n", " "))
|
|
156
|
+
parent = _Parent(error=_Error.UNICODE)
|
|
157
|
+
|
|
158
|
+
if parent.error is not None and not root.name.endswith(".py"):
|
|
159
|
+
parent = _Parent()
|
|
160
|
+
|
|
161
|
+
return parent
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def _from_str( # pylint: disable=too-many-arguments
|
|
165
|
+
string: str,
|
|
137
166
|
messages: _Messages,
|
|
138
167
|
ignore_args: bool,
|
|
139
168
|
ignore_kwargs: bool,
|
|
140
169
|
check_class_constructor,
|
|
141
170
|
root: _Path | None = None,
|
|
142
|
-
string: str | None = None,
|
|
143
171
|
) -> _Parent:
|
|
144
172
|
logger = _logging.getLogger(__package__)
|
|
145
|
-
parent = _Parent()
|
|
146
173
|
try:
|
|
147
|
-
if root is not None:
|
|
148
|
-
string = root.read_text(encoding="utf-8")
|
|
149
|
-
|
|
150
|
-
# empty string won't happen but keeps the
|
|
151
|
-
# typechecker happy
|
|
152
|
-
string = string or ""
|
|
153
174
|
parent = _Parent(
|
|
154
175
|
_ast.parse(string),
|
|
155
176
|
_Directives.from_text(string, messages),
|
|
@@ -161,13 +182,9 @@ def _parse_ast( # pylint: disable=too-many-arguments
|
|
|
161
182
|
logger.debug(
|
|
162
183
|
_FILE_INFO, root or "stdin", "Parsing Python code successful"
|
|
163
184
|
)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if root is not None and root.name.endswith(".py"):
|
|
168
|
-
parent = _Parent(error=_Error.SYNTAX)
|
|
169
|
-
|
|
170
|
-
logger.debug(_FILE_INFO, root or "stdin", msg)
|
|
185
|
+
except _ast.AstroidSyntaxError as err:
|
|
186
|
+
logger.debug(_FILE_INFO, root or "stdin", str(err).replace("\n", " "))
|
|
187
|
+
parent = _Parent(error=_Error.SYNTAX)
|
|
171
188
|
|
|
172
189
|
return parent
|
|
173
190
|
|
|
@@ -217,7 +234,7 @@ def _get_failures( # pylint: disable=too-many-arguments
|
|
|
217
234
|
def _report(
|
|
218
235
|
failures: _Failures, path: str | None = None, no_ansi: bool = False
|
|
219
236
|
) -> int:
|
|
220
|
-
retcodes = []
|
|
237
|
+
retcodes = [0]
|
|
221
238
|
for failure in failures:
|
|
222
239
|
retcodes.append(failure.retcode)
|
|
223
240
|
module = f"{path}:" if path is not None else ""
|
|
@@ -282,32 +299,28 @@ def runner( # pylint: disable=too-many-locals,too-many-arguments
|
|
|
282
299
|
:param target: List of errors to target.
|
|
283
300
|
:return: Exit status for whether test failed or not.
|
|
284
301
|
"""
|
|
285
|
-
|
|
286
|
-
|
|
302
|
+
module = _from_file(
|
|
303
|
+
_Path(file),
|
|
287
304
|
disable or _Messages(),
|
|
288
305
|
ignore_args,
|
|
289
306
|
ignore_kwargs,
|
|
290
307
|
check_class_constructor,
|
|
291
|
-
root=_Path(file),
|
|
292
308
|
)
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
)
|
|
309
|
-
|
|
310
|
-
return failures
|
|
309
|
+
return _get_failures(
|
|
310
|
+
module,
|
|
311
|
+
check_class,
|
|
312
|
+
check_class_constructor,
|
|
313
|
+
check_dunders,
|
|
314
|
+
check_nested,
|
|
315
|
+
check_overridden,
|
|
316
|
+
check_protected,
|
|
317
|
+
check_property_returns,
|
|
318
|
+
ignore_no_params,
|
|
319
|
+
ignore_typechecker,
|
|
320
|
+
check_protected_class_methods,
|
|
321
|
+
no_ansi,
|
|
322
|
+
target or _Messages(),
|
|
323
|
+
)
|
|
311
324
|
|
|
312
325
|
|
|
313
326
|
@_decorators.parse_msgs
|
|
@@ -386,7 +399,7 @@ def docsig( # pylint: disable=too-many-locals,too-many-arguments
|
|
|
386
399
|
if string is None:
|
|
387
400
|
retcodes = [0]
|
|
388
401
|
paths = _Paths(
|
|
389
|
-
*
|
|
402
|
+
*path,
|
|
390
403
|
patterns=patterns,
|
|
391
404
|
excludes=excludes or [],
|
|
392
405
|
include_ignored=include_ignored,
|
|
@@ -410,35 +423,30 @@ def docsig( # pylint: disable=too-many-locals,too-many-arguments
|
|
|
410
423
|
no_ansi,
|
|
411
424
|
target,
|
|
412
425
|
)
|
|
413
|
-
|
|
414
|
-
retcodes.append(_report(failures, str(file), no_ansi))
|
|
426
|
+
retcodes.append(_report(failures, str(file), no_ansi))
|
|
415
427
|
|
|
416
428
|
return max(retcodes)
|
|
417
429
|
|
|
418
|
-
module =
|
|
430
|
+
module = _from_str(
|
|
431
|
+
string,
|
|
419
432
|
disable or _Messages(),
|
|
420
433
|
ignore_args,
|
|
421
434
|
ignore_kwargs,
|
|
422
435
|
check_class_constructor,
|
|
423
|
-
string=string,
|
|
424
436
|
)
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
if failures:
|
|
442
|
-
return _report(failures, no_ansi=no_ansi)
|
|
443
|
-
|
|
444
|
-
return 0
|
|
437
|
+
failures = _get_failures(
|
|
438
|
+
module,
|
|
439
|
+
check_class,
|
|
440
|
+
check_class_constructor,
|
|
441
|
+
check_dunders,
|
|
442
|
+
check_nested,
|
|
443
|
+
check_overridden,
|
|
444
|
+
check_protected,
|
|
445
|
+
check_property_returns,
|
|
446
|
+
ignore_no_params,
|
|
447
|
+
ignore_typechecker,
|
|
448
|
+
check_protected_class_methods,
|
|
449
|
+
no_ansi,
|
|
450
|
+
target or _Messages(),
|
|
451
|
+
)
|
|
452
|
+
return _report(failures, no_ansi=no_ansi)
|
|
@@ -80,19 +80,19 @@ class Paths(_t.List[_Path]):
|
|
|
80
80
|
|
|
81
81
|
def __init__(
|
|
82
82
|
self,
|
|
83
|
-
*paths: _Path,
|
|
83
|
+
*paths: _Path | str,
|
|
84
84
|
patterns: list[str],
|
|
85
85
|
excludes: list[str],
|
|
86
86
|
include_ignored: bool = False,
|
|
87
87
|
) -> None:
|
|
88
88
|
super().__init__()
|
|
89
89
|
self._patterns = patterns
|
|
90
|
-
self._excludes = excludes
|
|
90
|
+
self._excludes = excludes or []
|
|
91
91
|
self._include_ignored = include_ignored
|
|
92
92
|
self._gitignore = _Gitignore()
|
|
93
93
|
self._logger = _logging.getLogger(__package__)
|
|
94
94
|
for path in paths:
|
|
95
|
-
self._populate(path)
|
|
95
|
+
self._populate(_Path(path))
|
|
96
96
|
|
|
97
97
|
for path in list(self):
|
|
98
98
|
if str(path) != "." and (
|
|
@@ -24,6 +24,7 @@ class Error(_Enum):
|
|
|
24
24
|
"""Represents an unrecoverable error."""
|
|
25
25
|
|
|
26
26
|
SYNTAX = 1
|
|
27
|
+
UNICODE = 2
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
class _Imports(_t.Dict[str, str]):
|
|
@@ -72,11 +73,6 @@ class Parent(_t.List["Parent"]):
|
|
|
72
73
|
self._imports = imports or _Imports()
|
|
73
74
|
self._parse_ast(node, directives or _Directives(), path)
|
|
74
75
|
|
|
75
|
-
def _parse_imports(self, names: list[tuple[str, str | None]]) -> None:
|
|
76
|
-
for name in names:
|
|
77
|
-
original, alias = name
|
|
78
|
-
self._imports[original] = alias or original
|
|
79
|
-
|
|
80
76
|
def _parse_ast(
|
|
81
77
|
self,
|
|
82
78
|
node: _ast.Module | _ast.ClassDef | _ast.FunctionDef | _ast.NodeNG,
|
|
@@ -97,7 +93,9 @@ class Parent(_t.List["Parent"]):
|
|
|
97
93
|
comments.extend(parent_comments)
|
|
98
94
|
disabled.extend(parent_disabled)
|
|
99
95
|
if isinstance(subnode, (_ast.Import, _ast.ImportFrom)):
|
|
100
|
-
|
|
96
|
+
for name in subnode.names:
|
|
97
|
+
original, alias = name
|
|
98
|
+
self._imports[original] = alias or original
|
|
101
99
|
elif isinstance(subnode, _ast.FunctionDef):
|
|
102
100
|
func = Function(
|
|
103
101
|
subnode,
|
|
@@ -11,7 +11,7 @@ line-length = 79
|
|
|
11
11
|
allow_dirty = true
|
|
12
12
|
commit = true
|
|
13
13
|
commit_args = "-sS"
|
|
14
|
-
current_version = "0.
|
|
14
|
+
current_version = "0.64.0"
|
|
15
15
|
message = "bump: version {current_version} → {new_version}"
|
|
16
16
|
sign_tags = true
|
|
17
17
|
tag = true
|
|
@@ -131,7 +131,7 @@ maintainers = [
|
|
|
131
131
|
name = "docsig"
|
|
132
132
|
readme = "README.rst"
|
|
133
133
|
repository = "https://github.com/jshwi/docsig"
|
|
134
|
-
version = "0.
|
|
134
|
+
version = "0.64.0"
|
|
135
135
|
|
|
136
136
|
[tool.poetry.dependencies]
|
|
137
137
|
Sphinx = "^7.0.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|