summaryrefslogtreecommitdiff
path: root/src/setuptools_scm/_types.py
diff options
context:
space:
mode:
authorRonny Pfannschmidt <opensource@ronnypfannschmidt.de>2022-05-07 21:12:35 +0200
committerRonny Pfannschmidt <opensource@ronnypfannschmidt.de>2022-05-29 12:29:27 +0200
commitb45e19f9f275a31873fd5e07faabef16fd0bbec0 (patch)
treeea9492e77f822c15d50d6b71851f9b31b59a4d6d /src/setuptools_scm/_types.py
parente09403f0f8d0923f5fac3f7094e0bbf80c824933 (diff)
downloadsetuptools-scm-b45e19f9f275a31873fd5e07faabef16fd0bbec0.tar.gz
complete mypy transformation
Diffstat (limited to 'src/setuptools_scm/_types.py')
-rw-r--r--src/setuptools_scm/_types.py39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/setuptools_scm/_types.py b/src/setuptools_scm/_types.py
index 923931c..09fb2b6 100644
--- a/src/setuptools_scm/_types.py
+++ b/src/setuptools_scm/_types.py
@@ -1,31 +1,52 @@
import os
+import sys
+from typing import Any
from typing import Callable
+from typing import List
+from typing import NamedTuple
+from typing import Protocol
from typing import TYPE_CHECKING
from typing import TypeVar
from typing import Union
+
if TYPE_CHECKING:
+ from setuptools_scm import version
- from typing_extensions import ParamSpec
+if sys.version_info >= (3, 9):
+ from typing import ParamSpec, TypeAlias
else:
+ from typing_extensions import ParamSpec, TypeAlias
+
+PathT = Union["os.PathLike[str]", str]
- class ParamSpec(list):
- def __init__(self, _) -> None:
- pass
+CMD_TYPE: TypeAlias = Union[List[str], str]
+VERSION_SCHEME = Union[str, Callable[["version.ScmVersion"], str]]
-PathT = Union["os.PathLike[str]", str]
+
+class CmdResult(NamedTuple):
+ out: str
+ err: str
+ returncode: int
+
+
+class EntrypointProtocol(Protocol):
+ name: str
+
+ def load(self) -> Any:
+ pass
T = TypeVar("T")
T2 = TypeVar("T2")
-PARAMS = ParamSpec("PARAMS")
+P = ParamSpec("P")
def transfer_input_args(
- template: "Callable[PARAMS, T]",
-) -> Callable[[Callable[..., T2]], "Callable[PARAMS, T2]"]:
- def decorate(func: Callable[..., T2]) -> "Callable[PARAMS, T2]":
+ template: Callable[P, T],
+) -> Callable[[Callable[..., T]], Callable[P, T]]:
+ def decorate(func: Callable[..., T2]) -> Callable[P, T2]:
return func
return decorate