docsig 0.60.0__tar.gz → 0.61.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: docsig
3
- Version: 0.60.0
3
+ Version: 0.61.0
4
4
  Summary: Check signature params for proper documentation
5
5
  Home-page: https://pypi.org/project/docsig/
6
6
  License: MIT
@@ -17,10 +17,10 @@ Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
19
  Requires-Dist: Sphinx (>=7.0.0,<8.0.0)
20
- Requires-Dist: arcon (>=0.4.0)
21
20
  Requires-Dist: astroid (>=3.0.1,<4.0.0)
22
21
  Requires-Dist: pathspec (>=0.12.1,<0.13.0)
23
- Requires-Dist: wcmatch (>=8.5.2,<9.0.0)
22
+ Requires-Dist: tomli (>=2.0.1,<3.0.0)
23
+ Requires-Dist: wcmatch (>=8.5.2,<10.0.0)
24
24
  Project-URL: Documentation, https://docsig.readthedocs.io/en/latest
25
25
  Project-URL: Repository, https://github.com/jshwi/docsig
26
26
  Description-Content-Type: text/x-rst
@@ -113,36 +113,44 @@ Commandline
113
113
  Check signature params for proper documentation
114
114
 
115
115
  positional arguments:
116
- path directories or files to check
116
+ path directories or files to check
117
117
 
118
118
  optional arguments:
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
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
124
+ check __init__ methods. Note: mutually incompatible with -c
125
+ -D, --check-dunders check dunder methods
126
+ -m, --check-protected-class-methods
127
+ check public methods belonging to protected classes
128
+ -N, --check-nested check nested functions and classes
129
+ -o, --check-overridden
130
+ check overridden methods
131
+ -p, --check-protected
132
+ check protected functions and classes
133
+ -P, --check-property-returns
134
+ check property return values
135
+ -i, --ignore-no-params
136
+ ignore docstrings where parameters are not documented
137
+ -a, --ignore-args ignore args prefixed with an asterisk
138
+ -k, --ignore-kwargs ignore kwargs prefixed with two asterisks
139
+ -T, --ignore-typechecker
140
+ ignore checking return values
141
+ -I, --include-ignored
142
+ check files even if they match a gitignore pattern
143
+ -n, --no-ansi disable ansi output
144
+ -v, --verbose increase output verbosity
145
+ -s STR, --string STR string to parse instead of files
146
+ -d LIST, --disable LIST
147
+ comma separated list of rules to disable
148
+ -t LIST, --target LIST
149
+ comma separated list of rules to target
150
+ -e PATTERN, --exclude PATTERN
151
+ regular expression of files or dirs to exclude from checks
144
152
  -E PATH [PATH ...], --excludes PATH [PATH ...]
145
- path glob patterns to exclude from checks
153
+ path glob patterns to exclude from checks
146
154
 
147
155
  Options can also be configured with the pyproject.toml file
148
156
 
@@ -172,7 +180,7 @@ ensure your installation has registered `docsig`
172
180
  .. code-block:: console
173
181
 
174
182
  $ flake8 --version
175
- 7.1.0 (docsig: 0.60.0, mccabe: 0.7.0, pycodestyle: 2.12.0, pyflakes: 3.2.0) CPython 3.8.13 on Darwin
183
+ 7.1.0 (docsig: 0.61.0, mccabe: 0.7.0, pycodestyle: 2.12.0, pyflakes: 3.2.0) CPython 3.8.13 on Darwin
176
184
 
177
185
  And now use `flake8` to lint your files
178
186
 
@@ -261,7 +269,7 @@ Standalone
261
269
 
262
270
  repos:
263
271
  - repo: https://github.com/jshwi/docsig
264
- rev: v0.60.0
272
+ rev: v0.61.0
265
273
  hooks:
266
274
  - id: docsig
267
275
  args:
@@ -280,7 +288,7 @@ or integrated with ``flake8``
280
288
  hooks:
281
289
  - id: flake8
282
290
  additional_dependencies:
283
- - docsig==0.60.0
291
+ - docsig==0.61.0
284
292
  args:
285
293
  - "--sig-check-class"
286
294
  - "--sig-check-dunders"
@@ -86,36 +86,44 @@ Commandline
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
97
+ check __init__ methods. Note: mutually incompatible with -c
98
+ -D, --check-dunders check dunder methods
99
+ -m, --check-protected-class-methods
100
+ check public methods belonging to protected classes
101
+ -N, --check-nested check nested functions and classes
102
+ -o, --check-overridden
103
+ check overridden methods
104
+ -p, --check-protected
105
+ check protected functions and classes
106
+ -P, --check-property-returns
107
+ check property return values
108
+ -i, --ignore-no-params
109
+ ignore docstrings where parameters are not documented
110
+ -a, --ignore-args ignore args prefixed with an asterisk
111
+ -k, --ignore-kwargs ignore kwargs prefixed with two asterisks
112
+ -T, --ignore-typechecker
113
+ ignore checking return values
114
+ -I, --include-ignored
115
+ check files even if they match a gitignore pattern
116
+ -n, --no-ansi disable ansi output
117
+ -v, --verbose increase output verbosity
118
+ -s STR, --string STR string to parse instead of files
119
+ -d LIST, --disable LIST
120
+ comma separated list of rules to disable
121
+ -t LIST, --target LIST
122
+ comma separated list of rules to target
123
+ -e PATTERN, --exclude PATTERN
124
+ regular expression of files or dirs to exclude from checks
117
125
  -E PATH [PATH ...], --excludes PATH [PATH ...]
118
- path glob patterns to exclude from checks
126
+ path glob patterns to exclude from checks
119
127
 
120
128
  Options can also be configured with the pyproject.toml file
121
129
 
@@ -145,7 +153,7 @@ ensure your installation has registered `docsig`
145
153
  .. code-block:: console
146
154
 
147
155
  $ flake8 --version
148
- 7.1.0 (docsig: 0.60.0, mccabe: 0.7.0, pycodestyle: 2.12.0, pyflakes: 3.2.0) CPython 3.8.13 on Darwin
156
+ 7.1.0 (docsig: 0.61.0, mccabe: 0.7.0, pycodestyle: 2.12.0, pyflakes: 3.2.0) CPython 3.8.13 on Darwin
149
157
 
150
158
  And now use `flake8` to lint your files
151
159
 
@@ -234,7 +242,7 @@ Standalone
234
242
 
235
243
  repos:
236
244
  - repo: https://github.com/jshwi/docsig
237
- rev: v0.60.0
245
+ rev: v0.61.0
238
246
  hooks:
239
247
  - id: docsig
240
248
  args:
@@ -253,7 +261,7 @@ or integrated with ``flake8``
253
261
  hooks:
254
262
  - id: flake8
255
263
  additional_dependencies:
256
- - docsig==0.60.0
264
+ - docsig==0.61.0
257
265
  args:
258
266
  - "--sig-check-class"
259
267
  - "--sig-check-dunders"
@@ -0,0 +1,266 @@
1
+ """
2
+ docsig._config
3
+ ==============
4
+ """
5
+
6
+ from __future__ import annotations as _
7
+
8
+ import argparse as _a
9
+ import os as _os
10
+ import re as _re
11
+ import typing as _t
12
+ from pathlib import Path as _Path
13
+
14
+ import tomli as _tomli
15
+
16
+ from ._version import __version__
17
+
18
+ PYPROJECT_TOML = "pyproject.toml"
19
+
20
+
21
+ # split str by comma, but allow for escaping
22
+ def _split_comma(value: str) -> list[str]:
23
+ return [i.replace("\\,", ",") for i in _re.split(r"(?<!\\),", value)]
24
+
25
+
26
+ # attempt to locate a pyproject.toml file if one exists in parents
27
+ def _find_pyproject_toml(path: _Path | None = None) -> _Path | None:
28
+ if not path:
29
+ path = _Path.cwd()
30
+
31
+ pyproject_toml = path / PYPROJECT_TOML
32
+ if pyproject_toml.is_file():
33
+ return pyproject_toml
34
+
35
+ if str(path) == _os.path.abspath(_os.sep):
36
+ return None
37
+
38
+ return _find_pyproject_toml(path.parent)
39
+
40
+
41
+ def get_config(prog: str) -> dict[str, _t.Any]:
42
+ """Get config dict object from package's tool section in toml file.
43
+
44
+ :param prog: Program name.
45
+ :return: Config dict.
46
+ """
47
+ pyproject_file = _find_pyproject_toml()
48
+ if pyproject_file is None:
49
+ return {}
50
+
51
+ return {
52
+ k.replace("-", "_"): v
53
+ for k, v in _tomli.loads(pyproject_file.read_text())
54
+ .get("tool", {})
55
+ .get(prog, {})
56
+ .items()
57
+ }
58
+
59
+
60
+ def merge_configs(
61
+ obj1: dict[str, _t.Any], obj2: dict[str, _t.Any]
62
+ ) -> dict[str, _t.Any]:
63
+ """Merge two config dicts.
64
+
65
+ :param obj1: Config dict one.
66
+ :param obj2: Config dict two.
67
+ :return: Config dict.
68
+ """
69
+ for key, n_val in obj1.items():
70
+ c_val = obj2.get(key)
71
+ if isinstance(c_val, list) and isinstance(n_val, list):
72
+ obj1[key].extend(c_val)
73
+ elif c_val:
74
+ obj1[key] = c_val
75
+
76
+ return obj1
77
+
78
+
79
+ class _ArgumentParser(_a.ArgumentParser):
80
+ def parse_known_args( # type: ignore
81
+ self,
82
+ args: _t.Sequence[str] | None = None,
83
+ namespace: _a.Namespace | None = None,
84
+ ) -> tuple[_a.Namespace | None, list[str]]:
85
+ namespace, args = super().parse_known_args(args, namespace)
86
+ config = get_config(self.prog)
87
+ namespace.__dict__ = merge_configs(namespace.__dict__, config)
88
+ return namespace, args
89
+
90
+ def add_list_argument(self, *args: str, **kwargs: _t.Any) -> None:
91
+ """Parse a comma separated list of strings into a list.
92
+
93
+ :param args: Long and/or short form argument(s).
94
+ :param kwargs: Kwargs to pass to ``add_argument``.
95
+ """
96
+ kwargs.update(
97
+ {
98
+ "action": "store",
99
+ "type": _split_comma,
100
+ "default": kwargs.get("default", []),
101
+ }
102
+ )
103
+ self.add_argument(*args, **kwargs)
104
+
105
+
106
+ def parse_args(args: _t.Sequence[str] | None = None) -> _a.Namespace:
107
+ """Parse commandline arguments.
108
+
109
+ :param args: Args for manual parsing.
110
+ :return: Parsed arguments.
111
+ """
112
+ parser = _ArgumentParser(
113
+ description="Check signature params for proper documentation",
114
+ )
115
+ parser.add_argument(
116
+ "-V",
117
+ "--version",
118
+ action="version",
119
+ version=__version__,
120
+ )
121
+ parser.add_argument(
122
+ "path",
123
+ nargs="*",
124
+ action="store",
125
+ type=_Path,
126
+ help="directories or files to check",
127
+ )
128
+ parser.add_argument(
129
+ "-l",
130
+ "--list-checks",
131
+ action="store_true",
132
+ help="display a list of all checks and their messages",
133
+ )
134
+ group = parser.add_mutually_exclusive_group(required=False)
135
+ group.add_argument(
136
+ "-c",
137
+ "--check-class",
138
+ action="store_true",
139
+ help="check class docstrings",
140
+ )
141
+ group.add_argument(
142
+ "-C",
143
+ "--check-class-constructor",
144
+ action="store_true",
145
+ help="check __init__ methods. Note: mutually incompatible with -c",
146
+ )
147
+ parser.add_argument(
148
+ "-D",
149
+ "--check-dunders",
150
+ action="store_true",
151
+ help="check dunder methods",
152
+ )
153
+ parser.add_argument(
154
+ "-m",
155
+ "--check-protected-class-methods",
156
+ action="store_true",
157
+ help="check public methods belonging to protected classes",
158
+ )
159
+ parser.add_argument(
160
+ "-N",
161
+ "--check-nested",
162
+ action="store_true",
163
+ help="check nested functions and classes",
164
+ )
165
+ parser.add_argument(
166
+ "-o",
167
+ "--check-overridden",
168
+ action="store_true",
169
+ help="check overridden methods",
170
+ )
171
+ parser.add_argument(
172
+ "-p",
173
+ "--check-protected",
174
+ action="store_true",
175
+ help="check protected functions and classes",
176
+ )
177
+ parser.add_argument(
178
+ "-P",
179
+ "--check-property-returns",
180
+ action="store_true",
181
+ help="check property return values",
182
+ )
183
+ parser.add_argument(
184
+ "-i",
185
+ "--ignore-no-params",
186
+ action="store_true",
187
+ help="ignore docstrings where parameters are not documented",
188
+ )
189
+ parser.add_argument(
190
+ "-a",
191
+ "--ignore-args",
192
+ action="store_true",
193
+ help="ignore args prefixed with an asterisk",
194
+ )
195
+ parser.add_argument(
196
+ "-k",
197
+ "--ignore-kwargs",
198
+ action="store_true",
199
+ help="ignore kwargs prefixed with two asterisks",
200
+ )
201
+ parser.add_argument(
202
+ "-T",
203
+ "--ignore-typechecker",
204
+ action="store_true",
205
+ help="ignore checking return values",
206
+ )
207
+ parser.add_argument(
208
+ "-I",
209
+ "--include-ignored",
210
+ action="store_true",
211
+ help="check files even if they match a gitignore pattern",
212
+ )
213
+ parser.add_argument(
214
+ "-n",
215
+ "--no-ansi",
216
+ action="store_true",
217
+ help="disable ansi output",
218
+ )
219
+ parser.add_argument(
220
+ "-v",
221
+ "--verbose",
222
+ action="store_true",
223
+ help="increase output verbosity",
224
+ )
225
+ parser.add_argument(
226
+ "-s",
227
+ "--string",
228
+ action="store",
229
+ metavar="STR",
230
+ help="string to parse instead of files",
231
+ )
232
+ parser.add_list_argument(
233
+ "-d",
234
+ "--disable",
235
+ metavar="LIST",
236
+ help="comma separated list of rules to disable",
237
+ )
238
+ parser.add_list_argument(
239
+ "-t",
240
+ "--target",
241
+ metavar="LIST",
242
+ help="comma separated list of rules to target",
243
+ )
244
+ parser.add_argument(
245
+ "-e",
246
+ "--exclude",
247
+ metavar="PATTERN",
248
+ help="regular expression of files or dirs to exclude from checks",
249
+ )
250
+ parser.add_argument(
251
+ "-E",
252
+ "--excludes",
253
+ nargs="+",
254
+ metavar="PATH",
255
+ help="path glob patterns to exclude from checks",
256
+ )
257
+
258
+ # deprecated
259
+ parser.add_argument(
260
+ "-S",
261
+ "--summary",
262
+ action="store_true",
263
+ help=_a.SUPPRESS,
264
+ )
265
+
266
+ return parser.parse_args(args)
@@ -1,6 +1,6 @@
1
1
  """
2
- docsig._disable
3
- ===============
2
+ docsig._directives
3
+ ==================
4
4
  """
5
5
 
6
6
  from __future__ import annotations as _
@@ -0,0 +1,48 @@
1
+ """
2
+ docsig._main
3
+ ============
4
+
5
+ Contains package entry point.
6
+ """
7
+
8
+ from __future__ import annotations as _
9
+
10
+ from ._config import parse_args as _parse_args
11
+ from ._core import docsig as _docsig
12
+ from ._hooks import excepthook as _excepthook
13
+
14
+
15
+ def main() -> str | int:
16
+ """Main function for package.
17
+
18
+ Collect config and arguments for the commandline.
19
+
20
+ :return: Exit status for whether test failed or not.
21
+ """
22
+ a = _parse_args()
23
+ _excepthook(a.no_ansi)
24
+ return _docsig(
25
+ *a.path,
26
+ string=a.string,
27
+ list_checks=a.list_checks,
28
+ check_class=a.check_class,
29
+ check_class_constructor=a.check_class_constructor,
30
+ check_dunders=a.check_dunders,
31
+ check_protected_class_methods=a.check_protected_class_methods,
32
+ check_nested=a.check_nested,
33
+ check_overridden=a.check_overridden,
34
+ check_protected=a.check_protected,
35
+ check_property_returns=a.check_property_returns,
36
+ include_ignored=a.include_ignored,
37
+ ignore_no_params=a.ignore_no_params,
38
+ ignore_args=a.ignore_args,
39
+ ignore_kwargs=a.ignore_kwargs,
40
+ ignore_typechecker=a.ignore_typechecker,
41
+ no_ansi=a.no_ansi,
42
+ summary=a.summary, # deprecated
43
+ verbose=a.verbose,
44
+ target=a.target,
45
+ disable=a.disable,
46
+ exclude=a.exclude,
47
+ excludes=a.excludes,
48
+ )
@@ -1,6 +1,6 @@
1
1
  """
2
- docsig._function
3
- ================
2
+ docsig._stub
3
+ ============
4
4
  """
5
5
 
6
6
  from __future__ import annotations as _
@@ -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.60.0"
11
+ __version__ = "0.61.0"
@@ -1,11 +1,11 @@
1
1
  """Flake8 implementation of docsig."""
2
2
 
3
3
  import ast
4
- import sys
5
4
  import typing as t
6
5
  from argparse import Namespace
7
6
 
8
- from ._config import Parser
7
+ from ._config import get_config as _get_config
8
+ from ._config import merge_configs as _merge_configs
9
9
  from ._core import runner
10
10
  from ._version import __version__
11
11
  from .messages import FLAKE8
@@ -24,7 +24,7 @@ class Docsig:
24
24
  off_by_default = False
25
25
  name = __package__
26
26
  version = __version__
27
- options_dict: t.Dict[str, bool] = {}
27
+ a = Namespace()
28
28
 
29
29
  def __init__(self, tree: ast.Module, filename: str) -> None:
30
30
  _tree = tree # noqa
@@ -36,7 +36,7 @@ class Docsig:
36
36
  # requirement for this package
37
37
  @classmethod
38
38
  def add_options(cls, parser) -> None:
39
- """Add flake8 commandline and config options.sig_
39
+ """Add flake8 commandline and config options.
40
40
 
41
41
  :param parser: Flake8 option manager.
42
42
  """
@@ -112,62 +112,46 @@ class Docsig:
112
112
  parse_from_config=True,
113
113
  help="ignore checking return values",
114
114
  )
115
+ parser.add_option(
116
+ "--sig-verbose",
117
+ action="store_true",
118
+ parse_from_config=True,
119
+ help="increase output verbosity",
120
+ )
115
121
 
116
122
  @classmethod
117
- def parse_options(cls, options: Namespace) -> None:
123
+ def parse_options(cls, a: Namespace) -> None:
118
124
  """Parse flake8 options into am instance accessible dict.
119
125
 
120
- :param options: Argparse namespace.
126
+ :param a: Argparse namespace.
121
127
  """
122
- cls.options_dict = {
123
- "check_class": options.sig_check_class,
124
- "check_class_constructor": options.sig_check_class_constructor,
125
- "check_dunders": options.sig_check_dunders,
126
- "check_protected_class_methods": (
127
- options.sig_check_protected_class_methods
128
- ),
129
- "check_nested": options.sig_check_nested,
130
- "check_overridden": options.sig_check_overridden,
131
- "check_protected": options.sig_check_protected,
132
- "check_property_returns": options.sig_check_property_returns,
133
- "ignore_no_params": options.sig_ignore_no_params,
134
- "ignore_args": options.sig_ignore_args,
135
- "ignore_kwargs": options.sig_ignore_kwargs,
136
- "ignore_typechecker": options.sig_ignore_typechecker,
137
- }
128
+ cls.a.__dict__ = _merge_configs(
129
+ {k.replace("sig_", ""): v for k, v in a.__dict__.items()},
130
+ _get_config(__package__),
131
+ )
138
132
 
139
133
  def run(self) -> t.Generator[Flake8Error, None, None]:
140
134
  """Run docsig and possibly yield a flake8 error.
141
135
 
142
136
  :return: Flake8 error, if there is one.
143
137
  """
144
- sys.argv = [
145
- __package__,
146
- self.filename,
147
- *[
148
- f"--{k.replace('_', '-')}"
149
- for k, v in self.options_dict.items()
150
- if v
151
- ],
152
- ]
153
- p = Parser()
154
138
  results = runner(
155
139
  self.filename,
156
- check_class=p.args.check_class,
157
- check_class_constructor=p.args.check_class_constructor,
158
- check_dunders=p.args.check_dunders,
140
+ check_class=self.a.check_class,
141
+ check_class_constructor=self.a.check_class_constructor,
142
+ check_dunders=self.a.check_dunders,
159
143
  check_protected_class_methods=(
160
- p.args.check_protected_class_methods
144
+ self.a.check_protected_class_methods
161
145
  ),
162
- check_nested=p.args.check_nested,
163
- check_overridden=p.args.check_overridden,
164
- check_protected=p.args.check_protected,
165
- check_property_returns=p.args.check_property_returns,
166
- ignore_no_params=p.args.ignore_no_params,
167
- ignore_args=p.args.ignore_args,
168
- ignore_kwargs=p.args.ignore_kwargs,
169
- ignore_typechecker=p.args.ignore_typechecker,
170
- no_ansi=p.args.no_ansi,
146
+ check_nested=self.a.check_nested,
147
+ check_overridden=self.a.check_overridden,
148
+ check_protected=self.a.check_protected,
149
+ check_property_returns=self.a.check_property_returns,
150
+ ignore_no_params=self.a.ignore_no_params,
151
+ ignore_args=self.a.ignore_args,
152
+ ignore_kwargs=self.a.ignore_kwargs,
153
+ ignore_typechecker=self.a.ignore_typechecker,
154
+ verbose=self.a.verbose,
171
155
  )[0]
172
156
  for result in results:
173
157
  for info in result:
@@ -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.60.0"
14
+ current_version = "0.61.0"
15
15
  message = "bump: version {current_version} → {new_version}"
16
16
  sign_tags = true
17
17
  tag = true
@@ -77,7 +77,6 @@ DEP004 = [
77
77
  "flake8",
78
78
  "git",
79
79
  "pytest",
80
- "tomli",
81
80
  "tomli_w",
82
81
  "yaml"
83
82
  ]
@@ -132,20 +131,20 @@ maintainers = [
132
131
  name = "docsig"
133
132
  readme = "README.rst"
134
133
  repository = "https://github.com/jshwi/docsig"
135
- version = "0.60.0"
134
+ version = "0.61.0"
136
135
 
137
136
  [tool.poetry.dependencies]
138
137
  Sphinx = "^7.0.0"
139
- arcon = ">=0.4.0"
140
138
  astroid = "^3.0.1"
141
139
  pathspec = "^0.12.1"
142
140
  python = "^3.8.1"
143
- wcmatch = "^8.5.2"
141
+ tomli = "^2.0.1"
142
+ wcmatch = ">=8.5.2,<10.0.0"
144
143
 
145
144
  [tool.poetry.group.dev.dependencies]
146
145
  black = "^24.4.2"
147
- bump-my-version = "^0.24.1"
148
- deptry = ">=0.16.1,<0.18.0"
146
+ bump-my-version = ">=0.24.1,<0.27.0"
147
+ deptry = ">=0.16.1,<0.21.0"
149
148
  docformatter = "^1.7.5"
150
149
  flynt = "^1.0.1"
151
150
  gitpython = "^3.1.43"
@@ -1,174 +0,0 @@
1
- """
2
- docsig._config
3
- ==============
4
- """
5
-
6
- from argparse import SUPPRESS as _SUPPRESS
7
- from argparse import HelpFormatter as _HelpFormatter
8
- from pathlib import Path as _Path
9
-
10
- from arcon import ArgumentParser as _ArgumentParser
11
-
12
- from ._version import __version__
13
-
14
-
15
- class Parser(_ArgumentParser):
16
- """Parse commandline arguments."""
17
-
18
- def __init__(self) -> None:
19
- super().__init__(
20
- version=__version__,
21
- formatter_class=lambda prog: _HelpFormatter(
22
- prog, max_help_position=40
23
- ),
24
- description="Check signature params for proper documentation",
25
- version_short_form="-V",
26
- )
27
- self._add_arguments()
28
- self.args = self.parse_args()
29
-
30
- def _add_arguments(self) -> None:
31
- self.add_argument(
32
- "path",
33
- nargs="*",
34
- action="store",
35
- type=_Path,
36
- help="directories or files to check",
37
- )
38
- self.add_argument(
39
- "-l",
40
- "--list-checks",
41
- action="store_true",
42
- help="display a list of all checks and their messages",
43
- )
44
- group = self.add_mutually_exclusive_group(required=False)
45
- group.add_argument(
46
- "-c",
47
- "--check-class",
48
- action="store_true",
49
- help="check class docstrings",
50
- )
51
- group.add_argument(
52
- "-C",
53
- "--check-class-constructor",
54
- action="store_true",
55
- help="check __init__ methods. Note: mutually incompatible with -c",
56
- )
57
- self.add_argument(
58
- "-D",
59
- "--check-dunders",
60
- action="store_true",
61
- help="check dunder methods",
62
- )
63
- self.add_argument(
64
- "-m",
65
- "--check-protected-class-methods",
66
- action="store_true",
67
- help="check public methods belonging to protected classes",
68
- )
69
- self.add_argument(
70
- "-N",
71
- "--check-nested",
72
- action="store_true",
73
- help="check nested functions and classes",
74
- )
75
- self.add_argument(
76
- "-o",
77
- "--check-overridden",
78
- action="store_true",
79
- help="check overridden methods",
80
- )
81
- self.add_argument(
82
- "-p",
83
- "--check-protected",
84
- action="store_true",
85
- help="check protected functions and classes",
86
- )
87
- self.add_argument(
88
- "-P",
89
- "--check-property-returns",
90
- action="store_true",
91
- help="check property return values",
92
- )
93
- self.add_argument(
94
- "-i",
95
- "--ignore-no-params",
96
- action="store_true",
97
- help="ignore docstrings where parameters are not documented",
98
- )
99
- self.add_argument(
100
- "-a",
101
- "--ignore-args",
102
- action="store_true",
103
- help="ignore args prefixed with an asterisk",
104
- )
105
- self.add_argument(
106
- "-k",
107
- "--ignore-kwargs",
108
- action="store_true",
109
- help="ignore kwargs prefixed with two asterisks",
110
- )
111
- self.add_argument(
112
- "-T",
113
- "--ignore-typechecker",
114
- action="store_true",
115
- help="ignore checking return values",
116
- )
117
- self.add_argument(
118
- "-I",
119
- "--include-ignored",
120
- action="store_true",
121
- help="check files even if they match a gitignore pattern",
122
- )
123
- self.add_argument(
124
- "-n",
125
- "--no-ansi",
126
- action="store_true",
127
- help="disable ansi output",
128
- )
129
- self.add_argument(
130
- "-v",
131
- "--verbose",
132
- action="store_true",
133
- help="increase output verbosity",
134
- )
135
- self.add_argument(
136
- "-s",
137
- "--string",
138
- action="store",
139
- metavar="STR",
140
- help="string to parse instead of files",
141
- )
142
- self.add_list_argument(
143
- "-d",
144
- "--disable",
145
- metavar="LIST",
146
- help="comma separated list of rules to disable",
147
- )
148
- self.add_list_argument(
149
- "-t",
150
- "--target",
151
- metavar="LIST",
152
- help="comma separated list of rules to target",
153
- )
154
- self.add_argument(
155
- "-e",
156
- "--exclude",
157
- metavar="PATTERN",
158
- help="regular expression of files or dirs to exclude from checks",
159
- )
160
- self.add_argument(
161
- "-E",
162
- "--excludes",
163
- nargs="+",
164
- metavar="PATH",
165
- help="path glob patterns to exclude from checks",
166
- )
167
-
168
- # deprecated
169
- self.add_argument(
170
- "-S",
171
- "--summary",
172
- action="store_true",
173
- help=_SUPPRESS,
174
- )
@@ -1,48 +0,0 @@
1
- """
2
- docsig._main
3
- ============
4
-
5
- Contains package entry point.
6
- """
7
-
8
- from __future__ import annotations as _
9
-
10
- from ._config import Parser as _Parser
11
- from ._core import docsig as _docsig
12
- from ._hooks import excepthook as _excepthook
13
-
14
-
15
- def main() -> str | int:
16
- """Main function for package.
17
-
18
- Collect config and arguments for the commandline.
19
-
20
- :return: Exit status for whether test failed or not.
21
- """
22
- p = _Parser()
23
- _excepthook(p.args.no_ansi)
24
- return _docsig(
25
- *p.args.path,
26
- string=p.args.string,
27
- list_checks=p.args.list_checks,
28
- check_class=p.args.check_class,
29
- check_class_constructor=p.args.check_class_constructor,
30
- check_dunders=p.args.check_dunders,
31
- check_protected_class_methods=p.args.check_protected_class_methods,
32
- check_nested=p.args.check_nested,
33
- check_overridden=p.args.check_overridden,
34
- check_protected=p.args.check_protected,
35
- check_property_returns=p.args.check_property_returns,
36
- include_ignored=p.args.include_ignored,
37
- ignore_no_params=p.args.ignore_no_params,
38
- ignore_args=p.args.ignore_args,
39
- ignore_kwargs=p.args.ignore_kwargs,
40
- ignore_typechecker=p.args.ignore_typechecker,
41
- no_ansi=p.args.no_ansi,
42
- summary=p.args.summary, # deprecated
43
- verbose=p.args.verbose,
44
- target=p.args.target,
45
- disable=p.args.disable,
46
- exclude=p.args.exclude,
47
- excludes=p.args.excludes,
48
- )
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