]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
remove unused "descriptor" param from ColumnProperty
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 17 May 2022 18:33:05 +0000 (14:33 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 17 May 2022 18:42:41 +0000 (14:42 -0400)
this appears to be unused and wasn't documented,
even though in the method sig for column_property().
just whack it

also repairs a typing issue in decl_base that seemed
to somehow not fail previously.

Change-Id: Id5c8e716b7e53715778921ab03707642cadbfdee

lib/sqlalchemy/orm/_orm_constructors.py
lib/sqlalchemy/orm/decl_base.py
lib/sqlalchemy/orm/properties.py

index 18a18bd80075f9735b719b49e2d01ce0fdda94d2..0692cac09e5bc47de9c5ca6c86b0c34e87064afd 100644 (file)
@@ -325,7 +325,6 @@ def column_property(
     deferred: bool = False,
     raiseload: bool = False,
     comparator_factory: Optional[Type[PropComparator[_T]]] = None,
-    descriptor: Optional[Any] = None,
     active_history: bool = False,
     expire_on_flush: bool = True,
     info: Optional[_InfoType] = None,
@@ -387,7 +386,7 @@ def column_property(
         flush, that is, has any kind of "dirty" state within a flush.
         Setting this parameter to ``False`` will have the effect of
         leaving any existing value present after the flush proceeds.
-        Note however that the :class:`.Session` with default expiration
+        Note that the :class:`.Session` with default expiration
         settings still expires
         all attributes after a :meth:`.Session.commit` call, however.
 
@@ -421,7 +420,6 @@ def column_property(
         deferred=deferred,
         raiseload=raiseload,
         comparator_factory=comparator_factory,
-        descriptor=descriptor,
         active_history=active_history,
         expire_on_flush=expire_on_flush,
         info=info,
index 6bd957de17c821aea2853d6dff8d841a45ccdd78..a66421e2250c599c76660aacb8a315f1977ccafb 100644 (file)
@@ -19,6 +19,7 @@ from typing import List
 from typing import Mapping
 from typing import NoReturn
 from typing import Optional
+from typing import Sequence
 from typing import Tuple
 from typing import Type
 from typing import TYPE_CHECKING
@@ -63,6 +64,7 @@ if TYPE_CHECKING:
     from ._typing import _RegistryType
     from .decl_api import declared_attr
     from .instrumentation import ClassManager
+    from ..sql.elements import NamedColumn
     from ..sql.schema import MetaData
     from ..sql.selectable import FromClause
 
@@ -228,7 +230,12 @@ class _MapperConfig:
 
     cls: Type[Any]
     classname: str
-    properties: util.OrderedDict[str, MapperProperty[Any]]
+    properties: util.OrderedDict[
+        str,
+        Union[
+            Sequence[NamedColumn[Any]], NamedColumn[Any], MapperProperty[Any]
+        ],
+    ]
     declared_attr_reg: Dict[declared_attr[Any], Any]
 
     @classmethod
index 911617d6d0e1432acc763b97c2a4677ff8a67182..ad3e9f248ddfbb37a444d7b5af3d687cc3255fa9 100644 (file)
@@ -116,7 +116,6 @@ class ColumnProperty(
         "deferred",
         "instrument",
         "comparator_factory",
-        "descriptor",
         "active_history",
         "expire_on_flush",
         "_creation_order",
@@ -136,7 +135,6 @@ class ColumnProperty(
         deferred: bool = False,
         raiseload: bool = False,
         comparator_factory: Optional[Type[PropComparator[_T]]] = None,
-        descriptor: Optional[Any] = None,
         active_history: bool = False,
         expire_on_flush: bool = True,
         info: Optional[_InfoType] = None,
@@ -163,7 +161,6 @@ class ColumnProperty(
             if comparator_factory is not None
             else self.__class__.Comparator
         )
-        self.descriptor = descriptor
         self.active_history = active_history
         self.expire_on_flush = expire_on_flush