@@ -294,8 +294,6 @@ def generate_field_definitions(cls, model_type: type[DeclarativeBase]) -> Genera
294294
295295 Raises:
296296 RuntimeError: If the mapper cannot be found for the model type.
297- NotImplementedError: If an unsupported property or extension type is encountered.
298- ImproperConfigurationError: If a type cannot be parsed from an element.
299297 """
300298 if (mapper := inspect (model_type )) is None : # pragma: no cover # pyright: ignore[reportUnnecessaryComparison]
301299 msg = "Unexpected `None` value for mapper." # type: ignore[unreachable]
@@ -330,7 +328,7 @@ def generate_field_definitions(cls, model_type: type[DeclarativeBase]) -> Genera
330328 should_skip_descriptor = False
331329 dto_field : Optional [DTOField ] = None
332330 if hasattr (orm_descriptor , "property" ): # pyright: ignore[reportUnknownArgumentType]
333- dto_field = orm_descriptor .property .info .get (DTO_FIELD_META_KEY ) # pyright: ignore # noqa: PGH003
331+ dto_field = orm_descriptor .property .info .get (DTO_FIELD_META_KEY ) # pyright: ignore
334332
335333 # Case 1
336334 is_field_marked_not_private = dto_field and dto_field .mark is not Mark .PRIVATE # pyright: ignore[reportUnknownVariableType,reportUnknownMemberType]
@@ -370,7 +368,7 @@ def detect_nested_field(cls, field_definition: FieldDefinition) -> bool:
370368
371369def _detect_defaults (elem : ElementType ) -> tuple [Any , Any ]:
372370 default : Any = Empty
373- default_factory : Any = None # pyright:ignore # noqa: PGH003
371+ default_factory : Any = None # pyright:ignore
374372 if sqla_default := getattr (elem , "default" , None ):
375373 if sqla_default .is_scalar :
376374 default = sqla_default .arg
@@ -402,11 +400,11 @@ def parse_type_from_element(elem: ElementType, orm_descriptor: InspectionAttr) -
402400 elem: The SQLAlchemy element to parse.
403401 orm_descriptor: The attribute `elem` was extracted from.
404402
403+ Raises:
404+ ImproperConfigurationError: If the type cannot be parsed.
405+
405406 Returns:
406407 FieldDefinition: The parsed type.
407-
408- Raises:
409- ImproperlyConfiguredException: If the type cannot be parsed.
410408 """
411409
412410 if isinstance (elem , Column ):
@@ -415,7 +413,7 @@ def parse_type_from_element(elem: ElementType, orm_descriptor: InspectionAttr) -
415413 return FieldDefinition .from_annotation (elem .type .python_type )
416414
417415 if isinstance (elem , RelationshipProperty ):
418- if elem .direction in ( RelationshipDirection .ONETOMANY , RelationshipDirection .MANYTOMANY ) :
416+ if elem .direction in { RelationshipDirection .ONETOMANY , RelationshipDirection .MANYTOMANY } :
419417 collection_type = FieldDefinition .from_annotation (elem .collection_class or list ) # pyright: ignore[reportUnknownMemberType]
420418 return FieldDefinition .from_annotation (collection_type .safe_generic_origin [elem .mapper .class_ ])
421419
@@ -431,9 +429,7 @@ def parse_type_from_element(elem: ElementType, orm_descriptor: InspectionAttr) -
431429 return FieldDefinition .from_annotation (orm_descriptor .type .python_type )
432430
433431 msg = f"Unable to parse type from element '{ elem } '. Consider adding a type hint."
434- raise ImproperConfigurationError (
435- msg ,
436- )
432+ raise ImproperConfigurationError (msg )
437433
438434
439435def detect_nullable_relationship (elem : RelationshipProperty [Any ]) -> bool :
0 commit comments