docsig 0.82.0__tar.gz → 0.82.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docsig
3
- Version: 0.82.0
3
+ Version: 0.82.1
4
4
  Summary: Check signature params for proper documentation
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -184,7 +184,7 @@ ensure your installation has registered `docsig`
184
184
  .. code-block:: console
185
185
 
186
186
  $ flake8 --version
187
- 7.3.0 (docsig: 0.82.0, mccabe: 0.7.0, pycodestyle: 2.14.0, pyflakes: 3.4.0) CPython 3.10.19 on Darwin
187
+ 7.3.0 (docsig: 0.82.1, mccabe: 0.7.0, pycodestyle: 2.14.0, pyflakes: 3.4.0) CPython 3.10.19 on Darwin
188
188
 
189
189
  And now use `flake8` to lint your files
190
190
 
@@ -270,7 +270,7 @@ Standalone
270
270
 
271
271
  repos:
272
272
  - repo: https://github.com/jshwi/docsig
273
- rev: v0.82.0
273
+ rev: v0.82.1
274
274
  hooks:
275
275
  - id: docsig
276
276
  args:
@@ -289,7 +289,7 @@ or integrated with ``flake8``
289
289
  hooks:
290
290
  - id: flake8
291
291
  additional_dependencies:
292
- - docsig==0.82.0
292
+ - docsig==0.82.1
293
293
  args:
294
294
  - "--sig-check-class"
295
295
  - "--sig-check-dunders"
@@ -155,7 +155,7 @@ ensure your installation has registered `docsig`
155
155
  .. code-block:: console
156
156
 
157
157
  $ flake8 --version
158
- 7.3.0 (docsig: 0.82.0, mccabe: 0.7.0, pycodestyle: 2.14.0, pyflakes: 3.4.0) CPython 3.10.19 on Darwin
158
+ 7.3.0 (docsig: 0.82.1, mccabe: 0.7.0, pycodestyle: 2.14.0, pyflakes: 3.4.0) CPython 3.10.19 on Darwin
159
159
 
160
160
  And now use `flake8` to lint your files
161
161
 
@@ -241,7 +241,7 @@ Standalone
241
241
 
242
242
  repos:
243
243
  - repo: https://github.com/jshwi/docsig
244
- rev: v0.82.0
244
+ rev: v0.82.1
245
245
  hooks:
246
246
  - id: docsig
247
247
  args:
@@ -260,7 +260,7 @@ or integrated with ``flake8``
260
260
  hooks:
261
261
  - id: flake8
262
262
  additional_dependencies:
263
- - docsig==0.82.0
263
+ - docsig==0.82.1
264
264
  args:
265
265
  - "--sig-check-class"
266
266
  - "--sig-check-dunders"
@@ -364,7 +364,7 @@ class Config:
364
364
  target: _Messages = _field(default_factory=_Messages)
365
365
  disable: _Messages = _field(default_factory=_Messages)
366
366
  exclude: list[str] = _field(default_factory=list)
367
- excludes: list[str] | None = None
367
+ excludes: list[str] = _field(default_factory=list)
368
368
  list_checks: bool = False
369
369
  include_ignored: bool = False
370
370
  no_ansi: bool = False
@@ -199,7 +199,7 @@ def docsig( # pylint: disable=too-many-locals,too-many-arguments
199
199
  target=target or _Messages(),
200
200
  disable=disable,
201
201
  exclude=exclude_,
202
- excludes=excludes,
202
+ excludes=excludes or [],
203
203
  )
204
204
  setup_logger(config.verbose)
205
205
  if config.list_checks:
@@ -12,8 +12,8 @@ from pathlib import Path as _Path
12
12
 
13
13
  from .messages import E as _E
14
14
 
15
- _FuncType = _t.Callable[..., _t.Union[int]]
16
- _WrappedFuncType = _t.Callable[..., _t.Union[str, int]]
15
+ _FuncType = _t.Callable[..., int]
16
+ _WrappedFuncType = _t.Callable[..., str | int]
17
17
 
18
18
 
19
19
  def parse_msgs(func: _WrappedFuncType) -> _WrappedFuncType:
@@ -8,14 +8,13 @@ Parsing and storage for docsig comment directives.
8
8
  from __future__ import annotations as _
9
9
 
10
10
  import tokenize as _tokenize
11
- import typing as _t
12
11
  from io import StringIO as _StringIO
13
12
 
14
13
  from .messages import E as _E
15
14
  from .messages import Messages as _Messages
16
15
 
17
16
 
18
- class Comments(_t.List["Comment"]):
17
+ class Comments(list["Comment"]):
19
18
  """List of comments."""
20
19
 
21
20
 
@@ -96,7 +95,7 @@ class Comment(_Messages):
96
95
  return None
97
96
 
98
97
 
99
- class Directives(_t.Dict[int, _t.Tuple[Comments, _Messages]]):
98
+ class Directives(dict[int, tuple[Comments, _Messages]]):
100
99
  """Map line number to comments and disabled messages for that line.
101
100
 
102
101
  Keys are line numbers; values are tuples of comment directives and
@@ -10,7 +10,6 @@ from __future__ import annotations as _
10
10
  import logging as _logging
11
11
  import os as _os
12
12
  import re as _re
13
- import typing as _t
14
13
  from pathlib import Path as _Path
15
14
 
16
15
  from pathspec import PathSpec as _PathSpec
@@ -71,7 +70,7 @@ def _glob(path: _Path, pattern: str) -> bool:
71
70
  return _WcPath(str(path)).globmatch(pattern) # type: ignore
72
71
 
73
72
 
74
- class Files(_t.List[_Path]):
73
+ class Files(list[_Path]):
75
74
  """Collect paths to check (gitignore and exclude applied).
76
75
 
77
76
  :param paths: Path(s) to collect (files or directories).
@@ -93,7 +92,7 @@ class Files(_t.List[_Path]):
93
92
  for path in list(self):
94
93
  if str(path) != "." and (
95
94
  any(_re.match(i, str(path)) for i in config.exclude)
96
- or any(_glob(path, i) for i in config.excludes or [])
95
+ or any(_glob(path, i) for i in config.excludes)
97
96
  ):
98
97
  logger.debug(FILE_INFO, path, "in exclude list, skipping")
99
98
  self.remove(path)
@@ -23,16 +23,13 @@ from ._stub import Signature as _Signature
23
23
  from .messages import Messages as _Messages
24
24
 
25
25
 
26
- class _Imports(_t.Dict[str, str]):
27
- """Represents python imports."""
26
+ class _Imports(dict[str, str]): ...
28
27
 
29
28
 
30
- class _Overloads(_t.Dict[str, "Function"]):
31
- """Represents overloaded methods."""
29
+ class _Overloads(dict[str, "Function"]): ...
32
30
 
33
31
 
34
- class _Children(_t.List[_t.Union["Parent", "Function"]]):
35
- """Represents children of an object."""
32
+ class _Children(list[_t.Union["Parent", "Function"]]): ...
36
33
 
37
34
 
38
35
  class Error(_Enum):
@@ -36,7 +36,7 @@ _MIN_MATCH = 0.8
36
36
  _MAX_MATCH = 1.0
37
37
 
38
38
 
39
- class Failures(_t.List["Failure"]):
39
+ class Failures(list["Failure"]):
40
40
  """Sequence of Failure instances (one per function checked)."""
41
41
 
42
42
 
@@ -52,7 +52,7 @@ class Failed(_t.NamedTuple):
52
52
  new: bool = False
53
53
 
54
54
 
55
- class Failure(_t.List[Failed]):
55
+ class Failure(list[Failed]):
56
56
  """Collect docstring and signature failures for one function.
57
57
 
58
58
  Runs configured checks and appends Failed entries for each
@@ -9,7 +9,6 @@ from __future__ import annotations as _
9
9
 
10
10
  import re as _re
11
11
  import textwrap as _textwrap
12
- import typing as _t
13
12
  from collections import Counter as _Counter
14
13
  from enum import Enum as _Enum
15
14
 
@@ -153,7 +152,7 @@ class Param:
153
152
  return self._closing_token
154
153
 
155
154
 
156
- class Params(_t.List[Param]):
155
+ class Params(list[Param]):
157
156
  """A list-like collection of params.
158
157
 
159
158
  :param ignore: Configuration object for what to ignore.
@@ -366,15 +365,12 @@ class Docstring(_Stub):
366
365
  # todo: we can start building return objects for more detailed
367
366
  # todo: checks that are in common with the params class
368
367
  match = _re.search(
369
- ":(?:returns?|yields?):(.*)?",
368
+ r":(?:returns?|yields?):\s*(.*)",
370
369
  string,
371
370
  _re.IGNORECASE,
372
371
  )
373
372
  returns = bool(match)
374
- ret_description_missing = False
375
- if match:
376
- ret_description_missing = not match.group(1)
377
-
373
+ ret_description_missing = not match or not match.group(1)
378
374
  docstring = cls(string, returns, ret_description_missing)
379
375
  for match in _re.findall(
380
376
  r":([\w\s]+(?:\s\|\s[\w\s]+|\w+))([^\w\s])((?:.|\n)*?)(?=\n:|$)",
@@ -9,7 +9,6 @@ from __future__ import annotations as _
9
9
 
10
10
  import re as _re
11
11
  import sys as _sys
12
- import typing as _t
13
12
  from difflib import SequenceMatcher as _SequenceMatcher
14
13
 
15
14
  from .messages import TEMPLATE as _TEMPLATE
@@ -34,7 +33,7 @@ def almost_equal(str1: str, str2: str, mini: float, maxi: float) -> bool:
34
33
 
35
34
 
36
35
  def pretty_print_error(
37
- exception_type: _t.Type[BaseException],
36
+ exception_type: type[BaseException],
38
37
  msg: str,
39
38
  no_ansi: bool,
40
39
  ) -> None:
@@ -8,4 +8,4 @@ Allows for access to the version internally without cyclic imports
8
8
  caused by accessing it through __init__.
9
9
  """
10
10
 
11
- __version__ = "0.82.0"
11
+ __version__ = "0.82.1"
@@ -24,7 +24,7 @@ NEW = """\
24
24
  """
25
25
 
26
26
 
27
- class Messages(_t.List["Message"]):
27
+ class Messages(list["Message"]):
28
28
  """Sequence of Message instances, typically for one failure."""
29
29
 
30
30
 
@@ -41,7 +41,7 @@ class Message(_t.NamedTuple):
41
41
  symbolic: str = ""
42
42
 
43
43
  #: A hint, if any, suggesting why the error may have occurred.
44
- hint: _t.Optional[str] = None
44
+ hint: str | None = None
45
45
 
46
46
  #: Whether this message is a new addition.
47
47
  new: bool = False
@@ -67,7 +67,7 @@ class Message(_t.NamedTuple):
67
67
  )
68
68
 
69
69
 
70
- class MessageMap(_t.Dict[int, Message]):
70
+ class MessageMap(dict[int, Message]):
71
71
  """Mapping from integer key to Message (used for the E registry)."""
72
72
 
73
73
  def from_ref(self, ref: str) -> Message:
@@ -22,7 +22,7 @@ from ._core import handle_deprecations, runner, setup_logger
22
22
  from ._version import __version__
23
23
  from .messages import FLAKE8, E
24
24
 
25
- Flake8Error = t.Tuple[int, int, str, t.Type[t.Any]]
25
+ Flake8Error = tuple[int, int, str, type[t.Any]]
26
26
  sys.path.append(os.path.abspath(os.getcwd()))
27
27
 
28
28
 
@@ -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.82.0"
14
+ current_version = "0.82.1"
15
15
  message = "bump: version {current_version} → {new_version}"
16
16
  sign_tags = true
17
17
  tag = true
@@ -122,7 +122,7 @@ maintainers = [
122
122
  name = "docsig"
123
123
  readme = "README.rst"
124
124
  repository = "https://github.com/jshwi/docsig"
125
- version = "0.82.0"
125
+ version = "0.82.1"
126
126
 
127
127
  [tool.poetry.dependencies]
128
128
  Sphinx = ">=7,<9"
@@ -236,3 +236,14 @@ name = "Removed"
236
236
 
237
237
  [tool.towncrier.fragment.security]
238
238
  name = "Security"
239
+
240
+ [tool.vulture]
241
+ exclude = [
242
+ "tests/_templates.py",
243
+ "tests/conftest.py"
244
+ ]
245
+ make_whitelist = true
246
+ paths = [
247
+ "docsig",
248
+ "tests"
249
+ ]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes