docsig 0.59.3__tar.gz → 0.60.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.1
2
2
  Name: docsig
3
- Version: 0.59.3
3
+ Version: 0.60.1
4
4
  Summary: Check signature params for proper documentation
5
5
  Home-page: https://pypi.org/project/docsig/
6
6
  License: MIT
@@ -20,6 +20,7 @@ Requires-Dist: Sphinx (>=7.0.0,<8.0.0)
20
20
  Requires-Dist: arcon (>=0.4.0)
21
21
  Requires-Dist: astroid (>=3.0.1,<4.0.0)
22
22
  Requires-Dist: pathspec (>=0.12.1,<0.13.0)
23
+ Requires-Dist: wcmatch (>=8.5.2,<10.0.0)
23
24
  Project-URL: Documentation, https://docsig.readthedocs.io/en/latest
24
25
  Project-URL: Repository, https://github.com/jshwi/docsig
25
26
  Description-Content-Type: text/x-rst
@@ -106,40 +107,42 @@ Commandline
106
107
  .. code-block:: console
107
108
 
108
109
  usage: docsig [-h] [-V] [-l] [-c | -C] [-D] [-m] [-N] [-o] [-p] [-P] [-i] [-a] [-k] [-T]
109
- [-I] [-n] [-v] [-s STR] [-d LIST] [-t LIST] [-e PATTERN]
110
+ [-I] [-n] [-v] [-s STR] [-d LIST] [-t LIST] [-e PATTERN] [-E PATH [PATH ...]]
110
111
  [path [path ...]]
111
112
 
112
113
  Check signature params for proper documentation
113
114
 
114
115
  positional arguments:
115
- path directories or files to check
116
+ path directories or files to check
116
117
 
117
118
  optional arguments:
118
- -h, --help show this help message and exit
119
- -V, --version show program's version number and exit
120
- -l, --list-checks display a list of all checks and their messages
121
- -c, --check-class check class docstrings
122
- -C, --check-class-constructor check __init__ methods. Note: mutually incompatible
123
- with -c
124
- -D, --check-dunders check dunder methods
125
- -m, --check-protected-class-methods check public methods belonging to protected classes
126
- -N, --check-nested check nested functions and classes
127
- -o, --check-overridden check overridden methods
128
- -p, --check-protected check protected functions and classes
129
- -P, --check-property-returns check property return values
130
- -i, --ignore-no-params ignore docstrings where parameters are not
131
- documented
132
- -a, --ignore-args ignore args prefixed with an asterisk
133
- -k, --ignore-kwargs ignore kwargs prefixed with two asterisks
134
- -T, --ignore-typechecker ignore checking return values
135
- -I, --include-ignored check files even if they match a gitignore pattern
136
- -n, --no-ansi disable ansi output
137
- -v, --verbose increase output verbosity
138
- -s STR, --string STR string to parse instead of files
139
- -d LIST, --disable LIST comma separated list of rules to disable
140
- -t LIST, --target LIST comma separated list of rules to target
141
- -e PATTERN, --exclude PATTERN regular expression of files or dirs to exclude from
142
- checks
119
+ -h, --help show this help message and exit
120
+ -V, --version show program's version number and exit
121
+ -l, --list-checks display a list of all checks and their messages
122
+ -c, --check-class check class docstrings
123
+ -C, --check-class-constructor check __init__ methods. Note: mutually incompatible
124
+ with -c
125
+ -D, --check-dunders check dunder methods
126
+ -m, --check-protected-class-methods check public methods belonging to protected classes
127
+ -N, --check-nested check nested functions and classes
128
+ -o, --check-overridden check overridden methods
129
+ -p, --check-protected check protected functions and classes
130
+ -P, --check-property-returns check property return values
131
+ -i, --ignore-no-params ignore docstrings where parameters are not
132
+ documented
133
+ -a, --ignore-args ignore args prefixed with an asterisk
134
+ -k, --ignore-kwargs ignore kwargs prefixed with two asterisks
135
+ -T, --ignore-typechecker ignore checking return values
136
+ -I, --include-ignored check files even if they match a gitignore pattern
137
+ -n, --no-ansi disable ansi output
138
+ -v, --verbose increase output verbosity
139
+ -s STR, --string STR string to parse instead of files
140
+ -d LIST, --disable LIST comma separated list of rules to disable
141
+ -t LIST, --target LIST comma separated list of rules to target
142
+ -e PATTERN, --exclude PATTERN regular expression of files or dirs to exclude from
143
+ checks
144
+ -E PATH [PATH ...], --excludes PATH [PATH ...]
145
+ path glob patterns to exclude from checks
143
146
 
144
147
  Options can also be configured with the pyproject.toml file
145
148
 
@@ -169,7 +172,7 @@ ensure your installation has registered `docsig`
169
172
  .. code-block:: console
170
173
 
171
174
  $ flake8 --version
172
- 7.1.0 (docsig: 0.59.3, mccabe: 0.7.0, pycodestyle: 2.12.0, pyflakes: 3.2.0) CPython 3.8.13 on Darwin
175
+ 7.1.0 (docsig: 0.60.1, mccabe: 0.7.0, pycodestyle: 2.12.0, pyflakes: 3.2.0) CPython 3.8.13 on Darwin
173
176
 
174
177
  And now use `flake8` to lint your files
175
178
 
@@ -258,7 +261,7 @@ Standalone
258
261
 
259
262
  repos:
260
263
  - repo: https://github.com/jshwi/docsig
261
- rev: v0.59.3
264
+ rev: v0.60.1
262
265
  hooks:
263
266
  - id: docsig
264
267
  args:
@@ -277,7 +280,7 @@ or integrated with ``flake8``
277
280
  hooks:
278
281
  - id: flake8
279
282
  additional_dependencies:
280
- - docsig==0.59.3
283
+ - docsig==0.60.1
281
284
  args:
282
285
  - "--sig-check-class"
283
286
  - "--sig-check-dunders"
@@ -80,40 +80,42 @@ Commandline
80
80
  .. code-block:: console
81
81
 
82
82
  usage: docsig [-h] [-V] [-l] [-c | -C] [-D] [-m] [-N] [-o] [-p] [-P] [-i] [-a] [-k] [-T]
83
- [-I] [-n] [-v] [-s STR] [-d LIST] [-t LIST] [-e PATTERN]
83
+ [-I] [-n] [-v] [-s STR] [-d LIST] [-t LIST] [-e PATTERN] [-E PATH [PATH ...]]
84
84
  [path [path ...]]
85
85
 
86
86
  Check signature params for proper documentation
87
87
 
88
88
  positional arguments:
89
- path directories or files to check
89
+ path directories or files to check
90
90
 
91
91
  optional arguments:
92
- -h, --help show this help message and exit
93
- -V, --version show program's version number and exit
94
- -l, --list-checks display a list of all checks and their messages
95
- -c, --check-class check class docstrings
96
- -C, --check-class-constructor check __init__ methods. Note: mutually incompatible
97
- with -c
98
- -D, --check-dunders check dunder methods
99
- -m, --check-protected-class-methods check public methods belonging to protected classes
100
- -N, --check-nested check nested functions and classes
101
- -o, --check-overridden check overridden methods
102
- -p, --check-protected check protected functions and classes
103
- -P, --check-property-returns check property return values
104
- -i, --ignore-no-params ignore docstrings where parameters are not
105
- documented
106
- -a, --ignore-args ignore args prefixed with an asterisk
107
- -k, --ignore-kwargs ignore kwargs prefixed with two asterisks
108
- -T, --ignore-typechecker ignore checking return values
109
- -I, --include-ignored check files even if they match a gitignore pattern
110
- -n, --no-ansi disable ansi output
111
- -v, --verbose increase output verbosity
112
- -s STR, --string STR string to parse instead of files
113
- -d LIST, --disable LIST comma separated list of rules to disable
114
- -t LIST, --target LIST comma separated list of rules to target
115
- -e PATTERN, --exclude PATTERN regular expression of files or dirs to exclude from
116
- checks
92
+ -h, --help show this help message and exit
93
+ -V, --version show program's version number and exit
94
+ -l, --list-checks display a list of all checks and their messages
95
+ -c, --check-class check class docstrings
96
+ -C, --check-class-constructor check __init__ methods. Note: mutually incompatible
97
+ with -c
98
+ -D, --check-dunders check dunder methods
99
+ -m, --check-protected-class-methods check public methods belonging to protected classes
100
+ -N, --check-nested check nested functions and classes
101
+ -o, --check-overridden check overridden methods
102
+ -p, --check-protected check protected functions and classes
103
+ -P, --check-property-returns check property return values
104
+ -i, --ignore-no-params ignore docstrings where parameters are not
105
+ documented
106
+ -a, --ignore-args ignore args prefixed with an asterisk
107
+ -k, --ignore-kwargs ignore kwargs prefixed with two asterisks
108
+ -T, --ignore-typechecker ignore checking return values
109
+ -I, --include-ignored check files even if they match a gitignore pattern
110
+ -n, --no-ansi disable ansi output
111
+ -v, --verbose increase output verbosity
112
+ -s STR, --string STR string to parse instead of files
113
+ -d LIST, --disable LIST comma separated list of rules to disable
114
+ -t LIST, --target LIST comma separated list of rules to target
115
+ -e PATTERN, --exclude PATTERN regular expression of files or dirs to exclude from
116
+ checks
117
+ -E PATH [PATH ...], --excludes PATH [PATH ...]
118
+ path glob patterns to exclude from checks
117
119
 
118
120
  Options can also be configured with the pyproject.toml file
119
121
 
@@ -143,7 +145,7 @@ ensure your installation has registered `docsig`
143
145
  .. code-block:: console
144
146
 
145
147
  $ flake8 --version
146
- 7.1.0 (docsig: 0.59.3, mccabe: 0.7.0, pycodestyle: 2.12.0, pyflakes: 3.2.0) CPython 3.8.13 on Darwin
148
+ 7.1.0 (docsig: 0.60.1, mccabe: 0.7.0, pycodestyle: 2.12.0, pyflakes: 3.2.0) CPython 3.8.13 on Darwin
147
149
 
148
150
  And now use `flake8` to lint your files
149
151
 
@@ -232,7 +234,7 @@ Standalone
232
234
 
233
235
  repos:
234
236
  - repo: https://github.com/jshwi/docsig
235
- rev: v0.59.3
237
+ rev: v0.60.1
236
238
  hooks:
237
239
  - id: docsig
238
240
  args:
@@ -251,7 +253,7 @@ or integrated with ``flake8``
251
253
  hooks:
252
254
  - id: flake8
253
255
  additional_dependencies:
254
- - docsig==0.59.3
256
+ - docsig==0.60.1
255
257
  args:
256
258
  - "--sig-check-class"
257
259
  - "--sig-check-dunders"
@@ -19,7 +19,7 @@ class Parser(_ArgumentParser):
19
19
  super().__init__(
20
20
  version=__version__,
21
21
  formatter_class=lambda prog: _HelpFormatter(
22
- prog, max_help_position=45
22
+ prog, max_help_position=40
23
23
  ),
24
24
  description="Check signature params for proper documentation",
25
25
  version_short_form="-V",
@@ -157,6 +157,13 @@ class Parser(_ArgumentParser):
157
157
  metavar="PATTERN",
158
158
  help="regular expression of files or dirs to exclude from checks",
159
159
  )
160
+ self.add_argument(
161
+ "-E",
162
+ "--excludes",
163
+ nargs="+",
164
+ metavar="PATH",
165
+ help="path glob patterns to exclude from checks",
166
+ )
160
167
 
161
168
  # deprecated
162
169
  self.add_argument(
@@ -331,6 +331,7 @@ def docsig( # pylint: disable=too-many-locals,too-many-arguments
331
331
  target: _Messages | None = None,
332
332
  disable: _Messages | None = None,
333
333
  exclude: str | None = None,
334
+ excludes: list[str] | None = None,
334
335
  ) -> int:
335
336
  """Package's core functionality.
336
337
 
@@ -367,20 +368,22 @@ def docsig( # pylint: disable=too-many-locals,too-many-arguments
367
368
  :param disable: List of errors to disable.
368
369
  :param exclude: Regular expression of files and dirs to exclude from
369
370
  checks.
371
+ :param excludes: Files or dirs to exclude from checks.
370
372
  :return: Exit status for whether test failed or not.
371
373
  """
372
374
  if list_checks:
373
375
  return int(bool(_print_checks())) # type: ignore
374
376
 
375
- excludes = [_DEFAULT_EXCLUDES]
377
+ patterns = [_DEFAULT_EXCLUDES]
376
378
  if exclude is not None:
377
- excludes.append(exclude)
379
+ patterns.append(exclude)
378
380
 
379
381
  if string is None:
380
382
  retcode = 0
381
383
  paths = _Paths(
382
384
  *tuple(_Path(i) for i in path),
383
- excludes=excludes,
385
+ patterns=patterns,
386
+ excludes=excludes or [],
384
387
  include_ignored=include_ignored,
385
388
  verbose=verbose,
386
389
  )
@@ -12,6 +12,7 @@ from pathlib import Path as _Path
12
12
 
13
13
  from pathspec import PathSpec as _PathSpec
14
14
  from pathspec.patterns import GitWildMatchPattern as _GitWildMatchPattern
15
+ from wcmatch.pathlib import Path as _WcPath
15
16
 
16
17
  from ._utils import vprint as _vprint
17
18
 
@@ -62,12 +63,18 @@ class _Gitignore(_PathSpec):
62
63
  super().__init__(map(_GitWildMatchPattern, patterns))
63
64
 
64
65
 
66
+ def _glob(path: _Path, pattern: str) -> bool:
67
+ # pylint: disable=no-member
68
+ return _WcPath(str(path)).globmatch(pattern) # type: ignore
69
+
70
+
65
71
  class Paths(_t.List[_Path]): # pylint: disable=too-many-instance-attributes
66
72
  """Collect a list of valid paths.
67
73
 
68
74
  :param paths: Path(s) to parse ``Module``(s) from.
69
- :param excludes: List pf regular expression of files and dirs to
75
+ :param patterns: List pf regular expression of files and dirs to
70
76
  exclude from checks.
77
+ :param excludes: Files or dirs to exclude from checks.
71
78
  :param include_ignored: Check files even if they match a gitignore
72
79
  pattern.
73
80
  :param verbose: increase output verbosity.
@@ -76,11 +83,13 @@ class Paths(_t.List[_Path]): # pylint: disable=too-many-instance-attributes
76
83
  def __init__( # pylint: disable=too-many-arguments
77
84
  self,
78
85
  *paths: _Path,
86
+ patterns: list[str],
79
87
  excludes: list[str],
80
88
  include_ignored: bool = False,
81
89
  verbose: bool = False,
82
90
  ) -> None:
83
91
  super().__init__()
92
+ self._patterns = patterns
84
93
  self._excludes = excludes
85
94
  self._include_ignored = include_ignored
86
95
  self._verbose = verbose
@@ -89,8 +98,9 @@ class Paths(_t.List[_Path]): # pylint: disable=too-many-instance-attributes
89
98
  self._populate(path)
90
99
 
91
100
  for path in list(self):
92
- if str(path) != "." and any(
93
- _re.match(i, str(path)) for i in self._excludes
101
+ if str(path) != "." and (
102
+ any(_re.match(i, str(path)) for i in self._patterns)
103
+ or any(_glob(path, i) for i in self._excludes)
94
104
  ):
95
105
  _vprint(
96
106
  FILE_INFO.format(
@@ -44,4 +44,5 @@ def main() -> str | int:
44
44
  target=p.args.target,
45
45
  disable=p.args.disable,
46
46
  exclude=p.args.exclude,
47
+ excludes=p.args.excludes,
47
48
  )
@@ -298,11 +298,14 @@ class Docstring(_Stub):
298
298
  def _indent_anomaly(string: str) -> bool:
299
299
  leading_spaces = []
300
300
  for line in string.splitlines():
301
- match = _re.match(r"^\s*", line)
302
- if match is not None:
303
- spaces = len(match.group())
304
- if spaces > 0:
305
- leading_spaces.append(spaces)
301
+ # only check params
302
+ # description or anything else is out of scope
303
+ if line.lstrip().startswith(":"):
304
+ match = _re.match(r"^\s*", line)
305
+ if match is not None:
306
+ spaces = len(match.group())
307
+ if spaces > 0:
308
+ leading_spaces.append(spaces)
306
309
 
307
310
  # look for spaces in odd intervals
308
311
  return bool(any(i % 2 != 0 for i in leading_spaces))
@@ -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.59.3"
11
+ __version__ = "0.60.1"
@@ -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.3"
14
+ current_version = "0.60.1"
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.3"
135
+ version = "0.60.1"
136
136
 
137
137
  [tool.poetry.dependencies]
138
138
  Sphinx = "^7.0.0"
@@ -140,11 +140,12 @@ arcon = ">=0.4.0"
140
140
  astroid = "^3.0.1"
141
141
  pathspec = "^0.12.1"
142
142
  python = "^3.8.1"
143
+ wcmatch = ">=8.5.2,<10.0.0"
143
144
 
144
145
  [tool.poetry.group.dev.dependencies]
145
146
  black = "^24.4.2"
146
147
  bump-my-version = "^0.24.1"
147
- deptry = ">=0.16.1,<0.18.0"
148
+ deptry = ">=0.16.1,<0.21.0"
148
149
  docformatter = "^1.7.5"
149
150
  flynt = "^1.0.1"
150
151
  gitpython = "^3.1.43"
@@ -160,7 +161,6 @@ vulture = "^2.11"
160
161
 
161
162
  [tool.poetry.group.docs.dependencies]
162
163
  furo = "^2024.4.27"
163
- incremental = "22.10.0"
164
164
  myst-parser = "^3.0.1"
165
165
  pytest = "^8.2.0"
166
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