Skip to content

Commit 1f40f8d

Browse files
committed
more specific type hints
1 parent 7990fe9 commit 1f40f8d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

rapids_build_backend/config.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@
66
from .utils import _get_pyproject
77

88
if TYPE_CHECKING:
9-
from typing import Any
9+
from typing import Callable
10+
11+
# config options can be one of these types...
12+
config_val_type = str | bool | None
13+
14+
# ... or a callable that returns one of those or a list of strings
15+
mutable_config_val_type = Callable[[], config_val_type | list[str]]
16+
config_options_type = dict[
17+
str, tuple[config_val_type | mutable_config_val_type, bool]
18+
]
1019

1120

1221
class Config:
@@ -15,7 +24,7 @@ class Config:
1524
# Mapping from config option to default value (None indicates that option is
1625
# required) and whether it may be overridden by an environment variable or a config
1726
# setting.
18-
config_options: "dict[str, tuple[Any, bool]]" = {
27+
config_options: "config_options_type" = {
1928
"build-backend": (None, False),
2029
"commit-file": ("", False),
2130
"dependencies-file": ("dependencies.yaml", True),

0 commit comments

Comments
 (0)