diff --git a/src/bonsai/bonsai/__init__.py b/src/bonsai/bonsai/__init__.py index c6ec6405c0..e5a306a3b5 100644 --- a/src/bonsai/bonsai/__init__.py +++ b/src/bonsai/bonsai/__init__.py @@ -179,7 +179,7 @@ def format_debug_info(info: dict[str, Any]) -> str: return text.strip() -def get_binaries(path: Path) -> Generator[Path, None, None]: +def get_binaries(path: Path) -> Generator[Path]: yield from path.glob("**/*.pyd") yield from path.glob("**/*.dll") # pyradiance is using .so files on windows for some reason. diff --git a/src/bonsai/bonsai/tool/array.py b/src/bonsai/bonsai/tool/array.py index 1b8c2a4f22..7a1a46e1ac 100644 --- a/src/bonsai/bonsai/tool/array.py +++ b/src/bonsai/bonsai/tool/array.py @@ -94,9 +94,7 @@ class Array(bonsai.core.tool.Array): return array_objects @classmethod - def get_all_children_objects( - cls, parent_element: ifcopenshell.entity_instance - ) -> Generator[bpy.types.Object, None, None]: + def get_all_children_objects(cls, parent_element: ifcopenshell.entity_instance) -> Generator[bpy.types.Object]: for array_modifier in cls.get_modifiers_data(parent_element): yield from cls.get_children_objects(array_modifier) @@ -128,12 +126,12 @@ class Array(bonsai.core.tool.Array): return tool.Ifc.get_object(parent_element) @classmethod - def get_modifiers_data(cls, parent_element: ifcopenshell.entity_instance) -> Generator[dict[str, Any], None, None]: + def get_modifiers_data(cls, parent_element: ifcopenshell.entity_instance) -> Generator[dict[str, Any]]: array_pset = ifcopenshell.util.element.get_pset(parent_element, "BBIM_Array") yield from json.loads(array_pset["Data"]) @classmethod - def get_children_objects(cls, modifier_data: dict[str, Any]) -> Generator[bpy.types.Object, None, None]: + def get_children_objects(cls, modifier_data: dict[str, Any]) -> Generator[bpy.types.Object]: child_guid: str for child_guid in modifier_data["children"]: child_obj = tool.Blender.get_object_from_guid(child_guid) diff --git a/src/bonsai/bonsai/tool/blender.py b/src/bonsai/bonsai/tool/blender.py index 825f8e18b1..fbd9ab67c0 100644 --- a/src/bonsai/bonsai/tool/blender.py +++ b/src/bonsai/bonsai/tool/blender.py @@ -2161,7 +2161,7 @@ class Blender(bonsai.core.tool.Blender): return cls.get_internal_data_dir() / relative_path @classmethod - def get_data_dir_paths(cls, relative_dir_path: Union[str, Path], glob_pattern: str) -> Generator[Path, None, None]: + def get_data_dir_paths(cls, relative_dir_path: str | Path, glob_pattern: str) -> Generator[Path]: """Return paths based on glob pattern from the provided path in data folder. Return paths from internal data folder first and then paths from the user data folder (if it exists).""" custom_path = cls.get_user_data_dir() / relative_dir_path @@ -2681,7 +2681,7 @@ class Blender(bonsai.core.tool.Blender): @classmethod @contextlib.contextmanager - def bonsai_crash_txt(cls, s: str = "") -> Generator[Path, Any, None]: + def bonsai_crash_txt(cls, s: str = "") -> Generator[Path, Any]: """Create a temporary bonsai.crash.txt file the with current traceback. Useful in case Blender crash might occur too unexpectedly (e.g. #6686), diff --git a/src/bonsai/bonsai/tool/cost.py b/src/bonsai/bonsai/tool/cost.py index a0ee797e0b..ba72c52281 100644 --- a/src/bonsai/bonsai/tool/cost.py +++ b/src/bonsai/bonsai/tool/cost.py @@ -562,7 +562,7 @@ class Cost(bonsai.core.tool.Cost): @classmethod def get_schedule_cost_items( cls, cost_schedule: ifcopenshell.entity_instance - ) -> Generator[ifcopenshell.entity_instance, None, None]: + ) -> Generator[ifcopenshell.entity_instance]: return ifcopenshell.util.cost.get_schedule_cost_items(cost_schedule) @classmethod diff --git a/src/bonsai/bonsai/tool/geometry.py b/src/bonsai/bonsai/tool/geometry.py index 80365c1b8b..bc8a1097b4 100644 --- a/src/bonsai/bonsai/tool/geometry.py +++ b/src/bonsai/bonsai/tool/geometry.py @@ -150,7 +150,7 @@ class Geometry(bonsai.core.tool.Geometry): @classmethod @contextmanager - def batch_host_recut(cls) -> Generator[None, None, None]: + def batch_host_recut(cls) -> Generator[None]: """Coalesce host body work — `recut_host` and `update_host_representation` calls inside the with-block enqueue by voided element id. On the outermost exit: every host's `update_representation` runs first (writes Blender mesh @@ -2093,7 +2093,7 @@ class Geometry(bonsai.core.tool.Geometry): return use_immediate_repr @classmethod - def get_openings(cls, element: ifcopenshell.entity_instance) -> Generator[ifcopenshell.entity_instance, None, None]: + def get_openings(cls, element: ifcopenshell.entity_instance) -> Generator[ifcopenshell.entity_instance]: """Get element openings as IfcRelVoidsElements. Use `.RelatedOpeningElement` to get the opening element. diff --git a/src/bonsai/bonsai/tool/spatial.py b/src/bonsai/bonsai/tool/spatial.py index c56b236fd4..c7a0ad79a7 100644 --- a/src/bonsai/bonsai/tool/spatial.py +++ b/src/bonsai/bonsai/tool/spatial.py @@ -258,14 +258,14 @@ class Spatial(bonsai.core.tool.Spatial): ] @classmethod - def get_selected_products(cls) -> Generator[ifcopenshell.entity_instance, None, None]: + def get_selected_products(cls) -> Generator[ifcopenshell.entity_instance]: for obj in bpy.context.selected_objects: entity = tool.Ifc.get_entity(obj) if entity and entity.is_a("IfcProduct"): yield entity @classmethod - def get_selected_product_types(cls) -> Generator[ifcopenshell.entity_instance, None, None]: + def get_selected_product_types(cls) -> Generator[ifcopenshell.entity_instance]: for obj in tool.Blender.get_selected_objects(): entity = tool.Ifc.get_entity(obj) if entity and entity.is_a("IfcTypeProduct"): diff --git a/src/ifcfm/ifcfm/cobie24.py b/src/ifcfm/ifcfm/cobie24.py index ac36fb48de..f0693de529 100644 --- a/src/ifcfm/ifcfm/cobie24.py +++ b/src/ifcfm/ifcfm/cobie24.py @@ -879,7 +879,7 @@ def get_coordinate_elements(ifc_file: ifcopenshell.file) -> list[dict[str, Any]] return results -def get_coordinate_data_(element: ifcopenshell.entity_instance) -> Generator[dict[str, Any], None, None]: +def get_coordinate_data_(element: ifcopenshell.entity_instance) -> Generator[dict[str, Any]]: M_TRANSLATION = (slice(0, 3), 3) element_name = val(element.Name) element_class = element.is_a() diff --git a/src/ifcopenshell-python/ifcopenshell/file.py b/src/ifcopenshell-python/ifcopenshell/file.py index c8908ca20f..7bd00b7629 100644 --- a/src/ifcopenshell-python/ifcopenshell/file.py +++ b/src/ifcopenshell-python/ifcopenshell/file.py @@ -855,7 +855,7 @@ class file_mixin: self.transaction.unbatch() return self.unbatch() - def __iter__(self) -> Generator[ifcopenshell.entity_instance, None, None]: + def __iter__(self) -> Generator[ifcopenshell.entity_instance]: return iter(self[id] for id in self.entity_names()) def assign_header_from(self, other: ifcopenshell.file) -> None: diff --git a/src/ifcopenshell-python/ifcopenshell/geom/main.py b/src/ifcopenshell-python/ifcopenshell/geom/main.py index 8c3e426f72..c94a0e9158 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/main.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/main.py @@ -377,7 +377,7 @@ class iterator(ifcopenshell_wrapper.iterator): def get(self): return wrap_shape_creation(self.settings, ifcopenshell_wrapper.iterator.get(self)) - def __iter__(self) -> Generator[IteratorOutput, None, None]: + def __iter__(self) -> Generator[IteratorOutput]: if self.initialize(): while True: yield self.get() @@ -621,18 +621,14 @@ def map_shape(settings: settings, inst: entity_instance) -> ifcopenshell_wrapper @overload -def consume_iterator(it: iterator, with_progress: Literal[False] = False) -> Generator[IteratorOutput, None, None]: ... +def consume_iterator(it: iterator, with_progress: Literal[False] = False) -> Generator[IteratorOutput]: ... @overload -def consume_iterator( - it: iterator, with_progress: Literal[True] -) -> Generator[tuple[int, IteratorOutput], None, None]: ... +def consume_iterator(it: iterator, with_progress: Literal[True]) -> Generator[tuple[int, IteratorOutput]]: ... @overload -def consume_iterator( - it: iterator, with_progress: bool -) -> Generator[Union[IteratorOutput, tuple[int, IteratorOutput]], None, None]: ... +def consume_iterator(it: iterator, with_progress: bool) -> Generator[IteratorOutput | tuple[int, IteratorOutput]]: ... def consume_iterator( it: iterator, with_progress: bool = False -) -> Generator[Union[IteratorOutput, tuple[int, IteratorOutput]], None, None]: +) -> Generator[IteratorOutput | tuple[int, IteratorOutput]]: if it.initialize(): while True: if with_progress: @@ -656,7 +652,7 @@ def iterate( with_progress: Literal[False] = False, geometry_library: GEOMETRY_LIBRARY = "opencascade", logger=None, -) -> Generator[IteratorOutput, None, None]: ... +) -> Generator[IteratorOutput]: ... @overload def iterate( settings: settings, @@ -668,7 +664,7 @@ def iterate( with_progress: Literal[True] = True, geometry_library: GEOMETRY_LIBRARY = "opencascade", logger=None, -) -> Generator[tuple[int, IteratorOutput], None, None]: ... +) -> Generator[tuple[int, IteratorOutput]]: ... @overload def iterate( settings: settings, @@ -680,7 +676,7 @@ def iterate( with_progress: bool = False, geometry_library: GEOMETRY_LIBRARY = "opencascade", logger=None, -) -> Generator[Union[IteratorOutput, tuple[int, IteratorOutput]], None, None]: ... +) -> Generator[IteratorOutput | tuple[int, IteratorOutput]]: ... def iterate( settings: settings, file_or_filename: Union[file, str], @@ -691,7 +687,7 @@ def iterate( with_progress: bool = False, geometry_library: GEOMETRY_LIBRARY = "opencascade", logger=None, -) -> Generator[Union[IteratorOutput, tuple[int, IteratorOutput]], None, None]: +) -> Generator[IteratorOutput | tuple[int, IteratorOutput]]: """Get a geometry iterator for the provided file.""" it = iterator(settings, file_or_filename, num_threads, include, exclude, geometry_library) yield from consume_iterator(it, with_progress=with_progress) diff --git a/src/ifcopenshell-python/ifcopenshell/util/element.py b/src/ifcopenshell-python/ifcopenshell/util/element.py index 7dedb449ce..db0ef219d8 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/element.py +++ b/src/ifcopenshell-python/ifcopenshell/util/element.py @@ -1940,7 +1940,7 @@ def has_property(product: ifcopenshell.entity_instance, property_name: str) -> b return any(property_name in quantities.keys() for quantities in qtos.values()) -def get_openings(element: ifcopenshell.entity_instance) -> Generator[ifcopenshell.entity_instance, None, None]: +def get_openings(element: ifcopenshell.entity_instance) -> Generator[ifcopenshell.entity_instance]: """Get element openings as IfcRelVoidsElements. Use `.RelatedOpeningElement` to get the opening element. diff --git a/src/ifcopenshell-python/ifcopenshell/util/representation.py b/src/ifcopenshell-python/ifcopenshell/util/representation.py index f0c2b54fca..7ce2ea5d79 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/representation.py +++ b/src/ifcopenshell-python/ifcopenshell/util/representation.py @@ -118,7 +118,7 @@ def is_representation_of_context( def get_representations_iter( element: ifcopenshell.entity_instance, -) -> Generator[ifcopenshell.entity_instance, None, None]: +) -> Generator[ifcopenshell.entity_instance]: """Get an iterator with element's IfcShapeRepresentations. :param element: An IfcProduct or IfcTypeProduct @@ -341,7 +341,7 @@ def resolve_items( def resolve_base_items( representation: ifcopenshell.entity_instance, -) -> Generator[ifcopenshell.entity_instance, None, None]: +) -> Generator[ifcopenshell.entity_instance]: """Resolve representation to it's base items resolving mapped items and boolean results to it's operands.""" queue: list[ifcopenshell.entity_instance] = list(representation.Items) while queue: