Skip to content

Commit

Permalink
test: satisfy updated linters
Browse files Browse the repository at this point in the history
  • Loading branch information
akaihola committed Oct 17, 2024
1 parent f29d7f6 commit d599c20
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/darker/black_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,21 @@
based on whether reformats touch user-edited lines
"""

from __future__ import annotations

import inspect
import logging
from pathlib import Path
from typing import Collection, Optional, Pattern, Set, Tuple, TypedDict, Union
from typing import (
TYPE_CHECKING,
Collection,
Optional,
Pattern,
Set,
Tuple,
TypedDict,
Union,
)

# `FileMode as Mode` required to satisfy mypy==0.782. Strange.
from black import FileMode as Mode
Expand All @@ -56,6 +67,9 @@
from darkgraylib.config import ConfigurationError
from darkgraylib.utils import TextDocument

if TYPE_CHECKING:
from pathlib import Path

__all__ = ["BlackConfig", "Mode", "run_black"]

logger = logging.getLogger(__name__)
Expand All @@ -69,9 +83,9 @@ class BlackConfig(TypedDict, total=False):
"""Type definition for Black configuration dictionaries"""

config: str
exclude: Pattern[str]
extend_exclude: Pattern[str]
force_exclude: Pattern[str]
exclude: Pattern[str] | None
extend_exclude: Pattern[str] | None
force_exclude: Pattern[str] | None
target_version: Union[str, Set[str]]
line_length: int
skip_string_normalization: bool
Expand Down Expand Up @@ -164,7 +178,7 @@ def filter_python_files(
directories,
root,
include=DEFAULT_INCLUDE_RE,
exclude=black_config.get("exclude", DEFAULT_EXCLUDE_RE),
exclude=black_config.get("exclude") or DEFAULT_EXCLUDE_RE,
extend_exclude=black_config.get("extend_exclude"),
force_exclude=black_config.get("force_exclude"),
report=Report(),
Expand Down

0 comments on commit d599c20

Please sign in to comment.