summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2021-05-13 21:20:51 +0200
committerFederico Caselli <cfederico87@gmail.com>2021-05-16 11:11:10 +0200
commit71cb17c81d358646f8dfeac14e9662ce42bb94df (patch)
tree8ea3a686ffd0b9fea4fa7f91acfd8987d9369d9a /lib/sqlalchemy/orm
parent0d5508d77653b37368ff9de22307c154cc90cf71 (diff)
downloadsqlalchemy-71cb17c81d358646f8dfeac14e9662ce42bb94df.tar.gz
Remove pep484 type comments from the code
Current effort is around the stub package, and having typing in two places makes thing worse, since the types here are usually outdated compared to the version in the stubs. Once v2 gets under way we can start consolidating the types here. Fixes: #6461 Change-Id: I7132a444bd7138123074bf5bc664b4bb119a85ce
Diffstat (limited to 'lib/sqlalchemy/orm')
-rw-r--r--lib/sqlalchemy/orm/decl_api.py4
-rw-r--r--lib/sqlalchemy/orm/interfaces.py18
-rw-r--r--lib/sqlalchemy/orm/relationships.py8
-rw-r--r--lib/sqlalchemy/orm/strategy_options.py7
4 files changed, 5 insertions, 32 deletions
diff --git a/lib/sqlalchemy/orm/decl_api.py b/lib/sqlalchemy/orm/decl_api.py
index 4e2c3a886..e829de5f6 100644
--- a/lib/sqlalchemy/orm/decl_api.py
+++ b/lib/sqlalchemy/orm/decl_api.py
@@ -32,9 +32,6 @@ from ..sql.schema import MetaData
from ..util import hybridmethod
from ..util import hybridproperty
-if util.TYPE_CHECKING:
- from .mapper import Mapper
-
def has_inherited_table(cls):
"""Given a class, return True if any of the classes it inherits from has a
@@ -885,7 +882,6 @@ class registry(object):
return decorate
def map_declaratively(self, cls):
- # type: (type) -> Mapper
"""Map a class declaratively.
In this form of mapping, the class is scanned for mapping information,
diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py
index 68e1aa5cb..ed38becf7 100644
--- a/lib/sqlalchemy/orm/interfaces.py
+++ b/lib/sqlalchemy/orm/interfaces.py
@@ -41,13 +41,6 @@ from ..sql import visitors
from ..sql.base import ExecutableOption
from ..sql.traversals import HasCacheKey
-if util.TYPE_CHECKING:
- from typing import Any
- from typing import List
- from typing import Optional
-
- from .mapper import Mapper
- from .util import AliasedInsp
__all__ = (
"EXT_CONTINUE",
@@ -398,9 +391,9 @@ class PropComparator(operators.ColumnOperators):
def __init__(
self,
- prop, # type: MapperProperty
- parentmapper, # type: Mapper
- adapt_to_entity=None, # type: Optional[AliasedInsp]
+ prop,
+ parentmapper,
+ adapt_to_entity=None,
):
self.prop = self.property = prop
self._parententity = adapt_to_entity or parentmapper
@@ -409,10 +402,7 @@ class PropComparator(operators.ColumnOperators):
def __clause_element__(self):
raise NotImplementedError("%r" % self)
- def _bulk_update_tuples(
- self, value # type: (operators.ColumnOperators)
- ):
- # type: (...) -> List[tuple[operators.ColumnOperators, Any]]
+ def _bulk_update_tuples(self, value):
"""Receive a SQL expression that represents a value in the SET
clause of an UPDATE statement.
diff --git a/lib/sqlalchemy/orm/relationships.py b/lib/sqlalchemy/orm/relationships.py
index bf166e181..5d87ef797 100644
--- a/lib/sqlalchemy/orm/relationships.py
+++ b/lib/sqlalchemy/orm/relationships.py
@@ -50,12 +50,6 @@ from ..sql.util import selectables_overlap
from ..sql.util import visit_binary_product
-if util.TYPE_CHECKING:
- from typing import Union
-
- from .util import AliasedInsp
-
-
def remote(expr):
"""Annotate a portion of a primaryjoin expression
with a 'remote' annotation.
@@ -2086,7 +2080,7 @@ class RelationshipProperty(StrategizedProperty):
@util.memoized_property
@util.preload_module("sqlalchemy.orm.mapper")
- def entity(self): # type: () -> Union[AliasedInsp, mapperlib.Mapper]
+ def entity(self):
"""Return the target mapped entity, which is an inspect() of the
class or aliased class that is referred towards.
diff --git a/lib/sqlalchemy/orm/strategy_options.py b/lib/sqlalchemy/orm/strategy_options.py
index 60ae69176..e371442fd 100644
--- a/lib/sqlalchemy/orm/strategy_options.py
+++ b/lib/sqlalchemy/orm/strategy_options.py
@@ -32,12 +32,6 @@ from ..sql import visitors
from ..sql.base import _generative
from ..sql.base import Generative
-if util.TYPE_CHECKING:
- from typing import Sequence
-
- from .context import QueryContext
- from ..sql.elements import ColumnElement
-
class Load(Generative, LoaderOption):
"""Represents loader options which modify the state of a
@@ -119,7 +113,6 @@ class Load(Generative, LoaderOption):
return load
def _generate_extra_criteria(self, context):
- # type: (QueryContext) -> Sequence[ColumnElement]
"""Apply the current bound parameters in a QueryContext to the
"extra_criteria" stored with this Load object.