mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 06:00:51 +00:00
Fix Ruff UP006 (deprecated annotation symbols)
This commit is contained in:
@@ -34,7 +34,7 @@ import bonsai.tool as tool
|
||||
from ifcopenshell.file import UndoSystemError
|
||||
from pathlib import Path
|
||||
from bonsai.tool.brick import BrickStore
|
||||
from typing import Set, Union, Optional, TypedDict, Callable, NotRequired, Literal
|
||||
from typing import Union, Optional, TypedDict, Callable, NotRequired, Literal
|
||||
|
||||
|
||||
IFC_CONNECTED_TYPE = Union[bpy.types.Material, bpy.types.Object]
|
||||
@@ -69,7 +69,7 @@ class IfcStore:
|
||||
cache_path: Optional[str] = None
|
||||
id_map: dict[int, IFC_CONNECTED_TYPE] = {}
|
||||
guid_map: dict[str, IFC_CONNECTED_TYPE] = {}
|
||||
edited_objs: Set[bpy.types.Object] = set()
|
||||
edited_objs: set[bpy.types.Object] = set()
|
||||
pset_template_path: str = ""
|
||||
pset_template_file: Optional[ifcopenshell.file] = None
|
||||
classification_path: str = ""
|
||||
|
||||
@@ -38,7 +38,7 @@ import ifcopenshell.util.shape
|
||||
import bonsai.tool as tool
|
||||
from bonsai.bim.ifc import IfcStore, IFC_CONNECTED_TYPE
|
||||
from bonsai.tool.loader import OBJECT_DATA_TYPE
|
||||
from typing import Dict, Union, Optional, Any, Literal, Iterable
|
||||
from typing import Union, Optional, Any, Literal, Iterable
|
||||
from ifcopenshell.util.shape import MatrixType
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class MaterialCreator:
|
||||
obj: bpy.types.Object
|
||||
|
||||
def __init__(self, ifc_import_settings: IfcImportSettings, ifc_importer: IfcImporter):
|
||||
self.styles: Dict[int, bpy.types.Material] = {}
|
||||
self.styles: dict[int, bpy.types.Material] = {}
|
||||
self.parsed_meshes: set[str] = set()
|
||||
self.ifc_import_settings = ifc_import_settings
|
||||
self.ifc_importer = ifc_importer
|
||||
|
||||
@@ -38,7 +38,7 @@ from bonsai.bim.module.drawing.shaders import add_verts_sequence, add_offsets
|
||||
from bonsai.bim.module.drawing.helper import format_distance
|
||||
from timeit import default_timer as timer
|
||||
from functools import cache
|
||||
from typing import Optional, Iterator, Type, Union
|
||||
from typing import Optional, Iterator, Union
|
||||
|
||||
UNSPECIAL_ELEMENT_COLOR = (0.2, 0.2, 0.2, 1) # GREY
|
||||
|
||||
@@ -1895,7 +1895,7 @@ class CutDecorator:
|
||||
|
||||
|
||||
class DecorationsHandler:
|
||||
decorators_classes: list[Type[BaseDecorator]] = [
|
||||
decorators_classes: list[type[BaseDecorator]] = [
|
||||
DimensionDecorator,
|
||||
AngleDecorator,
|
||||
GridDecorator,
|
||||
|
||||
@@ -49,7 +49,7 @@ import bonsai.bim.export_ifc
|
||||
from bpy_extras.io_utils import ImportHelper
|
||||
from bonsai.bim.module.drawing.decoration import CutDecorator
|
||||
from bonsai.bim.module.drawing.data import DecoratorData
|
||||
from typing import NamedTuple, List, Union, Optional, Literal, TYPE_CHECKING, Any, TypedDict
|
||||
from typing import NamedTuple, Union, Optional, Literal, TYPE_CHECKING, Any, TypedDict
|
||||
from lxml import etree
|
||||
from math import radians
|
||||
from mathutils import Vector, Color, Matrix
|
||||
@@ -83,8 +83,8 @@ class profile:
|
||||
|
||||
|
||||
class LineworkContexts(NamedTuple):
|
||||
body: List[List[int]]
|
||||
annotation: List[List[int]]
|
||||
body: list[list[int]]
|
||||
annotation: list[list[int]]
|
||||
|
||||
|
||||
class AddAnnotationType(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
@@ -42,7 +42,7 @@ from mathutils import Vector, Euler
|
||||
from math import radians
|
||||
from pathlib import Path
|
||||
from collections import namedtuple
|
||||
from typing import List, Iterable, Union, TYPE_CHECKING
|
||||
from typing import Iterable, Union, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from bonsai.bim.prop import MultipleFileSelect
|
||||
@@ -1219,7 +1219,7 @@ class ClippingPlaneCutWithCappings(bpy.types.Operator):
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
def get_cutting_plane_data(self, cutting_planes: List[bpy.types.Object]) -> List[CuttingPlaneData]:
|
||||
def get_cutting_plane_data(self, cutting_planes: list[bpy.types.Object]) -> list[CuttingPlaneData]:
|
||||
cutting_planes_data = []
|
||||
|
||||
for obj in cutting_planes:
|
||||
@@ -1230,7 +1230,7 @@ class ClippingPlaneCutWithCappings(bpy.types.Operator):
|
||||
return cutting_planes_data
|
||||
|
||||
# NOTE: unused, will be used later for cutting boxes support
|
||||
def get_box_cutting_plane_data(self, obj: bpy.types.Object) -> List[CuttingPlaneData]:
|
||||
def get_box_cutting_plane_data(self, obj: bpy.types.Object) -> list[CuttingPlaneData]:
|
||||
matrix_world = obj.matrix_world
|
||||
rotation = matrix_world.to_quaternion() # avoid scale for normals
|
||||
cutting_planes_data = []
|
||||
|
||||
@@ -63,7 +63,6 @@ from typing import (
|
||||
Optional,
|
||||
Literal,
|
||||
Iterator,
|
||||
List,
|
||||
TYPE_CHECKING,
|
||||
get_args,
|
||||
Generator,
|
||||
@@ -1927,7 +1926,7 @@ class Geometry(bonsai.core.tool.Geometry):
|
||||
return new_item
|
||||
|
||||
@classmethod
|
||||
def split_by_loose_parts(cls, obj: bpy.types.Object) -> List[bpy.types.Mesh]:
|
||||
def split_by_loose_parts(cls, obj: bpy.types.Object) -> list[bpy.types.Mesh]:
|
||||
# Before .copy() since it also copies the selection.
|
||||
selection = tool.Blender.get_objects_selection(bpy.context)
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ from dataclasses import dataclass, field
|
||||
from lark import Lark, Transformer
|
||||
from math import degrees, radians, sin, cos, tan
|
||||
from mathutils import Vector, Matrix
|
||||
from typing import Optional, Union, Literal, List
|
||||
from typing import Optional, Union, Literal
|
||||
|
||||
|
||||
class Polyline(bonsai.core.tool.Polyline):
|
||||
@@ -41,7 +41,7 @@ class Polyline(bonsai.core.tool.Polyline):
|
||||
_Y: str = ""
|
||||
_Z: str = ""
|
||||
_AREA: str = "0"
|
||||
input_options: List[str] = field(default_factory=list)
|
||||
input_options: list[str] = field(default_factory=list)
|
||||
|
||||
def set_value(self, attribute_name, value):
|
||||
value = str(value)
|
||||
@@ -94,7 +94,7 @@ class Polyline(bonsai.core.tool.Polyline):
|
||||
input_type: "Polyline.InputType" = None
|
||||
|
||||
@classmethod
|
||||
def create_input_ui(cls, input_options: List[str] = []) -> PolylineUI:
|
||||
def create_input_ui(cls, input_options: list[str] = []) -> PolylineUI:
|
||||
return cls.PolylineUI(input_options=input_options)
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -42,7 +42,7 @@ import numpy as np
|
||||
from math import pi
|
||||
from mathutils import Vector, Matrix
|
||||
from shapely import Polygon
|
||||
from typing import Generator, Optional, Union, Literal, List, Any, Iterable, TYPE_CHECKING
|
||||
from typing import Generator, Optional, Union, Literal, Any, Iterable, TYPE_CHECKING
|
||||
from collections import defaultdict
|
||||
from natsort import natsorted
|
||||
|
||||
@@ -1267,7 +1267,7 @@ class Spatial(bonsai.core.tool.Spatial):
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def get_selected_containers(cls) -> List[ifcopenshell.entity_instance]:
|
||||
def get_selected_containers(cls) -> list[ifcopenshell.entity_instance]:
|
||||
results = []
|
||||
for obj in tool.Blender.get_selected_objects():
|
||||
if (element := tool.Ifc.get_entity(obj)) and tool.Root.is_spatial_element(element):
|
||||
|
||||
@@ -18,7 +18,7 @@ import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Dict, List, Optional
|
||||
from typing import Optional
|
||||
|
||||
bl_info = {
|
||||
"name": "Bonsai Translations",
|
||||
@@ -70,9 +70,9 @@ def rearrange_files_for_po_import(po_dir_path: Path, temp_directory: tempfile.Te
|
||||
class Message:
|
||||
msgid: str
|
||||
msgctxt: str | None
|
||||
sources: Optional[List[str]] = field(default_factory=list)
|
||||
sources: Optional[list[str]] = field(default_factory=list)
|
||||
# mapping languages to translated strings
|
||||
translations: Optional[Dict[str, str]] = field(default_factory=dict)
|
||||
translations: Optional[dict[str, str]] = field(default_factory=dict)
|
||||
|
||||
|
||||
def bonsai_strings_parse(addon_directory: Optional[Path] = None, po_directory: Optional[Path] = None):
|
||||
@@ -98,7 +98,7 @@ def bonsai_strings_parse(addon_directory: Optional[Path] = None, po_directory: O
|
||||
r'\b_\("(.*?)"\)', # gettext called with `_`
|
||||
]
|
||||
regexes = [re.compile(pattern) for pattern in patterns]
|
||||
matched_dict: Dict[str, Message] = dict()
|
||||
matched_dict: dict[str, Message] = dict()
|
||||
|
||||
# NOTE: currently there is no special handling same message with different contexts
|
||||
for root, dirs, files in os.walk(directory):
|
||||
@@ -151,7 +151,7 @@ def bonsai_strings_parse(addon_directory: Optional[Path] = None, po_directory: O
|
||||
|
||||
|
||||
def update_translations_from_po(po_directory: Path, translations_module: Path):
|
||||
translation_data: Dict[str, Message] = dict()
|
||||
translation_data: dict[str, Message] = dict()
|
||||
|
||||
def process_po_entry(language: str, current_chunk: list[str]) -> None:
|
||||
sources = []
|
||||
|
||||
@@ -3,14 +3,14 @@ import ifcopenshell
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.geom
|
||||
import multiprocessing
|
||||
from typing import NamedTuple, List
|
||||
from typing import NamedTuple
|
||||
|
||||
# python standalone_drawer.py model.ifc guid_of_drawing guids,of,bad,elements output.svg
|
||||
|
||||
|
||||
class LineworkContexts(NamedTuple):
|
||||
body: List[List[int]]
|
||||
annotation: List[List[int]]
|
||||
body: list[list[int]]
|
||||
annotation: list[list[int]]
|
||||
|
||||
|
||||
class Drawer:
|
||||
|
||||
@@ -20,7 +20,7 @@ import sys
|
||||
import json
|
||||
import pytest
|
||||
import bonsai.core.tool
|
||||
from typing import Any, Optional, Type, Union, TypedDict, Literal
|
||||
from typing import Any, Optional, TypedDict, Literal
|
||||
from typing_extensions import Self
|
||||
|
||||
|
||||
@@ -277,9 +277,9 @@ class Prophecy:
|
||||
- Ensure all predicted calls actually happened.
|
||||
"""
|
||||
|
||||
subject: Type
|
||||
subject: type
|
||||
|
||||
def __init__(self, cls: Type):
|
||||
def __init__(self, cls: type):
|
||||
self.subject = cls
|
||||
self.predictions: list[Prediction] = []
|
||||
self.calls: list[Call] = []
|
||||
|
||||
Reference in New Issue
Block a user