Skip to content

Commit 69f140f

Browse files
committed
Linting,
1 parent 68f24fa commit 69f140f

File tree

7 files changed

+22
-25
lines changed

7 files changed

+22
-25
lines changed

domdf_python_tools/dates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def utc_timestamp_to_datetime(
187187
if sys.version_info <= (3, 7, 2):
188188
MonthsType = OrderedDict
189189
else:
190-
MonthsType = typing.OrderedDict[str, str] # type: ignore
190+
MonthsType = typing.OrderedDict[str, str] # type: ignore # noqa: TYP006
191191

192192
#: Mapping of 3-character shortcodes to full month names.
193193
months: MonthsType = OrderedDict(

domdf_python_tools/delegators.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ def _f(f: _C) -> _C:
119119

120120
elif tuple(from_params.keys()) == ("self", "args", "kwargs"):
121121
f.__signature__ = from_sig.replace( # type: ignore
122-
parameters=[
123-
from_params["self"],
124-
*to_sig.parameters.values(),
125-
]
122+
parameters=[from_params["self"], *to_sig.parameters.values()]
126123
)
127124

128125
copy_annotations(f)

domdf_python_tools/import_tools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ def discover_entry_points(
143143
match_func: Optional[Callable[[Any], bool]] = None,
144144
) -> List[Any]:
145145
"""
146-
Returns a list of entry points in the given category,
147-
optionally filtered by ``match_func``.
146+
Returns a list of entry points in the given category, optionally filtered by ``match_func``.
148147
149148
:param group_name: The entry point group name, e.g. ``'entry_points'``.
150-
:param match_func: Function taking an object and returning :py:obj:`True` if the object is to be included in the output.
149+
:param match_func: Function taking an object and returning :py:obj:`True`
150+
if the object is to be included in the output.
151151
:default match_func: :py:obj:`None`, which includes all objects.
152152
153153
:return: List of matching objects.

domdf_python_tools/paths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class PathPlus(pathlib.Path):
316316
Defaults to Unix line endings (``LF``) on all platforms.
317317
"""
318318

319-
__slots__ = ('_accessor', )
319+
__slots__ = ("_accessor", )
320320

321321
def __new__(cls, *args, **kwargs): # noqa D102
322322
if cls is PathPlus:

domdf_python_tools/terminal_colours.pyi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ style_stack: List[str]
7575

7676
def code_to_chars(code) -> str: ...
7777
def set_title(title: str) -> str: ...
78-
def clear_screen(mode: int = 2) -> str: ...
79-
def clear_line(mode: int = 2) -> str: ...
78+
def clear_screen(mode: int = ...) -> str: ...
79+
def clear_line(mode: int = ...) -> str: ...
8080

8181

8282
def strip_ansi(value: str) -> str: ...
@@ -102,17 +102,17 @@ class AnsiCodes(ABC):
102102

103103
class AnsiCursor:
104104

105-
def UP(self, n: int = 1) -> str: ...
106-
def DOWN(self, n: int = 1) -> str: ...
107-
def FORWARD(self, n: int = 1) -> str: ...
108-
def BACK(self, n: int = 1) -> str: ...
109-
def POS(self, x: int = 1, y: int = 1) -> str: ...
105+
def UP(self, n: int = ...) -> str: ...
106+
def DOWN(self, n: int = ...) -> str: ...
107+
def FORWARD(self, n: int = ...) -> str: ...
108+
def BACK(self, n: int = ...) -> str: ...
109+
def POS(self, x: int = ..., y: int = ...) -> str: ...
110110

111111

112112
class AnsiFore(AnsiCodes):
113113

114114
_stack = fore_stack
115-
_reset = "\033[39m"
115+
_reset = ...
116116

117117
BLACK: Colour
118118
RED: Colour

domdf_python_tools/versions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@ class Version(Tuple[int, int, int]):
7373
"""
7474

7575
@property # type: ignore
76-
def major(self):
76+
def major(self): # noqa: D102
7777
return self[0]
7878

7979
@property # type: ignore
80-
def minor(self):
80+
def minor(self): # noqa: D102
8181
return self[1]
8282

8383
@property # type: ignore
84-
def patch(self):
84+
def patch(self): # noqa: D102
8585
return self[2]
8686

87-
def __new__(cls, major=0, minor=0, patch=0) -> "Version":
87+
def __new__(cls, major=0, minor=0, patch=0) -> "Version": # noqa: D102
8888
t: "Version" = super().__new__(cls, (int(major), int(minor), int(patch))) # type: ignore
8989

9090
return t
@@ -254,7 +254,7 @@ def _asdict(self) -> Dict[str, int]:
254254

255255
def _replace(self, **kwargs) -> "Version":
256256
"""
257-
Return a new instance of the named tuple replacing specified fields with new values:
257+
Return a new instance of the named tuple replacing specified fields with new values.
258258
259259
:param kwargs:
260260

tests/test_stringlist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ def test_start_of_line_indents(self):
119119
assert StringList("Hello\n World", convert_indents=True) == ["Hello", "\tWorld"]
120120

121121
def test_negative_getitem(self):
122-
sl = StringList(['', '', "hello", "world", '', '', 'abc', "1234"])
122+
sl = StringList(['', '', "hello", "world", '', '', "abc", "1234"])
123123

124124
assert sl[-1] == "1234"
125125
sl[-1] += "5678"
126-
assert sl == ['', '', "hello", "world", '', '', 'abc', "12345678"]
126+
assert sl == ['', '', "hello", "world", '', '', "abc", "12345678"]
127127

128128
assert sl[-2] == "abc"
129129
sl[-2] += "def"
130-
assert sl == ['', '', "hello", "world", '', '', 'abcdef', "12345678"]
130+
assert sl == ['', '', "hello", "world", '', '', "abcdef", "12345678"]
131131

132132
def test_indent_size(self):
133133
sl = StringList(['', '', "hello", "world", '', '', '', "1234"])

0 commit comments

Comments
 (0)