Skip to content

Commit 71f5926

Browse files
committed
MAINT: simplify typing
1 parent d838772 commit 71f5926

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

mesonpy/__init__.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
from mesonpy._compat import Collection, Mapping, cached_property, read_binary
5555

5656

57+
_MESON_ARGS_KEYS = ['dist', 'setup', 'compile', 'install']
58+
5759
if typing.TYPE_CHECKING: # pragma: no cover
5860
from typing import Any, Callable, DefaultDict, List, Literal, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union
5961

@@ -62,20 +64,11 @@
6264
P = ParamSpec('P')
6365
T = TypeVar('T')
6466

65-
66-
__version__ = '0.15.0.dev0'
67-
68-
69-
# XXX: Once Python 3.8 is our minimum supported version, get rid of
70-
# meson_args_keys and use typing.get_args(MesonArgsKeys) instead.
71-
72-
# Keep both definitions in sync!
73-
_MESON_ARGS_KEYS = ['dist', 'setup', 'compile', 'install']
74-
if typing.TYPE_CHECKING:
7567
MesonArgsKeys = Literal['dist', 'setup', 'compile', 'install']
7668
MesonArgs = Mapping[MesonArgsKeys, List[str]]
77-
else:
78-
MesonArgs = dict
69+
70+
71+
__version__ = '0.15.0.dev0'
7972

8073

8174
_COLORS = {
@@ -940,7 +933,7 @@ def _project(config_settings: Optional[Dict[Any, Any]] = None) -> Iterator[Proje
940933
"""Create the project given the given config settings."""
941934

942935
settings = _validate_config_settings(config_settings or {})
943-
meson_args = typing.cast(MesonArgs, {name: settings.get(f'{name}-args', []) for name in _MESON_ARGS_KEYS})
936+
meson_args = typing.cast('MesonArgs', {name: settings.get(f'{name}-args', []) for name in _MESON_ARGS_KEYS})
944937
source_dir = os.path.curdir
945938
build_dir = settings.get('builddir')
946939
editable_verbose = bool(settings.get('editable-verbose'))

0 commit comments

Comments
 (0)