docsig 0.49.0__tar.gz → 0.49.2__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.49.0
3
+ Version: 0.49.2
4
4
  Summary: Check signature params for proper documentation
5
5
  Home-page: https://pypi.org/project/docsig/
6
6
  License: MIT
@@ -223,7 +223,7 @@ It can be added to your .pre-commit-config.yaml as follows:
223
223
 
224
224
  repos:
225
225
  - repo: https://github.com/jshwi/docsig
226
- rev: v0.49.0
226
+ rev: v0.49.2
227
227
  hooks:
228
228
  - id: docsig
229
229
  args:
@@ -195,7 +195,7 @@ It can be added to your .pre-commit-config.yaml as follows:
195
195
 
196
196
  repos:
197
197
  - repo: https://github.com/jshwi/docsig
198
- rev: v0.49.0
198
+ rev: v0.49.2
199
199
  hooks:
200
200
  - id: docsig
201
201
  args:
@@ -5,6 +5,7 @@ docsig._display
5
5
 
6
6
  from __future__ import annotations as _
7
7
 
8
+ import sys as _sys
8
9
  import typing as _t
9
10
  from collections import UserString as _UserString
10
11
 
@@ -187,7 +188,7 @@ class Display(_t.Dict[str, _t.List[Failures]]):
187
188
 
188
189
  def __init__(self, no_ansi: bool = False) -> None:
189
190
  super().__init__()
190
- self._ansi = not no_ansi
191
+ self._ansi = not no_ansi and _sys.stdout.isatty()
191
192
 
192
193
  def __getitem__(self, key: str) -> list[Failures]:
193
194
  if key not in super().__iter__():
@@ -9,9 +9,14 @@ from os import environ as _e
9
9
  import click as _click
10
10
 
11
11
 
12
- def pretty_print_error() -> None:
13
- """Print user friendly commandline error if debug not enabled."""
12
+ def pretty_print_error(no_ansi: bool = False) -> None:
13
+ """Print user friendly commandline error if debug not enabled.
14
+
15
+ :param no_ansi: Disable ANSI output.
16
+ """
14
17
  if _e.get("DOCSIG_DEBUG", None) != "1":
15
- _sys.excepthook = lambda x, y, _: print(
16
- f"{_click.style(x.__name__, fg='red', bold=True)}: {y}"
18
+ _sys.excepthook = lambda x, y, _: _click.echo(
19
+ f"{_click.style(x.__name__, fg='red', bold=True)}: {y}",
20
+ file=_sys.stderr,
21
+ color=not no_ansi and _sys.stderr.isatty(),
17
22
  )
@@ -20,7 +20,7 @@ def main() -> str | int:
20
20
  :return: Exit status for whether test failed or not.
21
21
  """
22
22
  p = _Parser()
23
- _pretty_print_error()
23
+ _pretty_print_error(p.args.no_ansi)
24
24
  return _docsig(
25
25
  *p.args.path,
26
26
  string=p.args.string,
@@ -81,7 +81,7 @@ class Report(_t.List[str]):
81
81
  message = message.format(**kwargs)
82
82
 
83
83
  if hint:
84
- message += f"\nhint: {value.hint}"
84
+ message += f"\n hint: {value.hint}"
85
85
 
86
86
  if value not in self._disable and message not in self:
87
87
  super().append(message)
@@ -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.49.0"
11
+ __version__ = "0.49.2"
@@ -73,7 +73,7 @@ maintainers = [
73
73
  name = "docsig"
74
74
  readme = "README.rst"
75
75
  repository = "https://github.com/jshwi/docsig"
76
- version = "0.49.0"
76
+ version = "0.49.2"
77
77
 
78
78
  [tool.poetry.dependencies]
79
79
  Pygments = "^2.13.0"
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