diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2022-01-14 22:00:11 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2022-01-14 22:00:11 +0000 |
commit | 07cd49daaadd0a0568444eaeccaa79f79cd15ffc (patch) | |
tree | ec6220fb8755c7b8f5be721c9099ab69cba5d82d /lib/sqlalchemy/orm/mapper.py | |
parent | b4fe2b83ab3ce8cee1e2f4353dfcbea515b4f8d1 (diff) | |
parent | 43f6ae639ca0186f4802255861acdc20f19e702f (diff) | |
download | sqlalchemy-07cd49daaadd0a0568444eaeccaa79f79cd15ffc.tar.gz |
Merge "initial reorganize for static typing" into main
Diffstat (limited to 'lib/sqlalchemy/orm/mapper.py')
-rw-r--r-- | lib/sqlalchemy/orm/mapper.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index dbcbc8a1b..87829d643 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -14,11 +14,13 @@ This is a semi-private module; the main configurational API of the ORM is available in :class:`~sqlalchemy.orm.`. """ - from collections import deque from functools import reduce from itertools import chain import sys +from typing import Generic +from typing import Type +from typing import TypeVar import weakref from . import attributes @@ -58,6 +60,9 @@ from ..util import HasMemoized _mapper_registries = weakref.WeakKeyDictionary() +_MC = TypeVar("_MC") + + def _all_registries(): with _CONFIGURE_MUTEX: return set(_mapper_registries) @@ -88,6 +93,7 @@ class Mapper( ORMEntityColumnsClauseRole, sql_base.MemoizedHasCacheKey, InspectionAttr, + Generic[_MC], ): """Defines an association between a Python class and a database table or other relational structure, so that ORM operations against the class may @@ -115,7 +121,7 @@ class Mapper( ) def __init__( self, - class_, + class_: Type[_MC], local_table=None, properties=None, primary_key=None, |