Skip to content

Commit 05de5fa

Browse files
author
Mathieu Scheltienne
committed
fix style
1 parent 414783a commit 05de5fa

File tree

5 files changed

+9
-31
lines changed

5 files changed

+9
-31
lines changed

template/utils/_checks.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ def _ensure_int(item: Any, item_name: Optional[str] = None) -> int:
3636
item = int(operator.index(item))
3737
except TypeError:
3838
item_name = "Item" if item_name is None else "'%s'" % item_name
39-
raise TypeError(
40-
f"{item_name} must be an integer, got {type(item)} instead."
41-
)
39+
raise TypeError(f"{item_name} must be an integer, got {type(item)} instead.")
4240

4341
return item
4442

@@ -68,9 +66,7 @@ def __instancecheck__(cls, other: Any) -> bool:
6866
}
6967

7068

71-
def check_type(
72-
item: Any, types: tuple, item_name: Optional[str] = None
73-
) -> None:
69+
def check_type(item: Any, types: tuple, item_name: Optional[str] = None) -> None:
7470
"""Check that item is an instance of types.
7571
7672
Parameters
@@ -169,9 +165,7 @@ def check_value(
169165
options += ", ".join([f"{repr(v)}" for v in allowed_values[:-1]])
170166
options += f", and {repr(allowed_values[-1])}"
171167
raise ValueError(
172-
msg.format(
173-
item_name=item_name, extra=extra, options=options, item=item
174-
)
168+
msg.format(item_name=item_name, extra=extra, options=options, item=item)
175169
)
176170

177171

@@ -248,7 +242,5 @@ def ensure_path(item: Any, must_exist: bool) -> Path:
248242
f"not {type(item)}."
249243
)
250244
if must_exist and not item.exists():
251-
raise FileNotFoundError(
252-
f"The provided path '{str(item)}' does not exist."
253-
)
245+
raise FileNotFoundError(f"The provided path '{str(item)}' does not exist.")
254246
return item

template/utils/config.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ def sys_info(fid: Optional[IO] = None, developer: bool = False):
4747
# dependencies
4848
out("\nCore dependencies\n")
4949
dependencies = [Requirement(elt) for elt in requires(package)]
50-
core_dependencies = [
51-
dep for dep in dependencies if "extra" not in str(dep.marker)
52-
]
50+
core_dependencies = [dep for dep in dependencies if "extra" not in str(dep.marker)]
5351
_list_dependencies_info(out, ljust, package, core_dependencies)
5452

5553
# extras

template/utils/logs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99

1010

1111
@fill_doc
12-
def _init_logger(
13-
*, verbose: Optional[Union[bool, str, int]] = None
14-
) -> logging.Logger:
12+
def _init_logger(*, verbose: Optional[Union[bool, str, int]] = None) -> logging.Logger:
1513
"""Initialize a logger.
1614
1715
Assigns sys.stdout as the first handler of the logger.

template/utils/tests/test_checks.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@
55

66
import pytest
77

8-
from .._checks import (
9-
_ensure_int,
10-
check_type,
11-
check_value,
12-
check_verbose,
13-
ensure_path,
14-
)
8+
from .._checks import _ensure_int, check_type, check_value, check_verbose, ensure_path
159

1610

1711
def test_ensure_int():
@@ -61,9 +55,7 @@ def test_check_value():
6155
# invalids
6256
with pytest.raises(ValueError, match="Invalid value for the parameter."):
6357
check_value(5, [1, 2, 3, 4])
64-
with pytest.raises(
65-
ValueError, match="Invalid value for the 'number' parameter."
66-
):
58+
with pytest.raises(ValueError, match="Invalid value for the 'number' parameter."):
6759
check_value(5, [1, 2, 3, 4], "number")
6860

6961

template/utils/tests/test_logs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ def test_default_log_level(caplog):
3535
assert "101" in caplog.text
3636

3737

38-
@pytest.mark.parametrize(
39-
"level", ("DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL")
40-
)
38+
@pytest.mark.parametrize("level", ("DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"))
4139
def test_logger(level, caplog):
4240
"""Test basic logger functionalities."""
4341
level_functions = {

0 commit comments

Comments
 (0)