From 7e8069939b34f59ce6f487a5019723c8e52d23f6 Mon Sep 17 00:00:00 2001 From: Taneli Hukkinen <3275109+hukkin@users.noreply.github.com> Date: Sat, 12 Oct 2024 18:31:07 +0300 Subject: [PATCH] Satisfy linters --- src/mdformat/_cli.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mdformat/_cli.py b/src/mdformat/_cli.py index d7725e9..e11b5a2 100644 --- a/src/mdformat/_cli.py +++ b/src/mdformat/_cli.py @@ -59,10 +59,10 @@ def run(cli_args: Sequence[str]) -> int: # noqa: C901 return 1 opts: Mapping = {**DEFAULT_OPTS, **toml_opts, **cli_opts} - if sys.version_info >= (3, 13): + if sys.version_info >= (3, 13): # pragma: no cover if is_excluded(path, opts["exclude"], toml_path, "exclude" in cli_opts): continue - else: + else: # pragma: no cover if "exclude" in toml_opts: print_error( "'exclude' patterns are only available on Python 3.13+.", @@ -172,7 +172,7 @@ def make_arg_parser( choices=("lf", "crlf", "keep"), help="output file line ending mode (default: lf)", ) - if sys.version_info >= (3, 13): + if sys.version_info >= (3, 13): # pragma: no cover parser.add_argument( "--exclude", action="append", @@ -237,7 +237,10 @@ def is_excluded( except ValueError: return False - return any(relative_path.full_match(pattern) for pattern in patterns) + return any( + relative_path.full_match(pattern) # type: ignore[attr-defined] + for pattern in patterns + ) def _normalize_path(path: Path) -> Path: