refactor: identifiers in a file (#511)

* refactor: identifiers in a file

* chore: more typing

* refactor: PlatStr -> PlatformName

* refactor: load in file, use importlib.resources

* refactor: change toml structure

* refactor: use common Traversable

* fix: ensure reasonable version of importlib_resources

* style: fix extra line
This commit is contained in:
Henry Schreiner
2021-01-09 15:40:40 -05:00
committed by GitHub
parent 635b226a6c
commit 5eb5ea10f5
9 changed files with 180 additions and 92 deletions
+16 -1
View File
@@ -1,6 +1,13 @@
import os
import subprocess
from typing import TYPE_CHECKING, Union
import sys
from typing import TYPE_CHECKING, NoReturn, Set, Union
if sys.version_info < (3, 8):
from typing_extensions import Final, Literal
else:
from typing import Final, Literal
if TYPE_CHECKING:
PopenBytes = subprocess.Popen[bytes]
@@ -8,3 +15,11 @@ if TYPE_CHECKING:
else:
PopenBytes = subprocess.Popen
PathOrStr = Union[str, "os.PathLike[str]"]
PlatformName = Literal["linux", "macos", "windows"]
PLATFORMS: Final[Set[PlatformName]] = {"linux", "macos", "windows"}
def assert_never(value: NoReturn) -> NoReturn:
assert False, f'Unhandled value: {value} ({type(value).__name__})' # noqa: B011