From 74c842a478a746dd9e79a5d5294fcecc0a065718 Mon Sep 17 00:00:00 2001 From: armandobelardo Date: Tue, 10 Sep 2024 14:58:48 -0400 Subject: [PATCH] precommit --- .../generators/context/pydantic_generator_context_impl.py | 7 ++----- .../generators/pydantic_model/fern_aware_pydantic_model.py | 4 +++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/generators/python/src/fern_python/generators/context/pydantic_generator_context_impl.py b/generators/python/src/fern_python/generators/context/pydantic_generator_context_impl.py index 55a3103041e..794932b143e 100644 --- a/generators/python/src/fern_python/generators/context/pydantic_generator_context_impl.py +++ b/generators/python/src/fern_python/generators/context/pydantic_generator_context_impl.py @@ -55,10 +55,7 @@ def __init__( self._non_union_types_with_self_referencing_dependencies = set() for id, type in self.ir.types.items(): - if ( - type.shape.get_as_union().type != "union" - and type.shape.get_as_union().type != "undiscriminatedUnion" - ): + if type.shape.get_as_union().type != "union" and type.shape.get_as_union().type != "undiscriminatedUnion": for referenced_id in type.referenced_types: referenced_type = self.ir.types[referenced_id] # This referenced type is self-referential @@ -158,7 +155,7 @@ def does_circularly_reference_itself(self, type_id: ir_types.TypeId) -> bool: def get_non_union_circular_references(self) -> Set[ir_types.TypeId]: return self._non_union_self_referencing_type_ids - + def get_non_union_types_with_self_referencing_dependencies(self) -> Set[ir_types.TypeId]: return self._non_union_types_with_self_referencing_dependencies diff --git a/generators/python/src/fern_python/generators/pydantic_model/fern_aware_pydantic_model.py b/generators/python/src/fern_python/generators/pydantic_model/fern_aware_pydantic_model.py index 0db4e4a9751..5ac220a4ec8 100644 --- a/generators/python/src/fern_python/generators/pydantic_model/fern_aware_pydantic_model.py +++ b/generators/python/src/fern_python/generators/pydantic_model/fern_aware_pydantic_model.py @@ -192,7 +192,9 @@ def _must_import_after_current_declaration(self, type_name: ir_types.DeclaredTyp type_id=type_name.type_id, other_type_id=type_id_to_reference ) - is_referencing_circular_reference = type_name.type_id in self._context.get_non_union_types_with_self_referencing_dependencies() + is_referencing_circular_reference = ( + type_name.type_id in self._context.get_non_union_types_with_self_referencing_dependencies() + ) if is_referencing_circular_reference: should_import_after = is_referencing_circular_reference