Skip to content

Commit a3b535e

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 2dcb705 commit a3b535e

20 files changed

+396
-254
lines changed

domdf_python_tools/dates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def is_bst(the_date: Union[time.struct_time, datetime.date]) -> bool:
383383
'{word_join(_pytz_functions)}' require pytz (https://pypi.org/project/pytz/), but it could not be imported.
384384
385385
The error was: {e}.
386-
"""
386+
""",
387387
)
388388

389389
else:
@@ -394,7 +394,7 @@ class SelfWrapper(ModuleType):
394394
def __getattr__(self, name):
395395
if name in _pytz_functions:
396396
raise ImportError(
397-
f"{name!r} requires pytz (https://pypi.org/project/pytz/), but it could not be imported."
397+
f"{name!r} requires pytz (https://pypi.org/project/pytz/), but it could not be imported.",
398398
)
399399
else:
400400
return getattr(_actual_module, name)

domdf_python_tools/delegators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def _f(f: _C) -> _C:
8383
del to_params[param]
8484

8585
f.__signature__ = from_sig.replace( # type: ignore[attr-defined]
86-
parameters=[*from_params.values(), *to_params.values()]
86+
parameters=[*from_params.values(), *to_params.values()],
8787
)
8888
f.__annotations__ = {**to_annotations, **from_annotations}
8989

@@ -121,7 +121,7 @@ def _f(f: _C) -> _C:
121121

122122
elif tuple(from_params.keys()) == ("self", "args", "kwargs"):
123123
f.__signature__ = from_sig.replace( # type: ignore[attr-defined]
124-
parameters=[from_params["self"], *to_sig.parameters.values()]
124+
parameters=[from_params["self"], *to_sig.parameters.values()],
125125
)
126126

127127
copy_annotations(f)

domdf_python_tools/import_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"discover_in_module",
5454
"discover_entry_points",
5555
"discover_entry_points_by_name",
56-
"iter_submodules"
56+
"iter_submodules",
5757
]
5858

5959

domdf_python_tools/paths.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ def write_lines(
517517
encoding: Optional[str] = "UTF-8",
518518
errors: Optional[str] = None,
519519
*,
520-
trailing_whitespace: bool = False
520+
trailing_whitespace: bool = False,
521521
) -> None:
522522
"""
523523
Write the given list of lines to the file without trailing whitespace.
@@ -585,7 +585,7 @@ def open( # type: ignore # noqa: A003 # pylint: disable=redefined-builtin
585585
encoding: Optional[str] = "UTF-8",
586586
errors: Optional[str] = None,
587587
newline: Optional[str] = NEWLINE_DEFAULT,
588-
) -> IO[Any]:
588+
) -> IO[Any]:
589589
"""
590590
Open the file pointed by this path and return a file object, as
591591
the built-in :func:`open` function does.
@@ -1252,7 +1252,7 @@ def phase4(self) -> None: # noqa: D102
12521252
"left_only": filecmp.dircmp.phase1,
12531253
"right_only": filecmp.dircmp.phase1,
12541254
"left_list": filecmp.dircmp.phase0,
1255-
"right_list": filecmp.dircmp.phase0
1255+
"right_list": filecmp.dircmp.phase0,
12561256
}
12571257

12581258
methodmap = _methodmap # type: ignore[assignment]

domdf_python_tools/pretty_print.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def _pprint_dict(
150150
allowance + 1,
151151
context,
152152
level,
153-
)
153+
)
154154

155155
write(self._make_close('}', indent, obj))
156156

@@ -250,7 +250,7 @@ def _format_attribute_items(self, items, stream, indent, allowance, context, lev
250250
allowance if last else 1,
251251
context,
252252
level,
253-
)
253+
)
254254

255255
if not last:
256256
write(delimnl)

domdf_python_tools/stringlist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def __setitem__(self, index: Union[SupportsIndex, slice], line: Union[String, It
252252
for lline, idx in zip(
253253
reversed(line),
254254
reversed(range(index.start or 0, index.stop + 1, index.step or 1)),
255-
):
255+
):
256256
self[idx] = lline
257257
else:
258258
line = cast(String, line)

domdf_python_tools/versions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def _iter_float(version_float: float) -> Generator[int, None, None]:
303303
return _iter_string(str(version_float))
304304

305305

306-
def _prep_for_eq(other: Union[str, float, Version], ) -> Tuple[int, ...]:
306+
def _prep_for_eq(other: Union[str, float, Version]) -> Tuple[int, ...]:
307307
"""
308308
Prepare 'other' for use in ``__eq__``, ``__le__``, ``__ge__``, ``__gt__``, and ``__lt__``.
309309
"""

tests/test_dates.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def test_get_month_number_from_no(count: int):
246246
('0', "The given month ('0') is not recognised."),
247247
("-1", "The given month ('-1') is not recognised."),
248248
("13", "The given month ('13') is not recognised."),
249-
]
249+
],
250250
)
251251
def test_get_month_number_errors(value: Union[str, int], match: str):
252252
with pytest.raises(ValueError, match=re.escape(match)):
@@ -321,7 +321,7 @@ def test_check_date():
321321
date(2019, 4, 21),
322322
date(2020, 4, 12),
323323
date(2021, 4, 4),
324-
]
324+
],
325325
)
326326
def test_calc_easter(date):
327327
assert dates.calc_easter(date.year) == date
@@ -382,7 +382,7 @@ def test_calc_easter(date):
382382
(date(month=10, day=26, year=2024), True),
383383
(date(month=10, day=27, year=2024), False),
384384
(date(month=10, day=28, year=2024), False),
385-
]
385+
],
386386
)
387387
def test_is_bst(the_date, result: bool):
388388
assert dates.is_bst(the_date) is result

tests/test_dir_comparator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,26 +71,26 @@ def test_cmpfiles(self, comparator_tmpdir):
7171
comparator_tmpdir.dir,
7272
comparator_tmpdir.dir,
7373
["file"],
74-
) == (["file"], [], []), "Comparing directory to itself fails"
74+
) == (["file"], [], []), "Comparing directory to itself fails"
7575
assert filecmp.cmpfiles(
7676
comparator_tmpdir.dir,
7777
comparator_tmpdir.dir_same,
7878
["file"],
79-
) == (["file"], [], []), "Comparing directory to same fails"
79+
) == (["file"], [], []), "Comparing directory to same fails"
8080

8181
# Try it with shallow=False
8282
assert filecmp.cmpfiles(
8383
comparator_tmpdir.dir,
8484
comparator_tmpdir.dir,
8585
["file"],
8686
shallow=False,
87-
) == (["file"], [], []), "Comparing directory to itself fails"
87+
) == (["file"], [], []), "Comparing directory to itself fails"
8888
assert filecmp.cmpfiles(
8989
comparator_tmpdir.dir,
9090
comparator_tmpdir.dir_same,
9191
["file"],
9292
shallow=False,
93-
), "Comparing directory to same fails"
93+
), "Comparing directory to same fails"
9494

9595
# Add different file2
9696
with open(os.path.join(comparator_tmpdir.dir, "file2"), 'w', encoding="UTF-8") as output:
@@ -100,7 +100,7 @@ def test_cmpfiles(self, comparator_tmpdir):
100100
comparator_tmpdir.dir,
101101
comparator_tmpdir.dir_same,
102102
["file", "file2"],
103-
) != (["file"], ["file2"], []), "Comparing mismatched directories fails"
103+
) != (["file"], ["file2"], []), "Comparing mismatched directories fails"
104104

105105
def _assert_lists(self, actual, expected):
106106
"""

tests/test_doctools.py

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def function_in_class_with_same_args(self, a, b, c, d):
194194
(False, ''),
195195
(0, ''),
196196
([], ''),
197-
]
197+
],
198198
)
199199
def test_deindent_string(docstring, expects):
200200
assert doctools.deindent_string(docstring) == expects
@@ -210,13 +210,15 @@ def test_decorators():
210210

211211
# set_opening_hours and ceil should have extra text at the beginning
212212
assert (SpamCafe.set_opening_hours.__doc__ or '').startswith("I will not buy this record, it is scratched.")
213-
assert (doctools.deindent_string(SpamCafe.set_opening_hours.__doc__
214-
)).endswith(doctools.deindent_string(Cafe.set_opening_hours.__doc__))
213+
assert (doctools.deindent_string(SpamCafe.set_opening_hours.__doc__, )).endswith(
214+
doctools.deindent_string(Cafe.set_opening_hours.__doc__)
215+
)
215216
# Dedented both strings to be sure of equivalence
216-
assert (SpamCafe.ceil.__doc__ or ''
217-
).startswith("I don't know why the cafe has a ceil function, but we'd better document it properly.", )
218-
assert doctools.deindent_string(SpamCafe.ceil.__doc__
219-
).rstrip().endswith(doctools.deindent_string(math.ceil.__doc__).rstrip())
217+
assert (SpamCafe.ceil.__doc__ or
218+
'').startswith("I don't know why the cafe has a ceil function, but we'd better document it properly.")
219+
assert doctools.deindent_string(SpamCafe.ceil.__doc__, ).rstrip().endswith(
220+
doctools.deindent_string(math.ceil.__doc__).rstrip()
221+
)
220222
# Dedented both strings to be sure of equivalence
221223

222224
# Functions
@@ -225,18 +227,27 @@ def test_decorators():
225227

226228
if PEP_563:
227229
assert undocumented_function.__annotations__ == {
228-
'a': "float", 'b': "float", 'c': "float", 'd': "int", "return": "float"
230+
'a': "float",
231+
'b': "float",
232+
'c': "float",
233+
'd': "int",
234+
"return": "float",
229235
}
230236
else:
231237
assert undocumented_function.__annotations__ == {
232-
'a': float, 'b': float, 'c': float, 'd': int, "return": float
238+
'a': float,
239+
'b': float,
240+
'c': float,
241+
'd': int,
242+
"return": float,
233243
}
234244

235245
assert (partially_documented_function.__doc__ or '').startswith(
236-
"This function works like ``documented_function`` except it returns the result telepathically."
246+
"This function works like ``documented_function`` except it returns the result telepathically.",
247+
)
248+
assert (doctools.deindent_string(partially_documented_function.__doc__, )).endswith(
249+
doctools.deindent_string(documented_function.__doc__)
237250
)
238-
assert (doctools.deindent_string(partially_documented_function.__doc__
239-
)).endswith(doctools.deindent_string(documented_function.__doc__))
240251
# Dedented both strings to be sure of equivalence
241252
assert DummyClass.function_in_class_with_same_args.__doc__ == documented_function.__doc__
242253
assert DummyClass.function_in_class_with_same_args.__name__ == "function_in_class_with_same_args"

0 commit comments

Comments
 (0)