mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Fix Ruff UP037 (quoted-annotation)
https://docs.astral.sh/ruff/rules/quoted-annotation/
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -153,7 +153,7 @@ class TopicHandler:
|
||||
topic_type: str = "",
|
||||
topic_status: str = "",
|
||||
xml_handler: Optional[AbstractXmlParserSerializer] = None,
|
||||
) -> "TopicHandler":
|
||||
) -> TopicHandler:
|
||||
"""
|
||||
Create a new BCF topic.
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user