summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-03-08 17:14:41 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-03-13 15:29:20 -0400
commit769fa67d842035dd852ab8b6a26ea3f110a51131 (patch)
tree5c121caca336071091c6f5ea4c54743c92d6458a /lib/sqlalchemy/sql/base.py
parent77fc8216a74e6b2d0efc6591c6c735687bd10002 (diff)
downloadsqlalchemy-769fa67d842035dd852ab8b6a26ea3f110a51131.tar.gz
pep-484: sqlalchemy.sql pass one
sqlalchemy.sql will require many passes to get all modules even gradually typed. Will have to pick and choose what modules can be strictly typed vs. which can be gradual. in this patch, emphasis is on visitors.py, cache_key.py, annotations.py for strict typing, compiler.py is on gradual typing but has much more structure, in particular where it connects with the outside world. The work within compiler.py also reached back out to engine/cursor.py , default.py quite a bit. References: #6810 Change-Id: I6e8a29f6013fd216e43d45091bc193f8be0368fd
Diffstat (limited to 'lib/sqlalchemy/sql/base.py')
-rw-r--r--lib/sqlalchemy/sql/base.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py
index a94590da1..a408a010a 100644
--- a/lib/sqlalchemy/sql/base.py
+++ b/lib/sqlalchemy/sql/base.py
@@ -19,8 +19,10 @@ from itertools import zip_longest
import operator
import re
import typing
+from typing import MutableMapping
from typing import Optional
from typing import Sequence
+from typing import Set
from typing import TypeVar
from . import roles
@@ -36,14 +38,9 @@ from .. import util
from ..util import HasMemoized as HasMemoized
from ..util import hybridmethod
from ..util import typing as compat_typing
-from ..util._has_cy import HAS_CYEXTENSION
-
-if typing.TYPE_CHECKING or not HAS_CYEXTENSION:
- from ._py_util import prefix_anon_map # noqa
-else:
- from sqlalchemy.cyextension.util import prefix_anon_map # noqa
if typing.TYPE_CHECKING:
+ from .elements import ColumnElement
from ..engine import Connection
from ..engine import Result
from ..engine.interfaces import _CoreMultiExecuteParams
@@ -63,6 +60,8 @@ NO_ARG = util.symbol("NO_ARG")
# symbols, mypy reports: "error: _Fn? not callable"
_Fn = typing.TypeVar("_Fn", bound=typing.Callable)
+_AmbiguousTableNameMap = MutableMapping[str, str]
+
class Immutable:
"""mark a ClauseElement as 'immutable' when expressions are cloned."""
@@ -87,6 +86,10 @@ class SingletonConstant(Immutable):
_is_singleton_constant = True
+ _singleton: SingletonConstant
+
+ proxy_set: Set[ColumnElement]
+
def __new__(cls, *arg, **kw):
return cls._singleton
@@ -519,6 +522,8 @@ class CompileState:
plugins = {}
+ _ambiguous_table_name_map: Optional[_AmbiguousTableNameMap]
+
@classmethod
def create_for_statement(cls, statement, compiler, **kw):
# factory construction.