lol
This commit is contained in:
@@ -1434,9 +1434,9 @@ class _ClassScanMapperConfig(_MapperConfig):
|
||||
cls, "_sa_decl_prepare_nocascade", strict=True
|
||||
)
|
||||
|
||||
allow_unmapped_annotations = self.allow_unmapped_annotations
|
||||
expect_annotations_wo_mapped = (
|
||||
self.allow_unmapped_annotations
|
||||
or self.is_dataclass_prior_to_mapping
|
||||
allow_unmapped_annotations or self.is_dataclass_prior_to_mapping
|
||||
)
|
||||
|
||||
look_for_dataclass_things = bool(self.dataclass_setup_arguments)
|
||||
@@ -1531,7 +1531,15 @@ class _ClassScanMapperConfig(_MapperConfig):
|
||||
# Mapped[] etc. were not used. If annotation is None,
|
||||
# do declarative_scan so that the property can raise
|
||||
# for required
|
||||
if mapped_container is not None or annotation is None:
|
||||
if (
|
||||
mapped_container is not None
|
||||
or annotation is None
|
||||
# issue #10516: need to do declarative_scan even with
|
||||
# a non-Mapped annotation if we are doing
|
||||
# __allow_unmapped__, for things like col.name
|
||||
# assignment
|
||||
or allow_unmapped_annotations
|
||||
):
|
||||
try:
|
||||
value.declarative_scan(
|
||||
self,
|
||||
@@ -1609,7 +1617,7 @@ class _ClassScanMapperConfig(_MapperConfig):
|
||||
setattr(cls, k, value)
|
||||
continue
|
||||
|
||||
our_stuff[k] = value # type: ignore
|
||||
our_stuff[k] = value
|
||||
|
||||
def _extract_declared_columns(self) -> None:
|
||||
our_stuff = self.properties
|
||||
@@ -1979,7 +1987,7 @@ class _DeferredMapperConfig(_ClassScanMapperConfig):
|
||||
|
||||
# mypy disallows plain property override of variable
|
||||
@property # type: ignore
|
||||
def cls(self) -> Type[Any]: # type: ignore
|
||||
def cls(self) -> Type[Any]:
|
||||
return self._cls() # type: ignore
|
||||
|
||||
@cls.setter
|
||||
@@ -1999,7 +2007,7 @@ class _DeferredMapperConfig(_ClassScanMapperConfig):
|
||||
@classmethod
|
||||
def raise_unmapped_for_cls(cls, class_: Type[Any]) -> NoReturn:
|
||||
if hasattr(class_, "_sa_raise_deferred_config"):
|
||||
class_._sa_raise_deferred_config() # type: ignore
|
||||
class_._sa_raise_deferred_config()
|
||||
|
||||
raise orm_exc.UnmappedClassError(
|
||||
class_,
|
||||
|
||||
Reference in New Issue
Block a user