Skip to content

Commit

Permalink
fix: py38/39 typing compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
akaihola committed Sep 24, 2024
1 parent fd2a479 commit 4cfee7a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions constraints-oldest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ ruamel.yaml==0.17.21
toml==0.10.0
twine==2.0.0
types-toml==0.10.4
typing_extensions==4.0.1
wheel==0.21.0
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ install_requires =
black>=22.3.0
darkgraylib~=2.0.1
toml>=0.10.0
typing_extensions>=4.0.1
# NOTE: remember to keep `.github/workflows/python-package.yml` in sync
# with the minimum required Python version
python_requires = >=3.8
Expand Down
10 changes: 8 additions & 2 deletions src/darker/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@

from __future__ import annotations

import sys
from dataclasses import dataclass, field
from pathlib import Path
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Union

from darkgraylib.config import BaseConfig, ConfigurationError

if sys.version_info < (3, 10):
from typing_extensions import TypeAlias
else:
from typing import TypeAlias

if TYPE_CHECKING:
from argparse import Namespace

UnvalidatedConfig = dict[str, list[str] | str | bool | int]
UnvalidatedConfig: TypeAlias = dict[str, Union[list[str], str, bool, int]]


REMOVED_CONFIG_OPTIONS = {
Expand Down

0 comments on commit 4cfee7a

Please sign in to comment.