From 4999784664b9e73204474dd3dd91ee60fd174e3e Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 9 Jan 2022 11:49:02 -0500 Subject: Initial ORM typing layout introduces: 1. new mapped_column() helper 2. DeclarativeBase helper 3. declared_attr has been re-typed 4. rework of Mapped[] to return InstrumentedAtribute for class get, so works without Mapped itself having expression methods 5. ORM constructs now generic on [_T] also includes some early typing work, most of which will be in later commits: 1. URL and History become typing.NamedTuple 2. come up with type-checking friendly way of type checking cy extensions, where type checking will be applied to the py versions, just needed to come up with a succinct conditional pattern for the imports References: #6810 References: #7535 References: #7562 Change-Id: Ie5d9a44631626c021d130ca4ce395aba623c71fb --- lib/sqlalchemy/engine/row.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/sqlalchemy/engine/row.py') diff --git a/lib/sqlalchemy/engine/row.py b/lib/sqlalchemy/engine/row.py index 39c69c2ff..16215ccc4 100644 --- a/lib/sqlalchemy/engine/row.py +++ b/lib/sqlalchemy/engine/row.py @@ -7,21 +7,21 @@ """Define row constructs including :class:`.Row`.""" - import collections.abc as collections_abc import operator +import typing from ..sql import util as sql_util +from ..util._has_cy import HAS_CYEXTENSION - -try: - from sqlalchemy.cyextension.resultproxy import BaseRow - from sqlalchemy.cyextension.resultproxy import KEY_INTEGER_ONLY - from sqlalchemy.cyextension.resultproxy import KEY_OBJECTS_ONLY -except ImportError: +if typing.TYPE_CHECKING or not HAS_CYEXTENSION: from ._py_row import BaseRow from ._py_row import KEY_INTEGER_ONLY from ._py_row import KEY_OBJECTS_ONLY +else: + from sqlalchemy.cyextension.resultproxy import BaseRow + from sqlalchemy.cyextension.resultproxy import KEY_INTEGER_ONLY + from sqlalchemy.cyextension.resultproxy import KEY_OBJECTS_ONLY class Row(BaseRow, collections_abc.Sequence): -- cgit v1.2.1