Skip to content

Commit 92ac6b8

Browse files
committed
Linting.
1 parent a14f392 commit 92ac6b8

18 files changed

+406
-344
lines changed

domdf_python_tools/bases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def __eq__(self, other) -> bool:
107107

108108

109109
_T = TypeVar("_T")
110-
_S = TypeVar('_S', bound="UserList")
110+
_S = TypeVar("_S", bound="UserList")
111111

112112

113113
@prettify_docstrings

domdf_python_tools/delegators.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#
44
# delegators.py
55
"""
6-
Decorators for functions that delegate parts of their functionality
7-
to other functions.
6+
Decorators for functions that delegate parts of their functionality to other functions.
87
98
.. versionadded:: 0.10.0
109
"""
@@ -59,7 +58,7 @@ def delegate_kwargs(to: Callable, *except_):
5958
:param \*except\_: Parameter names not to delegate.
6059
6160
:raises ValueError: if a non-default argument follows a default argument.
62-
"""
61+
""" # noqa: D400
6362

6463
# TODO: return annotation
6564

@@ -97,7 +96,7 @@ def delegates(to: Callable) -> Callable[[_C], _C]:
9796
with the signature of the delegated function.
9897
9998
:param to: The function the arguments are passed on to.
100-
"""
99+
""" # noqa: D400
101100

102101
def copy_annotations(f):
103102
if hasattr(to, "__annotations__"):

domdf_python_tools/import_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def discover(
107107
package.__path__, # type: ignore
108108
prefix=package.__name__ + '.',
109109
):
110-
module = __import__(module_name, fromlist=['__trash'], level=0)
110+
module = __import__(module_name, fromlist=["__trash"], level=0)
111111

112112
# Check all the functions in that module
113113
for _, imported_objects in inspect.getmembers(module, match_func):

domdf_python_tools/pagesizes/units.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ class Unitpt(Unit):
302302

303303
class UnitInch(Unit):
304304
"""
305-
Inch
305+
Inch.
306306
"""
307307

308308
name = "inch"
@@ -311,7 +311,7 @@ class UnitInch(Unit):
311311

312312
class Unitcm(Unit):
313313
"""
314-
Centimetres
314+
Centimetres.
315315
"""
316316

317317
name = "cm"
@@ -320,7 +320,7 @@ class Unitcm(Unit):
320320

321321
class Unitmm(Unit):
322322
"""
323-
Millimetres
323+
Millimetres.
324324
"""
325325

326326
name = "mm"
@@ -329,7 +329,7 @@ class Unitmm(Unit):
329329

330330
class Unitum(Unit):
331331
"""
332-
Micrometres
332+
Micrometres.
333333
"""
334334

335335
name = "µm"
@@ -338,7 +338,7 @@ class Unitum(Unit):
338338

339339
class Unitpc(Unit):
340340
"""
341-
Pica
341+
Pica.
342342
"""
343343

344344
name = "pc"

domdf_python_tools/paths.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
]
7272

7373
newline_default = object()
74-
_P = TypeVar('_P', bound=pathlib.PurePath)
74+
_P = TypeVar("_P", bound=pathlib.PurePath)
7575
"""
7676
.. versionadded:: 0.11.0
7777
"""
@@ -289,7 +289,7 @@ def in_directory(directory: PathLike):
289289
duration of the ``with`` block.
290290
291291
:param directory:
292-
"""
292+
""" # noqa: D400
293293

294294
oldwd = os.getcwd()
295295
try:
@@ -316,9 +316,9 @@ class PathPlus(pathlib.Path):
316316
Defaults to Unix line endings (``LF``) on all platforms.
317317
"""
318318

319-
def __new__(cls, *args, **kwargs):
319+
def __new__(cls, *args, **kwargs): # noqa D102
320320
if cls is PathPlus:
321-
cls = WindowsPathPlus if os.name == 'nt' else PosixPathPlus
321+
cls = WindowsPathPlus if os.name == "nt" else PosixPathPlus
322322

323323
self = cls._from_parts(args, init=False) # type: ignore
324324
if not self._flavour.is_supported:
@@ -720,21 +720,21 @@ class WindowsPathPlus(PathPlus, pathlib.PureWindowsPath):
720720

721721
def owner(self): # pragma: no cover
722722
"""
723-
Unsupported on Windows
723+
Unsupported on Windows.
724724
"""
725725

726726
raise NotImplementedError("Path.owner() is unsupported on this system")
727727

728728
def group(self): # pragma: no cover
729729
"""
730-
Unsupported on Windows
730+
Unsupported on Windows.
731731
"""
732732

733733
raise NotImplementedError("Path.group() is unsupported on this system")
734734

735735
def is_mount(self): # pragma: no cover
736736
"""
737-
Unsupported on Windows
737+
Unsupported on Windows.
738738
"""
739739

740740
raise NotImplementedError("Path.is_mount() is unsupported on this system")

domdf_python_tools/secrets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Secret(str):
5353

5454
value: str #: The actual value of the secret.
5555

56-
def __new__(cls, value) -> "Secret":
56+
def __new__(cls, value) -> "Secret": # noqa D102
5757
obj: Secret = super().__new__(cls, "<SECRET>") # type: ignore
5858
obj.value = str(value)
5959
return obj

domdf_python_tools/stringlist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def size(self, size: int) -> None:
7373
self._size = int(size)
7474

7575
@property
76-
def type(self) -> str: # noqa A002 # pylint: disable=redefined-builtin
76+
def type(self) -> str: # noqa A002,A003 # pylint: disable=redefined-builtin
7777
"""
7878
The indent character.
7979
"""
@@ -143,7 +143,7 @@ def __init__(self, iterable: Iterable[String] = (), convert_indents: bool = Fals
143143
def _make_line(self, line: str) -> str:
144144
if not str(self.indent_type).strip(" \t") and self.convert_indents:
145145
if self.indent_type == "\t":
146-
line = convert_indents(line, tab_width=1, from_=' ', to="\t")
146+
line = convert_indents(line, tab_width=1, from_=" ", to="\t")
147147
else: # pragma: no cover
148148
line = convert_indents(line, tab_width=1, from_="\t", to=self.indent_type)
149149

domdf_python_tools/terminal_colours.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def strip_ansi(value: str) -> str:
133133
.. versionadded:: 1.1.0
134134
"""
135135

136-
return _ansi_re.sub("", value)
136+
return _ansi_re.sub('', value)
137137

138138

139139
class Colour(str):
@@ -154,7 +154,7 @@ class Colour(str):
154154
reset: str
155155
stack: List[str]
156156

157-
def __new__(cls, style: str, stack: List[str], reset: str) -> "Colour":
157+
def __new__(cls, style: str, stack: List[str], reset: str) -> "Colour": # noqa D102
158158
color = super().__new__(cls, style) # type: ignore
159159
color.style = style
160160
color.stack = stack

domdf_python_tools/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class HasHead(Protocol):
197197
:class:`typing.Protocol` for classes that have a ``head`` method.
198198
199199
This includes :class:`pandas.DataFrame` and :class:`pandas.Series`.
200-
"""
200+
""" # noqa D400
201201

202202
def head(self: "FrameOrSeries", n: int = 5) -> "FrameOrSeries":
203203
"""

domdf_python_tools/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ def head(obj: Union[Tuple, List, "DataFrame", "Series", String, HasHead], n: int
465465
return repr(obj)
466466
else:
467467
head_of_namedtuple = {k: v for k, v in zip(obj._fields[:n], obj[:n])} # type: ignore
468-
repr_fmt = '(' + ', '.join(f'{k}={v!r}' for k, v in head_of_namedtuple.items()) + f', {etc})'
468+
repr_fmt = '(' + ', '.join(f"{k}={v!r}" for k, v in head_of_namedtuple.items()) + f", {etc})"
469469
return obj.__class__.__name__ + repr_fmt
470470

471471
elif isinstance(obj, (list, tuple)):
@@ -672,12 +672,12 @@ def _function_wrapper(function):
672672
# If removed_in is a version, use "removed in"
673673
parts = {
674674
"deprecated_in":
675-
f" {deprecated_in}" if deprecated_in else "",
675+
f" {deprecated_in}" if deprecated_in else '',
676676
"removed_in":
677677
f"\n This will be removed {'on' if isinstance(removed_in, date) else 'in'} {removed_in}."
678-
if removed_in else "",
678+
if removed_in else '',
679679
"details":
680-
f" {details}" if details else ""
680+
f" {details}" if details else ''
681681
}
682682

683683
deprecation_note = (".. deprecated::{deprecated_in}{removed_in}{details}".format(**parts))

0 commit comments

Comments
 (0)