Skip to content

Commit 7f10220

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 4cb378a commit 7f10220

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

mypy/config_parser.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from collections.abc import Mapping, MutableMapping, Sequence
1919
from typing import Any, Callable, Final, TextIO, Union
20-
from typing_extensions import TypeAlias, Never
20+
from typing_extensions import Never, TypeAlias
2121

2222
from mypy import defaults
2323
from mypy.options import PER_MODULE_OPTIONS, Options
@@ -63,15 +63,26 @@ def parse_version(v: str | float) -> tuple[int, int]:
6363
def try_split(v: str | Sequence[str] | Any, split_regex: str = "[,]") -> list[str]:
6464
"""Split and trim a str or sequence (eg: list) of str into a list of str.
6565
If an element of the input is not str, a type error will be raised."""
66+
6667
def complain(x: object, additional_info: str = "") -> Never:
67-
raise argparse.ArgumentTypeError(f"Expected a list or a stringified version thereof, but got: '{x}', of type {type(x)}.{additional_info}")
68+
raise argparse.ArgumentTypeError(
69+
f"Expected a list or a stringified version thereof, but got: '{x}', of type {type(x)}.{additional_info}"
70+
)
71+
6872
if isinstance(v, str):
6973
items = [p.strip() for p in re.split(split_regex, v)]
7074
if items and items[-1] == "":
7175
items.pop(-1)
7276
return items
7377
elif isinstance(v, Sequence):
74-
return [p.strip() if isinstance(p, str) else complain(p, additional_info=" (As an element of the list.)") for p in v]
78+
return [
79+
(
80+
p.strip()
81+
if isinstance(p, str)
82+
else complain(p, additional_info=" (As an element of the list.)")
83+
)
84+
for p in v
85+
]
7586
else:
7687
complain(v)
7788

0 commit comments

Comments
 (0)