docsig 0.45.0__tar.gz → 0.46.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.45.0
3
+ Version: 0.46.0
4
4
  Summary: Check signature params for proper documentation
5
5
  Home-page: https://pypi.org/project/docsig/
6
6
  License: MIT
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
20
  Requires-Dist: Pygments (>=2.13.0,<3.0.0)
21
21
  Requires-Dist: Sphinx (>=7.0.0,<8.0.0)
22
- Requires-Dist: arcon (>=0.3.1)
22
+ Requires-Dist: arcon (>=0.4.0)
23
23
  Requires-Dist: astroid (>=3.0.1,<4.0.0)
24
24
  Requires-Dist: object-colors (>=2.1.0,<3.0.0)
25
25
  Requires-Dist: typing-extensions (>=4.8.0,<5.0.0)
@@ -106,8 +106,8 @@ Commandline
106
106
 
107
107
  .. code-block:: console
108
108
 
109
- usage: docsig [-h] [-v] [-l] [-c | -C] [-D] [-m] [-o] [-p] [-P] [-i] [-a] [-k]
110
- [-n] [-S] [-s STR] [-d LIST] [-t LIST] [-e EXCLUDE]
109
+ usage: docsig [-h] [-V] [-l] [-c | -C] [-D] [-m] [-o] [-p] [-P] [-i] [-a] [-k]
110
+ [-n] [-S] [-v] [-s STR] [-d LIST] [-t LIST] [-e EXCLUDE]
111
111
  [path [path ...]]
112
112
 
113
113
  Check signature params for proper documentation
@@ -117,7 +117,7 @@ Commandline
117
117
 
118
118
  optional arguments:
119
119
  -h, --help show this help message and exit
120
- -v, --version show program's version number and exit
120
+ -V, --version show program's version number and exit
121
121
  -l, --list-checks display a list of all checks and their messages
122
122
  -c, --check-class check class docstrings
123
123
  -C, --check-class-constructor check __init__ methods. Note: mutually
@@ -134,6 +134,7 @@ Commandline
134
134
  -k, --ignore-kwargs ignore kwargs prefixed with two asterisks
135
135
  -n, --no-ansi disable ansi output
136
136
  -S, --summary print a summarised report
137
+ -v, --verbose increase output verbosity
137
138
  -s STR, --string STR string to parse instead of files
138
139
  -d LIST, --disable LIST comma separated list of rules to disable
139
140
  -t LIST, --target LIST comma separated list of rules to target
@@ -231,7 +232,7 @@ It can be added to your .pre-commit-config.yaml as follows:
231
232
 
232
233
  repos:
233
234
  - repo: https://github.com/jshwi/docsig
234
- rev: v0.45.0
235
+ rev: v0.46.0
235
236
  hooks:
236
237
  - id: docsig
237
238
  args:
@@ -77,8 +77,8 @@ Commandline
77
77
 
78
78
  .. code-block:: console
79
79
 
80
- usage: docsig [-h] [-v] [-l] [-c | -C] [-D] [-m] [-o] [-p] [-P] [-i] [-a] [-k]
81
- [-n] [-S] [-s STR] [-d LIST] [-t LIST] [-e EXCLUDE]
80
+ usage: docsig [-h] [-V] [-l] [-c | -C] [-D] [-m] [-o] [-p] [-P] [-i] [-a] [-k]
81
+ [-n] [-S] [-v] [-s STR] [-d LIST] [-t LIST] [-e EXCLUDE]
82
82
  [path [path ...]]
83
83
 
84
84
  Check signature params for proper documentation
@@ -88,7 +88,7 @@ Commandline
88
88
 
89
89
  optional arguments:
90
90
  -h, --help show this help message and exit
91
- -v, --version show program's version number and exit
91
+ -V, --version show program's version number and exit
92
92
  -l, --list-checks display a list of all checks and their messages
93
93
  -c, --check-class check class docstrings
94
94
  -C, --check-class-constructor check __init__ methods. Note: mutually
@@ -105,6 +105,7 @@ Commandline
105
105
  -k, --ignore-kwargs ignore kwargs prefixed with two asterisks
106
106
  -n, --no-ansi disable ansi output
107
107
  -S, --summary print a summarised report
108
+ -v, --verbose increase output verbosity
108
109
  -s STR, --string STR string to parse instead of files
109
110
  -d LIST, --disable LIST comma separated list of rules to disable
110
111
  -t LIST, --target LIST comma separated list of rules to target
@@ -202,7 +203,7 @@ It can be added to your .pre-commit-config.yaml as follows:
202
203
 
203
204
  repos:
204
205
  - repo: https://github.com/jshwi/docsig
205
- rev: v0.45.0
206
+ rev: v0.46.0
206
207
  hooks:
207
208
  - id: docsig
208
209
  args:
@@ -23,6 +23,7 @@ class Parser(_ArgumentParser):
23
23
  prog, max_help_position=45
24
24
  ),
25
25
  description="Check signature params for proper documentation",
26
+ version_short_form="-V",
26
27
  )
27
28
  self._add_arguments()
28
29
  self.args = self.parse_args()
@@ -114,6 +115,12 @@ class Parser(_ArgumentParser):
114
115
  action="store_true",
115
116
  help="print a summarised report",
116
117
  )
118
+ self.add_argument(
119
+ "-v",
120
+ "--verbose",
121
+ action="store_true",
122
+ help="increase output verbosity",
123
+ )
117
124
  self.add_argument(
118
125
  "-s",
119
126
  "--string",
@@ -99,6 +99,7 @@ def docsig( # pylint: disable=too-many-locals,too-many-arguments
99
99
  ignore_kwargs: bool = False,
100
100
  no_ansi: bool = False,
101
101
  summary: bool = False,
102
+ verbose: bool = False,
102
103
  targets: list[_Message] | None = None,
103
104
  disable: list[_Message] | None = None,
104
105
  exclude: str | None = None,
@@ -130,6 +131,7 @@ def docsig( # pylint: disable=too-many-locals,too-many-arguments
130
131
  :param ignore_kwargs: Ignore kwargs prefixed with two asterisks.
131
132
  :param no_ansi: Disable ANSI output.
132
133
  :param summary: Print a summarised report.
134
+ :param verbose: increase output verbosity.
133
135
  :param targets: List of errors to target.
134
136
  :param disable: List of errors to disable.
135
137
  :param exclude: Regular expression of files and dirs to exclude from
@@ -151,6 +153,7 @@ def docsig( # pylint: disable=too-many-locals,too-many-arguments
151
153
  ignore_args=ignore_args,
152
154
  ignore_kwargs=ignore_kwargs,
153
155
  check_class_constructor=check_class_constructor,
156
+ verbose=verbose,
154
157
  )
155
158
  display = _Display(no_ansi)
156
159
  for module in modules:
@@ -39,6 +39,7 @@ def main() -> str | int:
39
39
  ignore_kwargs=parser.args.ignore_kwargs,
40
40
  no_ansi=parser.args.no_ansi,
41
41
  summary=parser.args.summary,
42
+ verbose=parser.args.verbose,
42
43
  targets=parser.args.target,
43
44
  disable=parser.args.disable,
44
45
  exclude=parser.args.exclude,
@@ -16,6 +16,9 @@ from ._directives import Directives as _Directives
16
16
  from ._function import Function as _Function
17
17
  from ._message import Message as _Message
18
18
  from ._utils import isprotected as _isprotected
19
+ from ._utils import vprint as _vprint
20
+
21
+ _FILE_INFO = "{path}: {msg}"
19
22
 
20
23
 
21
24
  class Parent(_t.List[_Function]):
@@ -138,6 +141,7 @@ class Modules(_t.List[_Module]):
138
141
  :param check_class_constructor: Check the class constructor's
139
142
  docstring. Otherwise, expect the constructor's documentation to
140
143
  be on the class level docstring.
144
+ :param verbose: increase output verbosity.
141
145
  """
142
146
 
143
147
  # handle errors here before appending a module
@@ -178,6 +182,13 @@ class Modules(_t.List[_Module]):
178
182
  # their suffix, will continue to fail
179
183
  raise err
180
184
 
185
+ _vprint(
186
+ _FILE_INFO.format(
187
+ path=root or "stdin", msg=str(err).replace("\n", " ")
188
+ ),
189
+ self._verbose,
190
+ )
191
+
181
192
  def __init__( # pylint: disable=too-many-arguments
182
193
  self,
183
194
  *paths: _Path,
@@ -187,6 +198,7 @@ class Modules(_t.List[_Module]):
187
198
  ignore_args: bool = False,
188
199
  ignore_kwargs: bool = False,
189
200
  check_class_constructor: bool = False,
201
+ verbose: bool = False,
190
202
  ) -> None:
191
203
  super().__init__()
192
204
  self._disable = disable
@@ -194,6 +206,7 @@ class Modules(_t.List[_Module]):
194
206
  self._ignore_args = ignore_args
195
207
  self._ignore_kwargs = ignore_kwargs
196
208
  self.check_class_constructor = check_class_constructor
209
+ self._verbose = verbose
197
210
  if string is not None:
198
211
  self._add_module(
199
212
  disable,
@@ -213,6 +226,10 @@ class Modules(_t.List[_Module]):
213
226
  if str(root) != "." and any(
214
227
  _re.match(i, root.name) for i in self._excludes
215
228
  ):
229
+ _vprint(
230
+ _FILE_INFO.format(path=root, msg="in exclude list, skipping"),
231
+ self._verbose,
232
+ )
216
233
  return
217
234
 
218
235
  if root.is_file():
@@ -28,3 +28,13 @@ def almost_equal(str1: str, str2: str, mini: float, maxi: float) -> bool:
28
28
  :return: Boolean result for whether both strings are almost equal.
29
29
  """
30
30
  return mini < _SequenceMatcher(a=str1, b=str2).ratio() < maxi
31
+
32
+
33
+ def vprint(msg: str, verbose: bool = False) -> None:
34
+ """Print messages only if verbose is true.
35
+
36
+ :param msg: Message to print.
37
+ :param verbose: Whether verbose mode is enabled.
38
+ """
39
+ if verbose:
40
+ print(msg)
@@ -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.45.0"
11
+ __version__ = "0.46.0"
@@ -72,12 +72,12 @@ maintainers = [
72
72
  name = "docsig"
73
73
  readme = "README.rst"
74
74
  repository = "https://github.com/jshwi/docsig"
75
- version = "0.45.0"
75
+ version = "0.46.0"
76
76
 
77
77
  [tool.poetry.dependencies]
78
78
  Pygments = "^2.13.0"
79
79
  Sphinx = "^7.0.0"
80
- arcon = ">=0.3.1"
80
+ arcon = ">=0.4.0"
81
81
  astroid = "^3.0.1"
82
82
  object-colors = "^2.1.0"
83
83
  python = "^3.8"
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