docsig 0.85.2__tar.gz → 0.86.1__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.85.2 → docsig-0.86.1}/PKG-INFO +7 -7
- {docsig-0.85.2 → docsig-0.86.1}/README.rst +6 -6
- {docsig-0.85.2 → docsig-0.86.1}/docsig/_config.py +18 -10
- {docsig-0.85.2 → docsig-0.86.1}/docsig/_core.py +8 -4
- {docsig-0.85.2 → docsig-0.86.1}/docsig/_decorators.py +8 -4
- {docsig-0.85.2 → docsig-0.86.1}/docsig/_files.py +6 -6
- {docsig-0.85.2 → docsig-0.86.1}/docsig/_main.py +0 -1
- {docsig-0.85.2 → docsig-0.86.1}/docsig/_report.py +16 -13
- {docsig-0.85.2 → docsig-0.86.1}/docsig/_version.py +1 -1
- {docsig-0.85.2 → docsig-0.86.1}/pyproject.toml +2 -7
- {docsig-0.85.2 → docsig-0.86.1}/LICENSE +0 -0
- {docsig-0.85.2 → docsig-0.86.1}/docsig/__init__.py +0 -0
- {docsig-0.85.2 → docsig-0.86.1}/docsig/__main__.py +0 -0
- {docsig-0.85.2 → docsig-0.86.1}/docsig/_check.py +0 -0
- {docsig-0.85.2 → docsig-0.86.1}/docsig/_directives.py +0 -0
- {docsig-0.85.2 → docsig-0.86.1}/docsig/_hooks.py +0 -0
- {docsig-0.85.2 → docsig-0.86.1}/docsig/_module.py +0 -0
- {docsig-0.85.2 → docsig-0.86.1}/docsig/_parsers.py +0 -0
- {docsig-0.85.2 → docsig-0.86.1}/docsig/_stub.py +0 -0
- {docsig-0.85.2 → docsig-0.86.1}/docsig/_utils.py +0 -0
- {docsig-0.85.2 → docsig-0.86.1}/docsig/messages.py +0 -0
- {docsig-0.85.2 → docsig-0.86.1}/docsig/plugin/__init__.py +0 -0
- {docsig-0.85.2 → docsig-0.86.1}/docsig/plugin/_flake8.py +0 -0
- {docsig-0.85.2 → docsig-0.86.1}/docsig/plugin/_validate_pyproject.py +0 -0
- {docsig-0.85.2 → docsig-0.86.1}/docsig/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: docsig
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.86.1
|
|
4
4
|
Summary: Check signature params for proper documentation
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -195,7 +195,7 @@ ensure your installation has registered `docsig`
|
|
|
195
195
|
.. code-block:: console
|
|
196
196
|
|
|
197
197
|
$ flake8 --version
|
|
198
|
-
7.3.0 (docsig: 0.
|
|
198
|
+
7.3.0 (docsig: 0.86.1, mccabe: 0.7.0, pycodestyle: 2.14.0, pyflakes: 3.4.0) CPython 3.10.19 on Darwin
|
|
199
199
|
|
|
200
200
|
And now use `flake8` to lint your files
|
|
201
201
|
|
|
@@ -212,9 +212,9 @@ avoid any potential conflicts with other plugins
|
|
|
212
212
|
.. code-block:: ini
|
|
213
213
|
|
|
214
214
|
[flake8]
|
|
215
|
-
sig-check-dunders =
|
|
216
|
-
sig-check-overridden =
|
|
217
|
-
sig-check-protected =
|
|
215
|
+
sig-check-dunders = true
|
|
216
|
+
sig-check-overridden = true
|
|
217
|
+
sig-check-protected = true
|
|
218
218
|
|
|
219
219
|
..
|
|
220
220
|
end flake8
|
|
@@ -281,7 +281,7 @@ Standalone
|
|
|
281
281
|
|
|
282
282
|
repos:
|
|
283
283
|
- repo: https://github.com/jshwi/docsig
|
|
284
|
-
rev: v0.
|
|
284
|
+
rev: v0.86.1
|
|
285
285
|
hooks:
|
|
286
286
|
- id: docsig
|
|
287
287
|
args:
|
|
@@ -300,7 +300,7 @@ or integrated with ``flake8``
|
|
|
300
300
|
hooks:
|
|
301
301
|
- id: flake8
|
|
302
302
|
additional_dependencies:
|
|
303
|
-
- docsig==0.
|
|
303
|
+
- docsig==0.86.1
|
|
304
304
|
args:
|
|
305
305
|
- "--sig-check-class"
|
|
306
306
|
- "--sig-check-dunders"
|
|
@@ -166,7 +166,7 @@ ensure your installation has registered `docsig`
|
|
|
166
166
|
.. code-block:: console
|
|
167
167
|
|
|
168
168
|
$ flake8 --version
|
|
169
|
-
7.3.0 (docsig: 0.
|
|
169
|
+
7.3.0 (docsig: 0.86.1, mccabe: 0.7.0, pycodestyle: 2.14.0, pyflakes: 3.4.0) CPython 3.10.19 on Darwin
|
|
170
170
|
|
|
171
171
|
And now use `flake8` to lint your files
|
|
172
172
|
|
|
@@ -183,9 +183,9 @@ avoid any potential conflicts with other plugins
|
|
|
183
183
|
.. code-block:: ini
|
|
184
184
|
|
|
185
185
|
[flake8]
|
|
186
|
-
sig-check-dunders =
|
|
187
|
-
sig-check-overridden =
|
|
188
|
-
sig-check-protected =
|
|
186
|
+
sig-check-dunders = true
|
|
187
|
+
sig-check-overridden = true
|
|
188
|
+
sig-check-protected = true
|
|
189
189
|
|
|
190
190
|
..
|
|
191
191
|
end flake8
|
|
@@ -252,7 +252,7 @@ Standalone
|
|
|
252
252
|
|
|
253
253
|
repos:
|
|
254
254
|
- repo: https://github.com/jshwi/docsig
|
|
255
|
-
rev: v0.
|
|
255
|
+
rev: v0.86.1
|
|
256
256
|
hooks:
|
|
257
257
|
- id: docsig
|
|
258
258
|
args:
|
|
@@ -271,7 +271,7 @@ or integrated with ``flake8``
|
|
|
271
271
|
hooks:
|
|
272
272
|
- id: flake8
|
|
273
273
|
additional_dependencies:
|
|
274
|
-
- docsig==0.
|
|
274
|
+
- docsig==0.86.1
|
|
275
275
|
args:
|
|
276
276
|
- "--sig-check-class"
|
|
277
277
|
- "--sig-check-dunders"
|
|
@@ -147,17 +147,10 @@ def build_parser() -> _ArgumentParser:
|
|
|
147
147
|
help="check class docstrings",
|
|
148
148
|
dest="check_class",
|
|
149
149
|
)
|
|
150
|
-
group.add_argument(
|
|
151
|
-
"-C",
|
|
152
|
-
action="store_true",
|
|
153
|
-
help=_argparse.SUPPRESS,
|
|
154
|
-
dest="check_class_constructor",
|
|
155
|
-
)
|
|
156
150
|
group.add_argument(
|
|
157
151
|
"--check-class-constructor",
|
|
158
152
|
action="store_true",
|
|
159
153
|
help="check __init__ methods",
|
|
160
|
-
dest="check_class_constructor",
|
|
161
154
|
)
|
|
162
155
|
parser.add_argument(
|
|
163
156
|
"-D",
|
|
@@ -343,6 +336,23 @@ class Ignore:
|
|
|
343
336
|
kwargs: bool = False
|
|
344
337
|
|
|
345
338
|
|
|
339
|
+
@_dataclass
|
|
340
|
+
# pylint: disable-next=too-few-public-methods
|
|
341
|
+
class Filters:
|
|
342
|
+
"""Configuration for which paths to filter.
|
|
343
|
+
|
|
344
|
+
:param exclude: Regular expression of files and dirs to exclude from
|
|
345
|
+
checks.
|
|
346
|
+
:param excludes: Files or dirs to exclude from checks.
|
|
347
|
+
:param include_ignored: Check files even if they match a gitignore
|
|
348
|
+
pattern.
|
|
349
|
+
"""
|
|
350
|
+
|
|
351
|
+
exclude: list[str] = _field(default_factory=list)
|
|
352
|
+
excludes: list[str] = _field(default_factory=list)
|
|
353
|
+
include_ignored: bool = False
|
|
354
|
+
|
|
355
|
+
|
|
346
356
|
@_dataclass(frozen=True)
|
|
347
357
|
# pylint: disable-next=too-many-instance-attributes,too-few-public-methods
|
|
348
358
|
class Config:
|
|
@@ -354,11 +364,9 @@ class Config:
|
|
|
354
364
|
|
|
355
365
|
check: Check = _field(default_factory=Check)
|
|
356
366
|
ignore: Ignore = _field(default_factory=Ignore)
|
|
367
|
+
filters: Filters = _field(default_factory=Filters)
|
|
357
368
|
target: _Messages = _field(default_factory=_Messages)
|
|
358
369
|
disable: _Messages = _field(default_factory=_Messages)
|
|
359
|
-
exclude: list[str] = _field(default_factory=list)
|
|
360
|
-
excludes: list[str] = _field(default_factory=list)
|
|
361
370
|
list_checks: bool = False
|
|
362
|
-
include_ignored: bool = False
|
|
363
371
|
no_ansi: bool = False
|
|
364
372
|
verbose: bool = False
|
|
@@ -15,6 +15,7 @@ from . import _decorators
|
|
|
15
15
|
from ._check import run_checks as _run_checks
|
|
16
16
|
from ._config import Check as _Check
|
|
17
17
|
from ._config import Config as _Config
|
|
18
|
+
from ._config import Filters as _Filters
|
|
18
19
|
from ._config import Ignore as _Ignore
|
|
19
20
|
from ._files import Files as _Files
|
|
20
21
|
from ._parsers import parse_from_file as _parse_from_file
|
|
@@ -191,17 +192,20 @@ def docsig( # pylint: disable=too-many-locals,too-many-arguments
|
|
|
191
192
|
args=ignore_args,
|
|
192
193
|
kwargs=ignore_kwargs,
|
|
193
194
|
)
|
|
195
|
+
filters = _Filters(
|
|
196
|
+
include_ignored=include_ignored,
|
|
197
|
+
exclude=exclude_,
|
|
198
|
+
excludes=excludes or [],
|
|
199
|
+
)
|
|
194
200
|
config = _Config(
|
|
195
201
|
list_checks=list_checks,
|
|
196
|
-
include_ignored=include_ignored,
|
|
197
202
|
check=check,
|
|
198
203
|
ignore=ignore,
|
|
204
|
+
filters=filters,
|
|
199
205
|
no_ansi=no_ansi,
|
|
200
206
|
verbose=verbose,
|
|
201
207
|
target=target or _Messages(),
|
|
202
208
|
disable=disable,
|
|
203
|
-
exclude=exclude_,
|
|
204
|
-
excludes=excludes or [],
|
|
205
209
|
)
|
|
206
210
|
setup_logger(config.verbose)
|
|
207
211
|
logger = _logging.getLogger(__package__)
|
|
@@ -215,7 +219,7 @@ def docsig( # pylint: disable=too-many-locals,too-many-arguments
|
|
|
215
219
|
return _report(failures, config)
|
|
216
220
|
|
|
217
221
|
retcodes = [0]
|
|
218
|
-
files = _Files(path, config)
|
|
222
|
+
files = _Files(path, config.filters)
|
|
219
223
|
for file in files:
|
|
220
224
|
failures = runner(file, config)
|
|
221
225
|
retcode = _report(failures, config, str(file))
|
|
@@ -11,7 +11,7 @@ from pathlib import Path as _Path
|
|
|
11
11
|
from .messages import E as _E
|
|
12
12
|
|
|
13
13
|
_FuncType = _t.Callable[..., int]
|
|
14
|
-
_WrappedFuncType = _t.Callable[...,
|
|
14
|
+
_WrappedFuncType = _t.Callable[..., int]
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def parse_msgs(func: _WrappedFuncType) -> _WrappedFuncType:
|
|
@@ -25,7 +25,7 @@ def parse_msgs(func: _WrappedFuncType) -> _WrappedFuncType:
|
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
@_functools.wraps(func)
|
|
28
|
-
def _wrapper(*args: str | _Path, **kwargs: _t.Any) ->
|
|
28
|
+
def _wrapper(*args: str | _Path, **kwargs: _t.Any) -> int:
|
|
29
29
|
disable = _E.from_codes(kwargs.get("disable", [])) or None
|
|
30
30
|
target = _E.from_codes(kwargs.get("target", [])) or None
|
|
31
31
|
kwargs["disable"] = disable
|
|
@@ -50,7 +50,7 @@ def validate_args(func: _FuncType) -> _WrappedFuncType:
|
|
|
50
50
|
"""
|
|
51
51
|
|
|
52
52
|
@_functools.wraps(func)
|
|
53
|
-
def _wrapper(*args: str | _Path, **kwargs: _t.Any) ->
|
|
53
|
+
def _wrapper(*args: str | _Path, **kwargs: _t.Any) -> int:
|
|
54
54
|
stderr = []
|
|
55
55
|
if not kwargs.get("list_checks", False):
|
|
56
56
|
if not args and not kwargs.get("string"):
|
|
@@ -88,6 +88,10 @@ def validate_args(func: _FuncType) -> _WrappedFuncType:
|
|
|
88
88
|
"please check your pyproject.toml configuration",
|
|
89
89
|
)
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
if stderr:
|
|
92
|
+
print("\n".join(stderr), file=_sys.stderr)
|
|
93
|
+
return 2
|
|
94
|
+
|
|
95
|
+
return func(*args, **kwargs)
|
|
92
96
|
|
|
93
97
|
return _wrapper
|
|
@@ -14,7 +14,7 @@ from pathspec import PathSpec as _PathSpec
|
|
|
14
14
|
from pathspec.patterns import GitWildMatchPattern as _GitWildMatchPattern
|
|
15
15
|
from wcmatch.pathlib import Path as _WcPath
|
|
16
16
|
|
|
17
|
-
from ._config import
|
|
17
|
+
from ._config import Filters as _Filters
|
|
18
18
|
|
|
19
19
|
FILE_INFO = "%s: %s"
|
|
20
20
|
|
|
@@ -72,16 +72,16 @@ class Files(list[_Path]):
|
|
|
72
72
|
"""Collect paths to check (gitignore and exclude applied).
|
|
73
73
|
|
|
74
74
|
:param paths: Path(s) to collect (files or directories).
|
|
75
|
-
:param
|
|
75
|
+
:param filters: Filters object.
|
|
76
76
|
"""
|
|
77
77
|
|
|
78
78
|
def __init__(
|
|
79
79
|
self,
|
|
80
80
|
paths: tuple[str | _Path, ...],
|
|
81
|
-
|
|
81
|
+
filters: _Filters,
|
|
82
82
|
) -> None:
|
|
83
83
|
super().__init__()
|
|
84
|
-
self._include_ignored =
|
|
84
|
+
self._include_ignored = filters.include_ignored
|
|
85
85
|
self._gitignore = _Gitignore()
|
|
86
86
|
logger = _logging.getLogger(__package__)
|
|
87
87
|
for path in paths:
|
|
@@ -89,8 +89,8 @@ class Files(list[_Path]):
|
|
|
89
89
|
|
|
90
90
|
for path in list(self):
|
|
91
91
|
if str(path) != "." and (
|
|
92
|
-
any(_re.match(i, str(path)) for i in
|
|
93
|
-
or any(_glob(path, i) for i in
|
|
92
|
+
any(_re.match(i, str(path)) for i in filters.exclude)
|
|
93
|
+
or any(_glob(path, i) for i in filters.excludes)
|
|
94
94
|
):
|
|
95
95
|
logger.debug(FILE_INFO, path, "in exclude list, skipping")
|
|
96
96
|
self.remove(path)
|
|
@@ -16,7 +16,6 @@ from ._hooks import excepthook as _excepthook
|
|
|
16
16
|
def _warn_on_deprecated_short_flags() -> None:
|
|
17
17
|
deprecated_short_flags = {
|
|
18
18
|
"-c": "--check-class",
|
|
19
|
-
"-C": "--check-class-constructor",
|
|
20
19
|
"-D": "--check-dunders",
|
|
21
20
|
"-o": "--check-overridden",
|
|
22
21
|
"-p": "--check-protected",
|
|
@@ -61,7 +61,7 @@ class Failure(list[Failed]):
|
|
|
61
61
|
|
|
62
62
|
def __init__(self, func: _Function, config: _Config) -> None:
|
|
63
63
|
super().__init__()
|
|
64
|
-
self._retcode = 0
|
|
64
|
+
self._retcode = [0]
|
|
65
65
|
self._func = func
|
|
66
66
|
if config.target:
|
|
67
67
|
self._func.messages.extend(
|
|
@@ -77,6 +77,7 @@ class Failure(list[Failed]):
|
|
|
77
77
|
self._name = f"{self._func.parent.name}.{self._name}"
|
|
78
78
|
|
|
79
79
|
if self._func.error is not None:
|
|
80
|
+
self._retcode.append(2)
|
|
80
81
|
self._sig9xx_error()
|
|
81
82
|
else:
|
|
82
83
|
self._sig0xx_config()
|
|
@@ -100,7 +101,7 @@ class Failure(list[Failed]):
|
|
|
100
101
|
hint: bool = False,
|
|
101
102
|
**kwargs: _t.Any,
|
|
102
103
|
) -> None:
|
|
103
|
-
self._retcode
|
|
104
|
+
self._retcode.append(int(not value.new))
|
|
104
105
|
failed = Failed(
|
|
105
106
|
self._name,
|
|
106
107
|
value.ref,
|
|
@@ -321,7 +322,7 @@ class Failure(list[Failed]):
|
|
|
321
322
|
# invalid-syntax
|
|
322
323
|
if self._func.error is _ast.AstroidSyntaxError:
|
|
323
324
|
self._add(_E[901])
|
|
324
|
-
self._retcode
|
|
325
|
+
self._retcode.append(123)
|
|
325
326
|
# unicode-decode-error
|
|
326
327
|
if self._func.error is UnicodeDecodeError:
|
|
327
328
|
self._add(_E[902])
|
|
@@ -345,7 +346,7 @@ class Failure(list[Failed]):
|
|
|
345
346
|
@property
|
|
346
347
|
def retcode(self) -> int:
|
|
347
348
|
"""Exit code (non-zero if any check failed)."""
|
|
348
|
-
return self._retcode
|
|
349
|
+
return max(self._retcode)
|
|
349
350
|
|
|
350
351
|
|
|
351
352
|
def report(
|
|
@@ -364,6 +365,7 @@ def report(
|
|
|
364
365
|
:return: Exit code (non-zero if any check failed).
|
|
365
366
|
"""
|
|
366
367
|
retcodes = [0]
|
|
368
|
+
output = []
|
|
367
369
|
for failure in failures:
|
|
368
370
|
retcodes.append(failure.retcode)
|
|
369
371
|
path_prefix = f"{file}:" if file is not None else ""
|
|
@@ -371,7 +373,7 @@ def report(
|
|
|
371
373
|
if not config.no_ansi and _sys.stdout.isatty():
|
|
372
374
|
header = f"\033[35m{header}\033[0m"
|
|
373
375
|
|
|
374
|
-
|
|
376
|
+
output.append(header)
|
|
375
377
|
for item in failure:
|
|
376
378
|
extra = None
|
|
377
379
|
if item.hint:
|
|
@@ -381,15 +383,16 @@ def report(
|
|
|
381
383
|
extra = "warning: please remember to fix this or disable it"
|
|
382
384
|
_warn(_NEW.format(ref=item.ref), FutureWarning, stacklevel=3)
|
|
383
385
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
description=item.description,
|
|
389
|
-
symbolic=item.symbolic,
|
|
390
|
-
),
|
|
386
|
+
msg = _TEMPLATE.format(
|
|
387
|
+
ref=item.ref,
|
|
388
|
+
description=item.description,
|
|
389
|
+
symbolic=item.symbolic,
|
|
391
390
|
)
|
|
391
|
+
output.append(f" {msg}")
|
|
392
392
|
if extra is not None:
|
|
393
|
-
|
|
393
|
+
output.append(f" {extra}")
|
|
394
|
+
|
|
395
|
+
if output:
|
|
396
|
+
print("\n".join(output))
|
|
394
397
|
|
|
395
398
|
return max(retcodes)
|
|
@@ -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.86.1"
|
|
15
15
|
message = "bump: version {current_version} → {new_version}"
|
|
16
16
|
sign_tags = true
|
|
17
17
|
tag = true
|
|
@@ -27,11 +27,6 @@ filename = "pyproject.toml"
|
|
|
27
27
|
replace = 'version = "{new_version}"'
|
|
28
28
|
search = 'version = "{current_version}"'
|
|
29
29
|
|
|
30
|
-
[[tool.bumpversion.files]]
|
|
31
|
-
filename = "package.json"
|
|
32
|
-
replace = '"version": "{new_version}"'
|
|
33
|
-
search = '"version": "{current_version}"'
|
|
34
|
-
|
|
35
30
|
[[tool.bumpversion.files]]
|
|
36
31
|
filename = "README.rst"
|
|
37
32
|
replace = "rev: v{new_version}"
|
|
@@ -122,7 +117,7 @@ maintainers = [
|
|
|
122
117
|
name = "docsig"
|
|
123
118
|
readme = "README.rst"
|
|
124
119
|
repository = "https://github.com/jshwi/docsig"
|
|
125
|
-
version = "0.
|
|
120
|
+
version = "0.86.1"
|
|
126
121
|
|
|
127
122
|
[tool.poetry.dependencies]
|
|
128
123
|
Sphinx = ">=7,<9"
|
|
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
|
|
File without changes
|