docsig 0.59.0__tar.gz → 0.59.2__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.59.0 → docsig-0.59.2}/PKG-INFO +4 -4
- {docsig-0.59.0 → docsig-0.59.2}/README.rst +3 -3
- {docsig-0.59.0 → docsig-0.59.2}/docsig/_core.py +85 -61
- {docsig-0.59.0 → docsig-0.59.2}/docsig/_files.py +12 -9
- {docsig-0.59.0 → docsig-0.59.2}/docsig/_module.py +0 -20
- {docsig-0.59.0 → docsig-0.59.2}/docsig/_version.py +1 -1
- {docsig-0.59.0 → docsig-0.59.2}/pyproject.toml +4 -3
- {docsig-0.59.0 → docsig-0.59.2}/LICENSE +0 -0
- {docsig-0.59.0 → docsig-0.59.2}/docsig/__init__.py +0 -0
- {docsig-0.59.0 → docsig-0.59.2}/docsig/__main__.py +0 -0
- {docsig-0.59.0 → docsig-0.59.2}/docsig/_config.py +0 -0
- {docsig-0.59.0 → docsig-0.59.2}/docsig/_decorators.py +0 -0
- {docsig-0.59.0 → docsig-0.59.2}/docsig/_directives.py +0 -0
- {docsig-0.59.0 → docsig-0.59.2}/docsig/_hooks.py +0 -0
- {docsig-0.59.0 → docsig-0.59.2}/docsig/_main.py +0 -0
- {docsig-0.59.0 → docsig-0.59.2}/docsig/_report.py +0 -0
- {docsig-0.59.0 → docsig-0.59.2}/docsig/_stub.py +0 -0
- {docsig-0.59.0 → docsig-0.59.2}/docsig/_utils.py +0 -0
- {docsig-0.59.0 → docsig-0.59.2}/docsig/messages.py +0 -0
- {docsig-0.59.0 → docsig-0.59.2}/docsig/plugin.py +0 -0
- {docsig-0.59.0 → docsig-0.59.2}/docsig/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: docsig
|
|
3
|
-
Version: 0.59.
|
|
3
|
+
Version: 0.59.2
|
|
4
4
|
Summary: Check signature params for proper documentation
|
|
5
5
|
Home-page: https://pypi.org/project/docsig/
|
|
6
6
|
License: MIT
|
|
@@ -169,7 +169,7 @@ ensure your installation has registered `docsig`
|
|
|
169
169
|
.. code-block:: console
|
|
170
170
|
|
|
171
171
|
$ flake8 --version
|
|
172
|
-
7.1.0 (docsig: 0.59.
|
|
172
|
+
7.1.0 (docsig: 0.59.2, mccabe: 0.7.0, pycodestyle: 2.12.0, pyflakes: 3.2.0) CPython 3.8.13 on Darwin
|
|
173
173
|
|
|
174
174
|
And now use `flake8` to lint your files
|
|
175
175
|
|
|
@@ -258,7 +258,7 @@ Standalone
|
|
|
258
258
|
|
|
259
259
|
repos:
|
|
260
260
|
- repo: https://github.com/jshwi/docsig
|
|
261
|
-
rev: v0.59.
|
|
261
|
+
rev: v0.59.2
|
|
262
262
|
hooks:
|
|
263
263
|
- id: docsig
|
|
264
264
|
args:
|
|
@@ -277,7 +277,7 @@ or integrated with ``flake8``
|
|
|
277
277
|
hooks:
|
|
278
278
|
- id: flake8
|
|
279
279
|
additional_dependencies:
|
|
280
|
-
- docsig==0.59.
|
|
280
|
+
- docsig==0.59.2
|
|
281
281
|
args:
|
|
282
282
|
- "--sig-check-class"
|
|
283
283
|
- "--sig-check-dunders"
|
|
@@ -143,7 +143,7 @@ ensure your installation has registered `docsig`
|
|
|
143
143
|
.. code-block:: console
|
|
144
144
|
|
|
145
145
|
$ flake8 --version
|
|
146
|
-
7.1.0 (docsig: 0.59.
|
|
146
|
+
7.1.0 (docsig: 0.59.2, mccabe: 0.7.0, pycodestyle: 2.12.0, pyflakes: 3.2.0) CPython 3.8.13 on Darwin
|
|
147
147
|
|
|
148
148
|
And now use `flake8` to lint your files
|
|
149
149
|
|
|
@@ -232,7 +232,7 @@ Standalone
|
|
|
232
232
|
|
|
233
233
|
repos:
|
|
234
234
|
- repo: https://github.com/jshwi/docsig
|
|
235
|
-
rev: v0.59.
|
|
235
|
+
rev: v0.59.2
|
|
236
236
|
hooks:
|
|
237
237
|
- id: docsig
|
|
238
238
|
args:
|
|
@@ -251,7 +251,7 @@ or integrated with ``flake8``
|
|
|
251
251
|
hooks:
|
|
252
252
|
- id: flake8
|
|
253
253
|
additional_dependencies:
|
|
254
|
-
- docsig==0.59.
|
|
254
|
+
- docsig==0.59.2
|
|
255
255
|
args:
|
|
256
256
|
- "--sig-check-class"
|
|
257
257
|
- "--sig-check-dunders"
|
|
@@ -14,7 +14,6 @@ from . import _decorators
|
|
|
14
14
|
from ._directives import Directives as _Directives
|
|
15
15
|
from ._files import FILE_INFO as _FILE_INFO
|
|
16
16
|
from ._files import Paths as _Paths
|
|
17
|
-
from ._module import Ast as _Ast
|
|
18
17
|
from ._module import Function as _Function
|
|
19
18
|
from ._module import Parent as _Parent
|
|
20
19
|
from ._report import Failure as _Failure
|
|
@@ -27,20 +26,20 @@ from .messages import Messages as _Messages
|
|
|
27
26
|
|
|
28
27
|
_DEFAULT_EXCLUDES = """\
|
|
29
28
|
(?x)^(
|
|
30
|
-
|\\.?venv
|
|
31
|
-
|\\.git
|
|
32
|
-
|\\.hg
|
|
33
|
-
|\\.idea
|
|
34
|
-
|\\.mypy_cache
|
|
35
|
-
|\\.nox
|
|
36
|
-
|\\.pytest_cache
|
|
37
|
-
|\\.svn
|
|
38
|
-
|\\.tox
|
|
39
|
-
|\\.vscode
|
|
40
|
-
|_?build
|
|
41
|
-
|__pycache__
|
|
42
|
-
|dist
|
|
43
|
-
|node_modules
|
|
29
|
+
|\\.?venv[\\\\/].*
|
|
30
|
+
|\\.git[\\\\/].*
|
|
31
|
+
|\\.hg[\\\\/].*
|
|
32
|
+
|\\.idea[\\\\/].*
|
|
33
|
+
|\\.mypy_cache[\\\\/].*
|
|
34
|
+
|\\.nox[\\\\/].*
|
|
35
|
+
|\\.pytest_cache[\\\\/].*
|
|
36
|
+
|\\.svn[\\\\/].*
|
|
37
|
+
|\\.tox[\\\\/].*
|
|
38
|
+
|\\.vscode[\\\\/].*
|
|
39
|
+
|_?build[\\\\/].*
|
|
40
|
+
|__pycache__[\\\\/].*
|
|
41
|
+
|dist[\\\\/].*
|
|
42
|
+
|node_modules[\\\\/].*
|
|
44
43
|
)$
|
|
45
44
|
"""
|
|
46
45
|
|
|
@@ -119,6 +118,56 @@ def _run_check( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
119
118
|
)
|
|
120
119
|
|
|
121
120
|
|
|
121
|
+
def _parse_ast( # pylint: disable=too-many-arguments
|
|
122
|
+
messages: _Messages,
|
|
123
|
+
ignore_args: bool,
|
|
124
|
+
ignore_kwargs: bool,
|
|
125
|
+
check_class_constructor,
|
|
126
|
+
verbose: bool,
|
|
127
|
+
no_ansi: bool,
|
|
128
|
+
root: _Path | None = None,
|
|
129
|
+
string: str | None = None,
|
|
130
|
+
) -> tuple[_Parent | None, int]:
|
|
131
|
+
parent = None
|
|
132
|
+
retcode = 0
|
|
133
|
+
try:
|
|
134
|
+
if root is not None:
|
|
135
|
+
string = root.read_text(encoding="utf-8")
|
|
136
|
+
|
|
137
|
+
# empty string won't happen but keeps the
|
|
138
|
+
# typechecker happy
|
|
139
|
+
string = string or ""
|
|
140
|
+
parent = _Parent(
|
|
141
|
+
_ast.parse(string),
|
|
142
|
+
_Directives(string, messages),
|
|
143
|
+
root,
|
|
144
|
+
ignore_args,
|
|
145
|
+
ignore_kwargs,
|
|
146
|
+
check_class_constructor,
|
|
147
|
+
)
|
|
148
|
+
_vprint(
|
|
149
|
+
_FILE_INFO.format(
|
|
150
|
+
path=root or "stdin", msg="Parsing Python code successful"
|
|
151
|
+
),
|
|
152
|
+
verbose,
|
|
153
|
+
)
|
|
154
|
+
except (_ast.AstroidSyntaxError, UnicodeDecodeError) as err:
|
|
155
|
+
msg = str(err).replace("\n", " ")
|
|
156
|
+
if root is not None and root.name.endswith(".py"):
|
|
157
|
+
# pass by silently for files that do not end with .py, may
|
|
158
|
+
# result in a 123 syntax error exit status in the future
|
|
159
|
+
print(root, file=_sys.stderr)
|
|
160
|
+
_pretty_print_error(type(err), msg, no_ansi=no_ansi)
|
|
161
|
+
retcode = 1
|
|
162
|
+
|
|
163
|
+
_vprint(
|
|
164
|
+
_FILE_INFO.format(path=root or "stdin", msg=msg),
|
|
165
|
+
verbose,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
return parent, retcode
|
|
169
|
+
|
|
170
|
+
|
|
122
171
|
def _get_failures( # pylint: disable=too-many-locals,too-many-arguments
|
|
123
172
|
module: _Parent,
|
|
124
173
|
check_class: bool,
|
|
@@ -228,22 +277,16 @@ def runner( # pylint: disable=too-many-locals,too-many-arguments
|
|
|
228
277
|
:return: Exit status for whether test failed or not.
|
|
229
278
|
"""
|
|
230
279
|
failures = _Failures()
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
)
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
_Directives(string, disable or _Messages()),
|
|
242
|
-
path,
|
|
243
|
-
ignore_args,
|
|
244
|
-
ignore_kwargs,
|
|
245
|
-
check_class_constructor,
|
|
246
|
-
)
|
|
280
|
+
module, retcode = _parse_ast(
|
|
281
|
+
disable or _Messages(),
|
|
282
|
+
ignore_args,
|
|
283
|
+
ignore_kwargs,
|
|
284
|
+
check_class_constructor,
|
|
285
|
+
verbose,
|
|
286
|
+
no_ansi,
|
|
287
|
+
root=_Path(file),
|
|
288
|
+
)
|
|
289
|
+
if module:
|
|
247
290
|
failures = _get_failures(
|
|
248
291
|
module,
|
|
249
292
|
check_class,
|
|
@@ -259,20 +302,8 @@ def runner( # pylint: disable=too-many-locals,too-many-arguments
|
|
|
259
302
|
no_ansi,
|
|
260
303
|
target or _Messages(),
|
|
261
304
|
)
|
|
262
|
-
return failures, 0
|
|
263
|
-
|
|
264
|
-
if path.name.endswith(".py"):
|
|
265
|
-
# pass by silently for files that do not end with .py, may
|
|
266
|
-
# result in a 123 syntax error exit status in the future
|
|
267
|
-
print(path, file=_sys.stderr)
|
|
268
|
-
_pretty_print_error(type(ast.err), str(ast.err), no_ansi=no_ansi)
|
|
269
|
-
return failures, 1
|
|
270
305
|
|
|
271
|
-
|
|
272
|
-
_FILE_INFO.format(path=path, msg=str(ast.err)),
|
|
273
|
-
verbose,
|
|
274
|
-
)
|
|
275
|
-
return failures, 0
|
|
306
|
+
return failures, retcode
|
|
276
307
|
|
|
277
308
|
|
|
278
309
|
@_decorators.parse_msgs
|
|
@@ -380,21 +411,16 @@ def docsig( # pylint: disable=too-many-locals,too-many-arguments
|
|
|
380
411
|
|
|
381
412
|
return retcode
|
|
382
413
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
_Directives(string, messages=disable or _Messages()),
|
|
394
|
-
ignore_args=ignore_args,
|
|
395
|
-
ignore_kwargs=ignore_kwargs,
|
|
396
|
-
check_class_constructor=check_class_constructor,
|
|
397
|
-
)
|
|
414
|
+
module, retcode = _parse_ast(
|
|
415
|
+
disable or _Messages(),
|
|
416
|
+
ignore_args,
|
|
417
|
+
ignore_kwargs,
|
|
418
|
+
check_class_constructor,
|
|
419
|
+
verbose,
|
|
420
|
+
no_ansi,
|
|
421
|
+
string=string,
|
|
422
|
+
)
|
|
423
|
+
if module is not None:
|
|
398
424
|
failures = _get_failures(
|
|
399
425
|
module,
|
|
400
426
|
check_class,
|
|
@@ -414,6 +440,4 @@ def docsig( # pylint: disable=too-many-locals,too-many-arguments
|
|
|
414
440
|
_report(failures, no_ansi=no_ansi)
|
|
415
441
|
return 1
|
|
416
442
|
|
|
417
|
-
_vprint(_FILE_INFO.format(path="stdin", msg=str(ast.err)), verbose)
|
|
418
|
-
|
|
419
443
|
return 0
|
|
@@ -88,21 +88,24 @@ class Paths(_t.List[_Path]): # pylint: disable=too-many-instance-attributes
|
|
|
88
88
|
for path in paths:
|
|
89
89
|
self._populate(path)
|
|
90
90
|
|
|
91
|
+
for path in list(self):
|
|
92
|
+
if str(path) != "." and any(
|
|
93
|
+
_re.match(i, str(path)) for i in self._excludes
|
|
94
|
+
):
|
|
95
|
+
_vprint(
|
|
96
|
+
FILE_INFO.format(
|
|
97
|
+
path=path, msg="in exclude list, skipping"
|
|
98
|
+
),
|
|
99
|
+
self._verbose,
|
|
100
|
+
)
|
|
101
|
+
self.remove(path)
|
|
102
|
+
|
|
91
103
|
self.sort()
|
|
92
104
|
|
|
93
105
|
def _populate(self, root: _Path) -> None:
|
|
94
106
|
if not root.exists():
|
|
95
107
|
raise FileNotFoundError(root)
|
|
96
108
|
|
|
97
|
-
if str(root) != "." and any(
|
|
98
|
-
_re.match(i, root.name) for i in self._excludes
|
|
99
|
-
):
|
|
100
|
-
_vprint(
|
|
101
|
-
FILE_INFO.format(path=root, msg="in exclude list, skipping"),
|
|
102
|
-
self._verbose,
|
|
103
|
-
)
|
|
104
|
-
return
|
|
105
|
-
|
|
106
109
|
if not self._include_ignored and self._gitignore.match_file(root):
|
|
107
110
|
_vprint(
|
|
108
111
|
FILE_INFO.format(path=root, msg="in gitignore, skipping"),
|
|
@@ -308,23 +308,3 @@ class Function(Parent):
|
|
|
308
308
|
:param rettype: Return type of overloaded signature.
|
|
309
309
|
"""
|
|
310
310
|
self._signature.overload(rettype)
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
class Ast(_t.NamedTuple):
|
|
314
|
-
"""Object resulting from parsing an AST."""
|
|
315
|
-
|
|
316
|
-
module: _ast.Module = _ast.Module("")
|
|
317
|
-
err: Exception = Exception()
|
|
318
|
-
success: bool = False
|
|
319
|
-
|
|
320
|
-
@classmethod
|
|
321
|
-
def parse(cls, string: str) -> Ast:
|
|
322
|
-
"""Parse an AST.
|
|
323
|
-
|
|
324
|
-
:param string: String to parse.
|
|
325
|
-
:return: Constructed AST object, whether successful or not.
|
|
326
|
-
"""
|
|
327
|
-
try:
|
|
328
|
-
return cls(module=_ast.parse(string), success=True)
|
|
329
|
-
except (_ast.AstroidSyntaxError, UnicodeDecodeError) as err:
|
|
330
|
-
return cls(err=err)
|
|
@@ -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.59.
|
|
14
|
+
current_version = "0.59.2"
|
|
15
15
|
message = "bump: version {current_version} → {new_version}"
|
|
16
16
|
sign_tags = true
|
|
17
17
|
tag = true
|
|
@@ -132,7 +132,7 @@ maintainers = [
|
|
|
132
132
|
name = "docsig"
|
|
133
133
|
readme = "README.rst"
|
|
134
134
|
repository = "https://github.com/jshwi/docsig"
|
|
135
|
-
version = "0.59.
|
|
135
|
+
version = "0.59.2"
|
|
136
136
|
|
|
137
137
|
[tool.poetry.dependencies]
|
|
138
138
|
Sphinx = "^7.0.0"
|
|
@@ -144,7 +144,7 @@ python = "^3.8.1"
|
|
|
144
144
|
[tool.poetry.group.dev.dependencies]
|
|
145
145
|
black = "^24.4.2"
|
|
146
146
|
bump-my-version = "^0.24.1"
|
|
147
|
-
deptry = "
|
|
147
|
+
deptry = ">=0.16.1,<0.18.0"
|
|
148
148
|
docformatter = "^1.7.5"
|
|
149
149
|
flynt = "^1.0.1"
|
|
150
150
|
gitpython = "^3.1.43"
|
|
@@ -160,6 +160,7 @@ vulture = "^2.11"
|
|
|
160
160
|
|
|
161
161
|
[tool.poetry.group.docs.dependencies]
|
|
162
162
|
furo = "^2024.4.27"
|
|
163
|
+
incremental = "22.10.0"
|
|
163
164
|
myst-parser = "^3.0.1"
|
|
164
165
|
pytest = "^8.2.0"
|
|
165
166
|
pyyaml = "^6.0.1"
|
|
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
|
|
File without changes
|
|
File without changes
|