diff options
Diffstat (limited to 'alembic')
-rw-r--r-- | alembic/context.pyi | 9 | ||||
-rw-r--r-- | alembic/runtime/environment.py | 14 | ||||
-rw-r--r-- | alembic/util/compat.py | 1 |
3 files changed, 17 insertions, 7 deletions
diff --git a/alembic/context.pyi b/alembic/context.pyi index 9871fad..86345c4 100644 --- a/alembic/context.pyi +++ b/alembic/context.pyi @@ -7,7 +7,9 @@ from typing import Callable from typing import ContextManager from typing import Dict from typing import List +from typing import Literal from typing import Optional +from typing import overload from typing import TextIO from typing import Tuple from typing import TYPE_CHECKING @@ -644,8 +646,13 @@ def get_tag_argument() -> Optional[str]: """ +@overload +def get_x_argument(as_dictionary: Literal[False]) -> List[str]: ... +@overload +def get_x_argument(as_dictionary: Literal[True]) -> Dict[str, str]: ... +@overload def get_x_argument( - as_dictionary: bool = False, + as_dictionary: bool = ..., ) -> Union[List[str], Dict[str, str]]: """Return the value(s) passed for the ``-x`` argument, if any. diff --git a/alembic/runtime/environment.py b/alembic/runtime/environment.py index 44dcd72..a441d1f 100644 --- a/alembic/runtime/environment.py +++ b/alembic/runtime/environment.py @@ -269,15 +269,17 @@ class EnvironmentContext(util.ModuleClsProxy): return self.context_opts.get("tag", None) @overload - def get_x_argument( # type:ignore[misc] - self, as_dictionary: Literal[False] = ... - ) -> List[str]: + def get_x_argument(self, as_dictionary: Literal[False]) -> List[str]: ... @overload - def get_x_argument( # type:ignore[misc] - self, as_dictionary: Literal[True] = ... - ) -> Dict[str, str]: + def get_x_argument(self, as_dictionary: Literal[True]) -> Dict[str, str]: + ... + + @overload + def get_x_argument( + self, as_dictionary: bool = ... + ) -> Union[List[str], Dict[str, str]]: ... def get_x_argument( diff --git a/alembic/util/compat.py b/alembic/util/compat.py index 289aaa2..2fe4957 100644 --- a/alembic/util/compat.py +++ b/alembic/util/compat.py @@ -10,6 +10,7 @@ from sqlalchemy.util.compat import inspect_formatargspec # noqa is_posix = os.name == "posix" +py311 = sys.version_info >= (3, 11) py39 = sys.version_info >= (3, 9) py38 = sys.version_info >= (3, 8) |