main commit
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-16 16:30:25 +09:00
parent 91c7e04474
commit 537e7b363f
1146 changed files with 45926 additions and 77196 deletions

View File

@@ -3,13 +3,13 @@ from __future__ import annotations
from typing import Any
from typing import Callable
from typing import Collection
from typing import ContextManager
from typing import Dict
from typing import List
from typing import Mapping
from typing import MutableMapping
from typing import Optional
from typing import overload
from typing import Sequence
from typing import TextIO
from typing import Tuple
from typing import TYPE_CHECKING
@@ -17,7 +17,6 @@ from typing import Union
from sqlalchemy.sql.schema import Column
from sqlalchemy.sql.schema import FetchedValue
from typing_extensions import ContextManager
from typing_extensions import Literal
from .migration import _ProxyTransaction
@@ -108,6 +107,7 @@ CompareType = Callable[
class EnvironmentContext(util.ModuleClsProxy):
"""A configurational facade made available in an ``env.py`` script.
The :class:`.EnvironmentContext` acts as a *facade* to the more
@@ -227,9 +227,9 @@ class EnvironmentContext(util.ModuleClsProxy):
has been configured.
"""
return self.context_opts.get("as_sql", False) # type: ignore[no-any-return] # noqa: E501
return self.context_opts.get("as_sql", False)
def is_transactional_ddl(self) -> bool:
def is_transactional_ddl(self):
"""Return True if the context is configured to expect a
transactional DDL capable backend.
@@ -341,17 +341,18 @@ class EnvironmentContext(util.ModuleClsProxy):
return self.context_opts.get("tag", None)
@overload
def get_x_argument(self, as_dictionary: Literal[False]) -> List[str]: ...
def get_x_argument(self, as_dictionary: Literal[False]) -> List[str]:
...
@overload
def get_x_argument(
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]]: ...
) -> Union[List[str], Dict[str, str]]:
...
def get_x_argument(
self, as_dictionary: bool = False
@@ -365,11 +366,7 @@ class EnvironmentContext(util.ModuleClsProxy):
The return value is a list, returned directly from the ``argparse``
structure. If ``as_dictionary=True`` is passed, the ``x`` arguments
are parsed using ``key=value`` format into a dictionary that is
then returned. If there is no ``=`` in the argument, value is an empty
string.
.. versionchanged:: 1.13.1 Support ``as_dictionary=True`` when
arguments are passed without the ``=`` symbol.
then returned.
For example, to support passing a database URL on the command line,
the standard ``env.py`` script can be modified like this::
@@ -403,12 +400,7 @@ class EnvironmentContext(util.ModuleClsProxy):
else:
value = []
if as_dictionary:
dict_value = {}
for arg in value:
x_key, _, x_value = arg.partition("=")
dict_value[x_key] = x_value
value = dict_value
value = dict(arg.split("=", 1) for arg in value)
return value
def configure(
@@ -424,7 +416,7 @@ class EnvironmentContext(util.ModuleClsProxy):
tag: Optional[str] = None,
template_args: Optional[Dict[str, Any]] = None,
render_as_batch: bool = False,
target_metadata: Union[MetaData, Sequence[MetaData], None] = None,
target_metadata: Optional[MetaData] = None,
include_name: Optional[IncludeNameFn] = None,
include_object: Optional[IncludeObjectFn] = None,
include_schemas: bool = False,
@@ -948,7 +940,7 @@ class EnvironmentContext(util.ModuleClsProxy):
def execute(
self,
sql: Union[Executable, str],
execution_options: Optional[Dict[str, Any]] = None,
execution_options: Optional[dict] = None,
) -> None:
"""Execute the given SQL using the current change context.
@@ -976,7 +968,7 @@ class EnvironmentContext(util.ModuleClsProxy):
def begin_transaction(
self,
) -> Union[_ProxyTransaction, ContextManager[None, Optional[bool]]]:
) -> Union[_ProxyTransaction, ContextManager[None]]:
"""Return a context manager that will
enclose an operation within a "transaction",
as defined by the environment's offline