From a42a95adcb1b0d717c10eb4b0f62040c97328b68 Mon Sep 17 00:00:00 2001 From: Andrej Date: Wed, 28 May 2025 15:03:40 +0500 Subject: [PATCH] Fix Ruff UP037 (quoted-annotation) https://docs.astral.sh/ruff/rules/quoted-annotation/ --- src/bcf/bcf/inmemory_zipfile.py | 2 +- src/bcf/bcf/v2/bcfxml.py | 8 ++++---- src/bcf/bcf/v2/topic.py | 2 +- src/bcf/bcf/v3/bcfxml.py | 8 ++++---- src/bcf/bcf/v3/topic.py | 6 +++--- src/bonsai/bonsai/tool/bcf.py | 2 +- src/bonsai/bonsai/tool/cost.py | 2 +- src/bonsai/bonsai/tool/pset_template.py | 2 +- src/ifcopenshell-python/ifcopenshell/file.py | 6 +++--- src/ifcopenshell-python/ifcopenshell/geom/main.py | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/bcf/bcf/inmemory_zipfile.py b/src/bcf/bcf/inmemory_zipfile.py index bce11fc9d9..8bcbbc6cf8 100644 --- a/src/bcf/bcf/inmemory_zipfile.py +++ b/src/bcf/bcf/inmemory_zipfile.py @@ -48,7 +48,7 @@ class InMemoryZipFile: def data(self) -> bytes: return self.in_memory_data.getvalue() - def __enter__(self) -> "InMemoryZipFile": + def __enter__(self) -> InMemoryZipFile: return self def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: diff --git a/src/bcf/bcf/v2/bcfxml.py b/src/bcf/bcf/v2/bcfxml.py index c36a9f63e3..d94552b41f 100644 --- a/src/bcf/bcf/v2/bcfxml.py +++ b/src/bcf/bcf/v2/bcfxml.py @@ -32,7 +32,7 @@ class BcfXml: self._extension_schema: Optional[bytes] = None self._zip_file = self._load_zip_file() - def __enter__(self) -> "BcfXml": + def __enter__(self) -> BcfXml: return self def __exit__(self, *args: Any) -> None: @@ -149,7 +149,7 @@ class BcfXml: return topics @classmethod - def load(cls, filename: Path, xml_handler: Optional[AbstractXmlParserSerializer] = None) -> Optional["BcfXml"]: + def load(cls, filename: Path, xml_handler: Optional[AbstractXmlParserSerializer] = None) -> Optional[BcfXml]: """ Create a BcfXml object from a file. @@ -173,7 +173,7 @@ class BcfXml: cls, project_name: Optional[str] = None, xml_handler: Optional[AbstractXmlParserSerializer] = None, - ) -> "BcfXml": + ) -> BcfXml: """ Create a new BcfXml object. @@ -262,7 +262,7 @@ class BcfXml: ) # region Deprecated methods - def new_project(self) -> "BcfXml": + def new_project(self) -> BcfXml: """Deprecated method.""" warnings.warn("new_project is deprecated, use create_new instead.", DeprecationWarning) return self.create_new() diff --git a/src/bcf/bcf/v2/topic.py b/src/bcf/bcf/v2/topic.py index bb55e36657..7ea1c89772 100644 --- a/src/bcf/bcf/v2/topic.py +++ b/src/bcf/bcf/v2/topic.py @@ -153,7 +153,7 @@ class TopicHandler: topic_type: str = "", topic_status: str = "", xml_handler: Optional[AbstractXmlParserSerializer] = None, - ) -> "TopicHandler": + ) -> TopicHandler: """ Create a new BCF topic. diff --git a/src/bcf/bcf/v3/bcfxml.py b/src/bcf/bcf/v3/bcfxml.py index 3219bf58b2..872efe5db9 100644 --- a/src/bcf/bcf/v3/bcfxml.py +++ b/src/bcf/bcf/v3/bcfxml.py @@ -31,7 +31,7 @@ class BcfXml: self._documents: Optional[DocumentsHandler] = None self._zip_file = self._load_zip_file() - def __enter__(self) -> "BcfXml": + def __enter__(self) -> BcfXml: return self def __exit__(self, *args: Any) -> None: @@ -117,7 +117,7 @@ class BcfXml: return self._documents @classmethod - def load(cls, filename: Path, xml_handler: Optional[AbstractXmlParserSerializer] = None) -> Optional["BcfXml"]: + def load(cls, filename: Path, xml_handler: Optional[AbstractXmlParserSerializer] = None) -> Optional[BcfXml]: """ Create a BcfXml object from a file. @@ -142,7 +142,7 @@ class BcfXml: project_name: Optional[str] = None, extensions: Optional[mdl.Extensions] = None, xml_handler: Optional[AbstractXmlParserSerializer] = None, - ) -> "BcfXml": + ) -> BcfXml: """ Create a new BcfXml object. @@ -240,7 +240,7 @@ class BcfXml: ) # region Deprecated methods - def new_project(self) -> "BcfXml": + def new_project(self) -> BcfXml: """Deprecated method.""" warnings.warn("new_project is deprecated, use create_new instead.", DeprecationWarning) return self.create_new() diff --git a/src/bcf/bcf/v3/topic.py b/src/bcf/bcf/v3/topic.py index 613bd24073..38fea3de7e 100644 --- a/src/bcf/bcf/v3/topic.py +++ b/src/bcf/bcf/v3/topic.py @@ -92,12 +92,12 @@ class TopicHandler: self._bim_snippet = value @property - def viewpoints(self) -> dict[str, "VisualizationInfoHandler"]: + def viewpoints(self) -> dict[str, VisualizationInfoHandler]: if self._viewpoints is None: self._viewpoints = self._load_viewpoints() return self._viewpoints - def _load_viewpoints(self) -> dict[str, "VisualizationInfoHandler"]: + def _load_viewpoints(self) -> dict[str, VisualizationInfoHandler]: if self._topic_dir and self.topic.viewpoints and (viewpoints := self.topic.viewpoints.view_point): return VisualizationInfoHandler.from_topic_viewpoints(self._topic_dir, viewpoints) return {} @@ -140,7 +140,7 @@ class TopicHandler: topic_type: str = "", topic_status: str = "", xml_handler: Optional[AbstractXmlParserSerializer] = None, - ) -> "TopicHandler": + ) -> TopicHandler: """ Create a new BCF topic. diff --git a/src/bonsai/bonsai/tool/bcf.py b/src/bonsai/bonsai/tool/bcf.py index c427a22e90..b67a5a98db 100644 --- a/src/bonsai/bonsai/tool/bcf.py +++ b/src/bonsai/bonsai/tool/bcf.py @@ -44,7 +44,7 @@ T = TypeVar("T") class Bcf(bonsai.core.tool.Bcf): @classmethod - def get_bcf_props(cls) -> "BCFProperties": + def get_bcf_props(cls) -> BCFProperties: return bpy.context.scene.BCFProperties @classmethod diff --git a/src/bonsai/bonsai/tool/cost.py b/src/bonsai/bonsai/tool/cost.py index f36ccba653..ef01feea9c 100644 --- a/src/bonsai/bonsai/tool/cost.py +++ b/src/bonsai/bonsai/tool/cost.py @@ -40,7 +40,7 @@ class Cost(bonsai.core.tool.Cost): RELATED_OBJECT_TYPE = Literal["PRODUCT", "PROCESS", "RESOURCE"] @classmethod - def get_cost_props(cls) -> "BIMCostProperties": + def get_cost_props(cls) -> BIMCostProperties: return bpy.context.scene.BIMCostProperties @classmethod diff --git a/src/bonsai/bonsai/tool/pset_template.py b/src/bonsai/bonsai/tool/pset_template.py index 8977d1e32c..da34e99b82 100644 --- a/src/bonsai/bonsai/tool/pset_template.py +++ b/src/bonsai/bonsai/tool/pset_template.py @@ -124,7 +124,7 @@ class PsetTemplate(bonsai.core.tool.PsetTemplate): PSET_TEMPLATE_LOCATION = Literal["Global Pset Template", "Project Pset Template"] @classmethod - def get_pset_template_files(cls) -> list[tuple[Path, "PSET_TEMPLATE_LOCATION"]]: + def get_pset_template_files(cls) -> list[tuple[Path, PSET_TEMPLATE_LOCATION]]: """ :return: List of pset template files. Each template file is represented by a tuple of the filepath and pset template location source. diff --git a/src/ifcopenshell-python/ifcopenshell/file.py b/src/ifcopenshell-python/ifcopenshell/file.py index 2a00b284b3..f617f32d9e 100644 --- a/src/ifcopenshell-python/ifcopenshell/file.py +++ b/src/ifcopenshell-python/ifcopenshell/file.py @@ -714,7 +714,7 @@ class file: except: pass # Header is invalid - def write(self, path: "os.PathLike | str", format: Optional[str] = None, zipped: bool = False) -> None: + def write(self, path: os.PathLike | str, format: Optional[str] = None, zipped: bool = False) -> None: """Write ifc model to file. :param format: Force use of a specific format. Guessed from file name @@ -765,11 +765,11 @@ class file: return @staticmethod - def from_string(s: str) -> "file": + def from_string(s: str) -> file: return file(ifcopenshell_wrapper.read(s)) @staticmethod - def from_pointer(v) -> "file": + def from_pointer(v) -> file: return file_dict.get(v)() def to_string(self) -> str: diff --git a/src/ifcopenshell-python/ifcopenshell/geom/main.py b/src/ifcopenshell-python/ifcopenshell/geom/main.py index edebc2c206..9e454ed724 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/main.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/main.py @@ -365,7 +365,7 @@ class tree(ifcopenshell_wrapper.tree): def select( self, value: Union[ - entity_instance, ifcopenshell_wrapper.BRepElement, tuple[float, float, float], "TopoDS.TopoDS_Shape" + entity_instance, ifcopenshell_wrapper.BRepElement, tuple[float, float, float], TopoDS.TopoDS_Shape ], **kwargs, ) -> list[entity_instance]: