Skip to content
This repository has been archived by the owner on Jun 14, 2021. It is now read-only.

Commit

Permalink
Added constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit-dubreuil committed Apr 13, 2021
1 parent cc8fea1 commit e3c800e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions conf/script/src/host/env/env_var_fwd.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import utils.more_typing

T_ItValue: typing.Final[type] = typing.TypeVar(name='T_ItValue', utils.more_typing.T_PathLike.)
T_Key: typing.Final[type] = utils.more_typing.T_PathLike
T_Single_Value: typing.Final[type] = utils.more_typing.T_PathLike
T_Values = typing.Final[list[T_Single_Value]]
Expand Down
11 changes: 7 additions & 4 deletions conf/script/src/utils/more_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
import pathlib
import typing

PathLike = typing.Union[pathlib.Path, os.PathLike, str, bytes]
AnyPath = typing.Union[pathlib.Path, os.PathLike, str, bytes, type(None)]
T_PathLike_Constraints = (pathlib.Path, os.PathLike, str, bytes)
T_AnyPath_Constraints: typing.Final = (pathlib.Path, os.PathLike, str, bytes, type(None))

T_PathLike = typing.TypeVar("T_PathLike", pathlib.Path, os.PathLike, str, bytes)
T_AnyPath = typing.TypeVar("T_AnyPath", pathlib.Path, os.PathLike, str, bytes, type(None))
PathLike: typing.Final[type] = typing.Union[*T_PathLike_Constraints, ...]
AnyPath: typing.Final[type] = typing.Union[*T_AnyPath_Constraints, ...]

T_PathLike: typing.Final[type] = typing.TypeVar("T_PathLike", *T_PathLike_Constraints, ...)
T_AnyPath: typing.Final[type] = typing.TypeVar("T_AnyPath", *T_AnyPath_Constraints, ...)

0 comments on commit e3c800e

Please sign in to comment.