mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +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:
|
def data(self) -> bytes:
|
||||||
return self.in_memory_data.getvalue()
|
return self.in_memory_data.getvalue()
|
||||||
|
|
||||||
def __enter__(self) -> "InMemoryZipFile":
|
def __enter__(self) -> InMemoryZipFile:
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:
|
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._extension_schema: Optional[bytes] = None
|
||||||
self._zip_file = self._load_zip_file()
|
self._zip_file = self._load_zip_file()
|
||||||
|
|
||||||
def __enter__(self) -> "BcfXml":
|
def __enter__(self) -> BcfXml:
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, *args: Any) -> None:
|
def __exit__(self, *args: Any) -> None:
|
||||||
@@ -149,7 +149,7 @@ class BcfXml:
|
|||||||
return topics
|
return topics
|
||||||
|
|
||||||
@classmethod
|
@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.
|
Create a BcfXml object from a file.
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ class BcfXml:
|
|||||||
cls,
|
cls,
|
||||||
project_name: Optional[str] = None,
|
project_name: Optional[str] = None,
|
||||||
xml_handler: Optional[AbstractXmlParserSerializer] = None,
|
xml_handler: Optional[AbstractXmlParserSerializer] = None,
|
||||||
) -> "BcfXml":
|
) -> BcfXml:
|
||||||
"""
|
"""
|
||||||
Create a new BcfXml object.
|
Create a new BcfXml object.
|
||||||
|
|
||||||
@@ -262,7 +262,7 @@ class BcfXml:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# region Deprecated methods
|
# region Deprecated methods
|
||||||
def new_project(self) -> "BcfXml":
|
def new_project(self) -> BcfXml:
|
||||||
"""Deprecated method."""
|
"""Deprecated method."""
|
||||||
warnings.warn("new_project is deprecated, use create_new instead.", DeprecationWarning)
|
warnings.warn("new_project is deprecated, use create_new instead.", DeprecationWarning)
|
||||||
return self.create_new()
|
return self.create_new()
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class TopicHandler:
|
|||||||
topic_type: str = "",
|
topic_type: str = "",
|
||||||
topic_status: str = "",
|
topic_status: str = "",
|
||||||
xml_handler: Optional[AbstractXmlParserSerializer] = None,
|
xml_handler: Optional[AbstractXmlParserSerializer] = None,
|
||||||
) -> "TopicHandler":
|
) -> TopicHandler:
|
||||||
"""
|
"""
|
||||||
Create a new BCF topic.
|
Create a new BCF topic.
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class BcfXml:
|
|||||||
self._documents: Optional[DocumentsHandler] = None
|
self._documents: Optional[DocumentsHandler] = None
|
||||||
self._zip_file = self._load_zip_file()
|
self._zip_file = self._load_zip_file()
|
||||||
|
|
||||||
def __enter__(self) -> "BcfXml":
|
def __enter__(self) -> BcfXml:
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, *args: Any) -> None:
|
def __exit__(self, *args: Any) -> None:
|
||||||
@@ -117,7 +117,7 @@ class BcfXml:
|
|||||||
return self._documents
|
return self._documents
|
||||||
|
|
||||||
@classmethod
|
@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.
|
Create a BcfXml object from a file.
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ class BcfXml:
|
|||||||
project_name: Optional[str] = None,
|
project_name: Optional[str] = None,
|
||||||
extensions: Optional[mdl.Extensions] = None,
|
extensions: Optional[mdl.Extensions] = None,
|
||||||
xml_handler: Optional[AbstractXmlParserSerializer] = None,
|
xml_handler: Optional[AbstractXmlParserSerializer] = None,
|
||||||
) -> "BcfXml":
|
) -> BcfXml:
|
||||||
"""
|
"""
|
||||||
Create a new BcfXml object.
|
Create a new BcfXml object.
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ class BcfXml:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# region Deprecated methods
|
# region Deprecated methods
|
||||||
def new_project(self) -> "BcfXml":
|
def new_project(self) -> BcfXml:
|
||||||
"""Deprecated method."""
|
"""Deprecated method."""
|
||||||
warnings.warn("new_project is deprecated, use create_new instead.", DeprecationWarning)
|
warnings.warn("new_project is deprecated, use create_new instead.", DeprecationWarning)
|
||||||
return self.create_new()
|
return self.create_new()
|
||||||
|
|||||||
@@ -92,12 +92,12 @@ class TopicHandler:
|
|||||||
self._bim_snippet = value
|
self._bim_snippet = value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def viewpoints(self) -> dict[str, "VisualizationInfoHandler"]:
|
def viewpoints(self) -> dict[str, VisualizationInfoHandler]:
|
||||||
if self._viewpoints is None:
|
if self._viewpoints is None:
|
||||||
self._viewpoints = self._load_viewpoints()
|
self._viewpoints = self._load_viewpoints()
|
||||||
return self._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):
|
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 VisualizationInfoHandler.from_topic_viewpoints(self._topic_dir, viewpoints)
|
||||||
return {}
|
return {}
|
||||||
@@ -140,7 +140,7 @@ class TopicHandler:
|
|||||||
topic_type: str = "",
|
topic_type: str = "",
|
||||||
topic_status: str = "",
|
topic_status: str = "",
|
||||||
xml_handler: Optional[AbstractXmlParserSerializer] = None,
|
xml_handler: Optional[AbstractXmlParserSerializer] = None,
|
||||||
) -> "TopicHandler":
|
) -> TopicHandler:
|
||||||
"""
|
"""
|
||||||
Create a new BCF topic.
|
Create a new BCF topic.
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ T = TypeVar("T")
|
|||||||
|
|
||||||
class Bcf(bonsai.core.tool.Bcf):
|
class Bcf(bonsai.core.tool.Bcf):
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_bcf_props(cls) -> "BCFProperties":
|
def get_bcf_props(cls) -> BCFProperties:
|
||||||
return bpy.context.scene.BCFProperties
|
return bpy.context.scene.BCFProperties
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class Cost(bonsai.core.tool.Cost):
|
|||||||
RELATED_OBJECT_TYPE = Literal["PRODUCT", "PROCESS", "RESOURCE"]
|
RELATED_OBJECT_TYPE = Literal["PRODUCT", "PROCESS", "RESOURCE"]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_cost_props(cls) -> "BIMCostProperties":
|
def get_cost_props(cls) -> BIMCostProperties:
|
||||||
return bpy.context.scene.BIMCostProperties
|
return bpy.context.scene.BIMCostProperties
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class PsetTemplate(bonsai.core.tool.PsetTemplate):
|
|||||||
PSET_TEMPLATE_LOCATION = Literal["Global Pset Template", "Project Pset Template"]
|
PSET_TEMPLATE_LOCATION = Literal["Global Pset Template", "Project Pset Template"]
|
||||||
|
|
||||||
@classmethod
|
@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
|
:return: List of pset template files. Each template file is represented
|
||||||
by a tuple of the filepath and pset template location source.
|
by a tuple of the filepath and pset template location source.
|
||||||
|
|||||||
@@ -714,7 +714,7 @@ class file:
|
|||||||
except:
|
except:
|
||||||
pass # Header is invalid
|
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.
|
"""Write ifc model to file.
|
||||||
|
|
||||||
:param format: Force use of a specific format. Guessed from file name
|
:param format: Force use of a specific format. Guessed from file name
|
||||||
@@ -765,11 +765,11 @@ class file:
|
|||||||
return
|
return
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_string(s: str) -> "file":
|
def from_string(s: str) -> file:
|
||||||
return file(ifcopenshell_wrapper.read(s))
|
return file(ifcopenshell_wrapper.read(s))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_pointer(v) -> "file":
|
def from_pointer(v) -> file:
|
||||||
return file_dict.get(v)()
|
return file_dict.get(v)()
|
||||||
|
|
||||||
def to_string(self) -> str:
|
def to_string(self) -> str:
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ class tree(ifcopenshell_wrapper.tree):
|
|||||||
def select(
|
def select(
|
||||||
self,
|
self,
|
||||||
value: Union[
|
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,
|
**kwargs,
|
||||||
) -> list[entity_instance]:
|
) -> list[entity_instance]:
|
||||||
|
|||||||
Reference in New Issue
Block a user