Fix Ruff UP035 (also deprecated annotation symbols)

This commit is contained in:
Andrej
2025-06-09 10:21:22 +05:00
parent 7d4176d105
commit 02d359d0e6
96 changed files with 140 additions and 134 deletions
-1
View File
@@ -76,7 +76,6 @@ ignore = [
"UP030", # implicit references for positional format fields "UP030", # implicit references for positional format fields
"UP031", # Replace % with .format "UP031", # Replace % with .format
"UP032", # Replace .format with f-string "UP032", # Replace .format with f-string
"UP035", # List -> list
# Deprecated Ruff rules. # Deprecated Ruff rules.
"UP038", # Use X | Y in isinstance "UP038", # Use X | Y in isinstance
+2 -1
View File
@@ -1,6 +1,7 @@
import uuid import uuid
import zipfile import zipfile
from typing import Any, Iterable, Optional, Literal, Union from typing import Any, Optional, Literal, Union
from collections.abc import Iterable
import numpy as np import numpy as np
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
+2 -1
View File
@@ -1,6 +1,7 @@
import uuid import uuid
import zipfile import zipfile
from typing import Any, Iterable, Optional, Literal, Union from typing import Any, Optional, Literal, Union
from collections.abc import Iterable
import numpy as np import numpy as np
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
+2 -1
View File
@@ -40,7 +40,8 @@ import uuid
import shutil import shutil
from collections import deque from collections import deque
from pathlib import Path from pathlib import Path
from typing import Union, Any, Generator from typing import Union, Any
from collections.abc import Generator
last_commit_hash = "8888888" last_commit_hash = "8888888"
+2 -1
View File
@@ -22,7 +22,8 @@ import bpy.utils.previews
import importlib import importlib
from bpy_extras.io_utils import ImportHelper, ExportHelper from bpy_extras.io_utils import ImportHelper, ExportHelper
from . import handler, ui, prop, operator from . import handler, ui, prop, operator
from typing import Callable, Union from typing import Union
from collections.abc import Callable
try: try:
from bonsai.translations import translations_dict from bonsai.translations import translations_dict
+2 -1
View File
@@ -33,7 +33,8 @@ from bonsai.bim.module.model.decorator import WallAxisDecorator, SlabDirectionDe
from bonsai.bim.module.nest.decorator import NestDecorator from bonsai.bim.module.nest.decorator import NestDecorator
from mathutils import Vector from mathutils import Vector
from math import cos from math import cos
from typing import Union, Callable from typing import Union
from collections.abc import Callable
cwd = os.path.dirname(os.path.realpath(__file__)) cwd = os.path.dirname(os.path.realpath(__file__))
+2 -1
View File
@@ -27,7 +27,8 @@ import ifcopenshell.util.element
import ifcopenshell.util.unit import ifcopenshell.util.unit
from ifcopenshell.util.doc import get_attribute_doc, get_predefined_type_doc, get_property_doc from ifcopenshell.util.doc import get_attribute_doc, get_predefined_type_doc, get_property_doc
import bonsai.tool as tool import bonsai.tool as tool
from typing import Optional, Callable, Any, Union, Iterable, TYPE_CHECKING from typing import Optional, Any, Union, TYPE_CHECKING
from collections.abc import Callable, Iterable
if TYPE_CHECKING: if TYPE_CHECKING:
import bonsai.bim.prop import bonsai.bim.prop
+2 -1
View File
@@ -34,7 +34,8 @@ import bonsai.tool as tool
from ifcopenshell.file import UndoSystemError from ifcopenshell.file import UndoSystemError
from pathlib import Path from pathlib import Path
from bonsai.tool.brick import BrickStore from bonsai.tool.brick import BrickStore
from typing import Union, Optional, TypedDict, Callable, NotRequired, Literal from typing import Union, Optional, TypedDict, NotRequired, Literal
from collections.abc import Callable
IFC_CONNECTED_TYPE = Union[bpy.types.Material, bpy.types.Object] IFC_CONNECTED_TYPE = Union[bpy.types.Material, bpy.types.Object]
+2 -1
View File
@@ -38,7 +38,8 @@ import ifcopenshell.util.shape
import bonsai.tool as tool import bonsai.tool as tool
from bonsai.bim.ifc import IfcStore, IFC_CONNECTED_TYPE from bonsai.bim.ifc import IfcStore, IFC_CONNECTED_TYPE
from bonsai.tool.loader import OBJECT_DATA_TYPE from bonsai.tool.loader import OBJECT_DATA_TYPE
from typing import Union, Optional, Any, Literal, Iterable from typing import Union, Optional, Any, Literal
from collections.abc import Iterable
from ifcopenshell.util.shape import MatrixType from ifcopenshell.util.shape import MatrixType
@@ -38,8 +38,6 @@ import ifcopenshell.util.selector
from datetime import datetime from datetime import datetime
from dateutil import parser, relativedelta from dateutil import parser, relativedelta
from bpy_extras.io_utils import ImportHelper from bpy_extras.io_utils import ImportHelper
from typing import get_args, TYPE_CHECKING
from typing_extensions import assert_never
class ImportAlignmentCSV(bpy.types.Operator, tool.Ifc.Operator, ImportHelper): class ImportAlignmentCSV(bpy.types.Operator, tool.Ifc.Operator, ImportHelper):
-3
View File
@@ -31,9 +31,6 @@ from bpy.props import (
FloatVectorProperty, FloatVectorProperty,
CollectionProperty, CollectionProperty,
) )
from functools import partial
from typing import Literal
from typing_extensions import assert_never
from bcf.agnostic.extensions import get_extensions_attributes from bcf.agnostic.extensions import get_extensions_attributes
from typing import TYPE_CHECKING, Union from typing import TYPE_CHECKING, Union
+1 -2
View File
@@ -22,8 +22,7 @@ import bonsai.tool as tool
import bonsai.bim.helper import bonsai.bim.helper
from bpy.types import Panel from bpy.types import Panel
from bonsai.bim.module.clash.data import ClashData from bonsai.bim.module.clash.data import ClashData
from typing import TYPE_CHECKING from typing import TYPE_CHECKING, assert_never
from typing_extensions import assert_never
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.clash.prop import BIMClashProperties, ClashSet, SmartClashGroup, Clash from bonsai.bim.module.clash.prop import BIMClashProperties, ClashSet, SmartClashGroup, Clash
@@ -38,7 +38,8 @@ from bonsai.bim.module.drawing.shaders import add_verts_sequence, add_offsets
from bonsai.bim.module.drawing.helper import format_distance from bonsai.bim.module.drawing.helper import format_distance
from timeit import default_timer as timer from timeit import default_timer as timer
from functools import cache from functools import cache
from typing import Optional, Iterator, Union from typing import Optional, Union
from collections.abc import Iterator
UNSPECIAL_ELEMENT_COLOR = (0.2, 0.2, 0.2, 1) # GREY UNSPECIAL_ELEMENT_COLOR = (0.2, 0.2, 0.2, 1) # GREY
+2 -1
View File
@@ -46,7 +46,8 @@ from bpy.props import (
CollectionProperty, CollectionProperty,
BoolVectorProperty, BoolVectorProperty,
) )
from typing import TYPE_CHECKING, Literal, Any, Callable, get_args, Union from typing import TYPE_CHECKING, Literal, Any, get_args, Union
from collections.abc import Callable
diagram_scales_enum = [] diagram_scales_enum = []
@@ -38,7 +38,8 @@ from bonsai.bim.module.drawing.data import DrawingsData
from bonsai.bim.module.drawing.data import DecoratorData from bonsai.bim.module.drawing.data import DecoratorData
from math import pi, ceil, atan, degrees, acos from math import pi, ceil, atan, degrees, acos
from mathutils import geometry, Vector from mathutils import geometry, Vector
from typing import Optional, Self, Union, Sequence, Callable from typing import Optional, Self, Union
from collections.abc import Callable, Sequence
from pathlib import Path from pathlib import Path
@@ -27,7 +27,7 @@ from bpy.types import SpaceView3D
from mathutils import Vector, Matrix from mathutils import Vector, Matrix
from gpu_extras.batch import batch_for_shader from gpu_extras.batch import batch_for_shader
from bpy_extras.view3d_utils import location_3d_to_region_2d from bpy_extras.view3d_utils import location_3d_to_region_2d
from typing import Sequence from collections.abc import Sequence
class ItemDecorator: class ItemDecorator:
@@ -28,7 +28,8 @@ from datetime import datetime
import bpy import bpy
import bonsai.tool as tool import bonsai.tool as tool
from pathlib import Path from pathlib import Path
from typing import Union, Optional, Sequence from typing import Union, Optional
from collections.abc import Sequence
import json import json
import math import math
import time import time
@@ -27,8 +27,7 @@ import bonsai.core.misc as core
import bonsai.core.geometry as core_geometry import bonsai.core.geometry as core_geometry
import bonsai.core.root import bonsai.core.root
from mathutils import Vector, Matrix, Euler from mathutils import Vector, Matrix, Euler
from typing import TYPE_CHECKING, Literal, get_args from typing import TYPE_CHECKING, Literal, get_args, assert_never
from typing_extensions import assert_never
class SetOverrideColour(bpy.types.Operator): class SetOverrideColour(bpy.types.Operator):
@@ -45,7 +45,8 @@ from bpy.types import SpaceView3D
from bpy.props import FloatProperty from bpy.props import FloatProperty
from bpy_extras.object_utils import AddObjectHelper, object_data_add from bpy_extras.object_utils import AddObjectHelper, object_data_add
from gpu_extras.batch import batch_for_shader from gpu_extras.batch import batch_for_shader
from typing import Union, Optional, Any, cast, Sequence from typing import Union, Optional, Any, cast
from collections.abc import Sequence
class FilledOpeningGenerator: class FilledOpeningGenerator:
+2 -2
View File
@@ -35,8 +35,8 @@ from bpy.props import (
IntProperty, IntProperty,
StringProperty, StringProperty,
) )
from typing import TYPE_CHECKING, Literal, Union, get_args, Generator from typing import TYPE_CHECKING, Literal, Union, get_args, assert_never
from typing_extensions import assert_never from collections.abc import Generator
def get_export_schema(self: "BIMProjectProperties", context: bpy.types.Context) -> list[tuple[str, str, str]]: def get_export_schema(self: "BIMProjectProperties", context: bpy.types.Context) -> list[tuple[str, str, str]]:
+1 -2
View File
@@ -35,8 +35,7 @@ from bonsai.bim.module.pset.data import (
WorkSchedulePsetsData, WorkSchedulePsetsData,
) )
from bonsai.bim.module.material.data import ObjectMaterialData from bonsai.bim.module.material.data import ObjectMaterialData
from typing import Any, Optional, TYPE_CHECKING from typing import Any, Optional, TYPE_CHECKING, assert_never
from typing_extensions import assert_never
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.pset.prop import IfcProperty, PsetProperties from bonsai.bim.module.pset.prop import IfcProperty, PsetProperties
@@ -29,8 +29,7 @@ from mathutils import Vector, Matrix
from mathutils.bvhtree import BVHTree from mathutils.bvhtree import BVHTree
from shapely.geometry import Polygon from shapely.geometry import Polygon
from shapely.ops import unary_union from shapely.ops import unary_union
from typing import Literal, Union, Optional from typing import Literal, Union, Optional, assert_never
from typing_extensions import assert_never
AxisType = Literal["x", "y", "z"] AxisType = Literal["x", "y", "z"]
+1 -1
View File
@@ -19,7 +19,7 @@
import bpy import bpy
import bmesh import bmesh
import bonsai.tool as tool import bonsai.tool as tool
from typing import Callable from collections.abc import Callable
def calculate_height(obj: bpy.types.Object) -> float: def calculate_height(obj: bpy.types.Object) -> float:
@@ -39,8 +39,7 @@ from bpy.props import (
FloatVectorProperty, FloatVectorProperty,
CollectionProperty, CollectionProperty,
) )
from typing import TYPE_CHECKING, Literal, get_args from typing import TYPE_CHECKING, Literal, get_args, assert_never
from typing_extensions import assert_never
class AddFilterGroup(Operator): class AddFilterGroup(Operator):
@@ -33,8 +33,7 @@ import ifcopenshell.util.selector
from datetime import datetime from datetime import datetime
from dateutil import parser, relativedelta from dateutil import parser, relativedelta
from bpy_extras.io_utils import ImportHelper, ExportHelper from bpy_extras.io_utils import ImportHelper, ExportHelper
from typing import get_args, TYPE_CHECKING from typing import get_args, TYPE_CHECKING, assert_never
from typing_extensions import assert_never
class EnableStatusFilters(bpy.types.Operator): class EnableStatusFilters(bpy.types.Operator):
@@ -24,7 +24,8 @@ import blf
import bonsai.tool as tool import bonsai.tool as tool
from bpy.types import SpaceView3D from bpy.types import SpaceView3D
from gpu_extras.batch import batch_for_shader from gpu_extras.batch import batch_for_shader
from typing import Iterable, Union from typing import Union
from collections.abc import Iterable
from bonsai.bim.module.structural.load_decoration_data import ShaderInfo from bonsai.bim.module.structural.load_decoration_data import ShaderInfo
@@ -28,7 +28,8 @@ import ifcopenshell.util.unit
import ifcopenshell.util.unit as ifcunit import ifcopenshell.util.unit as ifcunit
import bonsai.tool as tool import bonsai.tool as tool
from bonsai.bim.module.structural.shader import DecorationShader from bonsai.bim.module.structural.shader import DecorationShader
from typing import Literal, TypedDict, Iterable from typing import Literal, TypedDict
from collections.abc import Iterable
class MemberInfo(TypedDict): class MemberInfo(TypedDict):
+2 -1
View File
@@ -19,7 +19,8 @@
import bpy import bpy
import ifcopenshell import ifcopenshell
import bonsai.tool as tool import bonsai.tool as tool
from typing import Any, Generator, Union from typing import Any, Union
from collections.abc import Generator
def refresh(): def refresh():
+2 -1
View File
@@ -42,7 +42,8 @@ from mathutils import Vector, Euler
from math import radians from math import radians
from pathlib import Path from pathlib import Path
from collections import namedtuple from collections import namedtuple
from typing import Iterable, Union, TYPE_CHECKING from typing import Union, TYPE_CHECKING
from collections.abc import Iterable
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.prop import MultipleFileSelect from bonsai.bim.prop import MultipleFileSelect
+1 -2
View File
@@ -45,8 +45,7 @@ from bpy.props import (
FloatVectorProperty, FloatVectorProperty,
CollectionProperty, CollectionProperty,
) )
from typing import Any, Union, Literal, get_args, TYPE_CHECKING from typing import Any, Union, Literal, get_args, TYPE_CHECKING, assert_never
from typing_extensions import assert_never
cwd = os.path.dirname(os.path.realpath(__file__)) cwd = os.path.dirname(os.path.realpath(__file__))
+2 -1
View File
@@ -17,7 +17,8 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Sequence, Union from typing import TYPE_CHECKING, Optional, Union
from collections.abc import Sequence
if TYPE_CHECKING: if TYPE_CHECKING:
import bpy import bpy
+1 -1
View File
@@ -17,7 +17,7 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Literal, Iterable from typing import TYPE_CHECKING, Optional, Literal
if TYPE_CHECKING: if TYPE_CHECKING:
import bpy import bpy
+2 -1
View File
@@ -19,7 +19,8 @@
# ############################################################################ # # ############################################################################ #
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union, Iterable from typing import TYPE_CHECKING, Optional
from collections.abc import Iterable
if TYPE_CHECKING: if TYPE_CHECKING:
import bpy import bpy
+10 -2
View File
@@ -42,8 +42,16 @@ from mathutils import Vector
from pathlib import Path from pathlib import Path
from functools import lru_cache, cache from functools import lru_cache, cache
from bonsai.bim.ifc import IFC_CONNECTED_TYPE from bonsai.bim.ifc import IFC_CONNECTED_TYPE
from typing import Any, Optional, Union, Literal, Iterable, Callable, TypeVar, Generator, TYPE_CHECKING, Sequence, Sized from typing import (
from typing_extensions import assert_never Any,
Optional,
Union,
Literal,
TypeVar,
TYPE_CHECKING,
assert_never,
)
from collections.abc import Iterable, Callable, Generator, Sequence, Sized
if TYPE_CHECKING: if TYPE_CHECKING:
import bpy.stub_internal.rna_enums as rna_enums import bpy.stub_internal.rna_enums as rna_enums
+2 -1
View File
@@ -22,7 +22,8 @@ import mathutils
import bonsai.core.tool import bonsai.core.tool
import bonsai.tool as tool import bonsai.tool as tool
from mathutils import Matrix, Vector from mathutils import Matrix, Vector
from typing import Any, Sequence, TYPE_CHECKING from typing import Any, TYPE_CHECKING
from collections.abc import Sequence
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.boundary.prop import BIMBoundaryProperties, BIMObjectBoundaryProperties from bonsai.bim.module.boundary.prop import BIMBoundaryProperties, BIMObjectBoundaryProperties
+2 -1
View File
@@ -30,7 +30,8 @@ import bonsai.core.tool
import bonsai.tool as tool import bonsai.tool as tool
from pathlib import Path from pathlib import Path
from contextlib import contextmanager from contextlib import contextmanager
from typing import Generator, Any, Union, TYPE_CHECKING from typing import Any, Union, TYPE_CHECKING
from collections.abc import Generator
try: try:
import brickschema import brickschema
+1 -2
View File
@@ -22,8 +22,7 @@ import ifcopenshell.api
import ifcopenshell.util.classification import ifcopenshell.util.classification
import bonsai.core.tool import bonsai.core.tool
import bonsai.tool as tool import bonsai.tool as tool
from typing import Any, Optional, Union, Literal, Iterable, Callable from typing import Union, assert_never
from typing_extensions import assert_never
class Classification(bonsai.core.tool.Classification): class Classification(bonsai.core.tool.Classification):
+2 -2
View File
@@ -28,8 +28,8 @@ import ifcopenshell.util.unit
import bonsai.bim.helper import bonsai.bim.helper
import json import json
from pathlib import Path from pathlib import Path
from typing import Optional, Any, Generator, Union, Literal, TYPE_CHECKING from typing import Optional, Any, Union, Literal, TYPE_CHECKING, assert_never
from typing_extensions import assert_never from collections.abc import Generator
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.cost.prop import BIMCostProperties, CostItemQuantity from bonsai.bim.module.cost.prop import BIMCostProperties, CostItemQuantity
+2 -1
View File
@@ -31,7 +31,8 @@ import bonsai.tool as tool
from bonsai.bim.ifc import IfcStore from bonsai.bim.ifc import IfcStore
from mathutils import Vector from mathutils import Vector
from collections import defaultdict from collections import defaultdict
from typing import Iterable, Literal, TYPE_CHECKING from typing import Literal, TYPE_CHECKING
from collections.abc import Iterable
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.debug.prop import BIMDebugProperties from bonsai.bim.module.debug.prop import BIMDebugProperties
+2 -1
View File
@@ -51,7 +51,8 @@ from shapely.ops import unary_union
from lxml import etree from lxml import etree
from mathutils import Vector, Matrix from mathutils import Vector, Matrix
from fractions import Fraction from fractions import Fraction
from typing import Optional, Union, Iterable, Any, Literal, Sequence, TYPE_CHECKING, NamedTuple, get_args from typing import Optional, Union, Any, Literal, TYPE_CHECKING, NamedTuple
from collections.abc import Iterable, Sequence
from pathlib import Path from pathlib import Path
if TYPE_CHECKING: if TYPE_CHECKING:
+2 -1
View File
@@ -24,7 +24,8 @@ import bonsai.bim.helper
import bonsai.core.geometry import bonsai.core.geometry
import ifcopenshell import ifcopenshell
import ifcopenshell.util.representation import ifcopenshell.util.representation
from typing import Iterable, TYPE_CHECKING from typing import TYPE_CHECKING
from collections.abc import Iterable
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.void.prop import BIMBooleanProperties from bonsai.bim.module.void.prop import BIMBooleanProperties
+1 -3
View File
@@ -59,17 +59,15 @@ from mathutils.bvhtree import BVHTree
from bonsai.bim.ifc import IfcStore from bonsai.bim.ifc import IfcStore
from typing import ( from typing import (
Union, Union,
Iterable,
Optional, Optional,
Literal, Literal,
Iterator,
TYPE_CHECKING, TYPE_CHECKING,
get_args, get_args,
Generator,
cast, cast,
TypeGuard, TypeGuard,
Any, Any,
) )
from collections.abc import Iterable, Iterator, Generator
from typing_extensions import TypeIs from typing_extensions import TypeIs
if TYPE_CHECKING: if TYPE_CHECKING:
+1 -2
View File
@@ -27,8 +27,7 @@ import bonsai.bim.helper
import ifcopenshell.util.unit import ifcopenshell.util.unit
import ifcopenshell.util.element import ifcopenshell.util.element
from collections import defaultdict from collections import defaultdict
from typing import Union, Any, TYPE_CHECKING, Optional, Literal from typing import Union, Any, TYPE_CHECKING, Optional
from typing_extensions import assert_never
if TYPE_CHECKING: if TYPE_CHECKING:
# Avoid circular imports. # Avoid circular imports.
+2 -1
View File
@@ -49,7 +49,8 @@ from bonsai.bim import import_ifc
from bonsai.bim.module.model.data import AuthoringData, RailingData, RoofData, WindowData, DoorData from bonsai.bim.module.model.data import AuthoringData, RailingData, RoofData, WindowData, DoorData
from bonsai.bim.module.model.opening import FilledOpeningGenerator from bonsai.bim.module.model.opening import FilledOpeningGenerator
from ifcopenshell.util.shape_builder import ShapeBuilder, np_to_3d from ifcopenshell.util.shape_builder import ShapeBuilder, np_to_3d
from typing import Optional, Union, TypeVar, Any, Iterable, Literal, TYPE_CHECKING, Sequence, TypedDict from typing import Optional, Union, TypeVar, Any, Literal, TYPE_CHECKING, TypedDict
from collections.abc import Iterable, Sequence
T = TypeVar("T") T = TypeVar("T")
V_ = tool.Blender.V_ V_ = tool.Blender.V_
+1 -2
View File
@@ -22,8 +22,7 @@ import bonsai.core.tool
import bonsai.tool as tool import bonsai.tool as tool
import bonsai.bim.helper import bonsai.bim.helper
import ifcopenshell import ifcopenshell
from typing import Union, Any, TYPE_CHECKING, Literal from typing import Union, Any, TYPE_CHECKING, Literal, assert_never
from typing_extensions import assert_never
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.owner.prop import BIMOwnerProperties from bonsai.bim.module.owner.prop import BIMOwnerProperties
+1 -1
View File
@@ -35,7 +35,7 @@ from collections import defaultdict
from bonsai.bim.ifc import IfcStore from bonsai.bim.ifc import IfcStore
from ifcopenshell.api.project.append_asset import APPENDABLE_ASSET_TYPES from ifcopenshell.api.project.append_asset import APPENDABLE_ASSET_TYPES
from pathlib import Path from pathlib import Path
from typing import Optional, Union, TYPE_CHECKING, Generator from typing import Optional, Union, TYPE_CHECKING
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.project.prop import BIMProjectProperties from bonsai.bim.module.project.prop import BIMProjectProperties
+1 -2
View File
@@ -26,8 +26,7 @@ import bonsai.bim.helper
import bonsai.core.tool import bonsai.core.tool
import bonsai.tool as tool import bonsai.tool as tool
import bonsai.bim.schema import bonsai.bim.schema
from typing import Union, Literal, Any, TYPE_CHECKING from typing import Union, Literal, Any, TYPE_CHECKING, assert_never
from typing_extensions import assert_never
if TYPE_CHECKING: if TYPE_CHECKING:
+1 -2
View File
@@ -25,8 +25,7 @@ import ifcopenshell.util.element
import bonsai.core.tool import bonsai.core.tool
import bonsai.tool as tool import bonsai.tool as tool
from pathlib import Path from pathlib import Path
from typing import Union, Literal, Any, final from typing import Literal, final, TYPE_CHECKING
from typing_extensions import assert_never, TYPE_CHECKING
from bonsai.bim.ifc import IfcStore from bonsai.bim.ifc import IfcStore
if TYPE_CHECKING: if TYPE_CHECKING:
+2 -1
View File
@@ -38,7 +38,8 @@ import bonsai.bim.helper
from dateutil import parser from dateutil import parser
from datetime import datetime from datetime import datetime
from datetime import time as datetime_time from datetime import time as datetime_time
from typing import Optional, Any, Union, Literal, TYPE_CHECKING, Iterable from typing import Optional, Any, Union, Literal, TYPE_CHECKING
from collections.abc import Iterable
from mathutils import Color from mathutils import Color
if TYPE_CHECKING: if TYPE_CHECKING:
+2 -1
View File
@@ -42,7 +42,8 @@ import numpy as np
from math import pi from math import pi
from mathutils import Vector, Matrix from mathutils import Vector, Matrix
from shapely import Polygon from shapely import Polygon
from typing import Generator, Optional, Union, Literal, Any, Iterable, TYPE_CHECKING from typing import Optional, Union, Literal, Any, TYPE_CHECKING
from collections.abc import Generator, Iterable
from collections import defaultdict from collections import defaultdict
from natsort import natsorted from natsort import natsorted
+2 -1
View File
@@ -28,7 +28,8 @@ import bonsai.core.tool
import bonsai.tool as tool import bonsai.tool as tool
import bonsai.bim.helper import bonsai.bim.helper
from mathutils import Color from mathutils import Color
from typing import Union, Any, Optional, Literal, TYPE_CHECKING, Sequence from typing import Union, Any, Optional, Literal, TYPE_CHECKING
from collections.abc import Sequence
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.prop import Attribute from bonsai.bim.prop import Attribute
+1 -2
View File
@@ -24,8 +24,7 @@ import ifcopenshell
import bonsai.bim.helper import bonsai.bim.helper
import bonsai.core.tool import bonsai.core.tool
import bonsai.tool as tool import bonsai.tool as tool
from typing import Union, Literal, Any, TYPE_CHECKING from typing import Union, Literal, Any, TYPE_CHECKING, assert_never
from typing_extensions import assert_never
if TYPE_CHECKING: if TYPE_CHECKING:
from bonsai.bim.module.unit.prop import BIMUnitProperties from bonsai.bim.module.unit.prop import BIMUnitProperties
+1 -1
View File
@@ -26,7 +26,7 @@ import bonsai.core.tool
import bonsai.tool as tool import bonsai.tool as tool
import ifcopenshell.api.sequence import ifcopenshell.api.sequence
import ifcopenshell.api.cost import ifcopenshell.api.cost
from typing import Any, Dict, Optional from typing import Any, Optional
import time import time
import socket import socket
import sys import sys
+1 -2
View File
@@ -20,8 +20,7 @@ import sys
import json import json
import pytest import pytest
import bonsai.core.tool import bonsai.core.tool
from typing import Any, Optional, TypedDict, Literal from typing import Any, Optional, TypedDict, Literal, Self
from typing_extensions import Self
@pytest.fixture @pytest.fixture
+2 -1
View File
@@ -31,7 +31,8 @@ import ifcopenshell.util.representation
import ifcopenshell.util.type import ifcopenshell.util.type
import multiprocessing import multiprocessing
from collections import defaultdict from collections import defaultdict
from typing import Any, Literal, get_args, Union, Iterable, NamedTuple from typing import Any, Literal, get_args, Union, NamedTuple
from collections.abc import Iterable
class Function(NamedTuple): class Function(NamedTuple):
+2 -1
View File
@@ -29,7 +29,8 @@ import ifcopenshell.util.selector
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.schema import ifcopenshell.util.schema
from statistics import mean from statistics import mean
from typing import Optional, Union, Literal, Iterable from typing import Optional, Union, Literal
from collections.abc import Iterable
try: try:
from odf.namespaces import OFFICENS from odf.namespaces import OFFICENS
+2 -1
View File
@@ -26,7 +26,8 @@ import ifcopenshell.util.placement
import ifcopenshell.util.shape import ifcopenshell.util.shape
import ifcopenshell.util.system import ifcopenshell.util.system
from ifcopenshell.util.shape_builder import np_matrix_to_euler from ifcopenshell.util.shape_builder import np_matrix_to_euler
from typing import Any, Union, Optional, Generator from typing import Any, Union, Optional
from collections.abc import Generator
# The original BIMServer plugin has a function called ifcToCOBie: # The original BIMServer plugin has a function called ifcToCOBie:
@@ -20,7 +20,6 @@ import ifcopenshell
import ifcopenshell.api.alignment import ifcopenshell.api.alignment
import ifcopenshell.api.nest import ifcopenshell.api.nest
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from typing import Sequence
def add_segment_to_layout(file: ifcopenshell.file, alignment: entity_instance, segment: entity_instance) -> None: def add_segment_to_layout(file: ifcopenshell.file, alignment: entity_instance, segment: entity_instance) -> None:
@@ -19,7 +19,7 @@
import ifcopenshell import ifcopenshell
import ifcopenshell.api.alignment.add_vertical_alignment import ifcopenshell.api.alignment.add_vertical_alignment
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from typing import Sequence from collections.abc import Sequence
def add_vertical_alignment_by_pi_method( def add_vertical_alignment_by_pi_method(
@@ -21,7 +21,7 @@ import ifcopenshell.api.aggregate
import ifcopenshell.api.alignment import ifcopenshell.api.alignment
import ifcopenshell.api.nest import ifcopenshell.api.nest
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from typing import Sequence from collections.abc import Sequence
def create_alignment_by_pi_method( def create_alignment_by_pi_method(
@@ -30,7 +30,6 @@ from ifcopenshell import entity_instance
from ifcopenshell.api.alignment import get_axis_subcontext from ifcopenshell.api.alignment import get_axis_subcontext
import math import math
from typing import Sequence
import csv import csv
@@ -22,7 +22,7 @@ import ifcopenshell.api.geometry
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
import math import math
from typing import Sequence from collections.abc import Sequence
def create_geometric_representation(file: ifcopenshell.file, alignment: entity_instance) -> None: def create_geometric_representation(file: ifcopenshell.file, alignment: entity_instance) -> None:
@@ -21,7 +21,7 @@ import ifcopenshell.api.alignment
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
import math import math
from typing import Sequence from collections.abc import Sequence
def create_horizontal_alignment_by_pi_method( def create_horizontal_alignment_by_pi_method(
@@ -21,7 +21,7 @@ import ifcopenshell.api.alignment
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
import math import math
from typing import Sequence from collections.abc import Sequence
def create_vertical_alignment_by_pi_method( def create_vertical_alignment_by_pi_method(
@@ -19,7 +19,7 @@
import ifcopenshell import ifcopenshell
import ifcopenshell.util import ifcopenshell.util
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from typing import Sequence from collections.abc import Sequence
import ifcopenshell.util.representation import ifcopenshell.util.representation
@@ -19,7 +19,6 @@
import ifcopenshell import ifcopenshell
import ifcopenshell.util import ifcopenshell.util
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from typing import Sequence
import ifcopenshell.util.representation import ifcopenshell.util.representation
@@ -19,7 +19,7 @@
import ifcopenshell import ifcopenshell
import ifcopenshell.util import ifcopenshell.util
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from typing import Sequence from collections.abc import Sequence
import ifcopenshell.util.element import ifcopenshell.util.element
@@ -19,7 +19,6 @@
import ifcopenshell import ifcopenshell
import ifcopenshell.util import ifcopenshell.util
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from typing import Sequence
import ifcopenshell.util.representation import ifcopenshell.util.representation
@@ -19,7 +19,6 @@
import ifcopenshell import ifcopenshell
import ifcopenshell.util import ifcopenshell.util
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from typing import Sequence
import ifcopenshell.util.representation import ifcopenshell.util.representation
@@ -19,7 +19,7 @@
import ifcopenshell import ifcopenshell
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from ifcopenshell.api.alignment import get_axis_subcontext from ifcopenshell.api.alignment import get_axis_subcontext
from typing import Sequence from collections.abc import Sequence
import math import math
@@ -19,7 +19,7 @@
import ifcopenshell import ifcopenshell
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
from typing import Sequence from collections.abc import Sequence
import math import math
@@ -19,7 +19,6 @@
import ifcopenshell import ifcopenshell
import ifcopenshell.api.alignment import ifcopenshell.api.alignment
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from typing import Sequence
def map_alignment_segments( def map_alignment_segments(
@@ -19,7 +19,7 @@
import ifcopenshell import ifcopenshell
from ifcopenshell import ifcopenshell_wrapper from ifcopenshell import ifcopenshell_wrapper
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from typing import Sequence from collections.abc import Sequence
import math import math
@@ -18,7 +18,6 @@
import ifcopenshell import ifcopenshell
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from typing import Sequence
def name_segments(prefix: str, alignment: entity_instance) -> None: def name_segments(prefix: str, alignment: entity_instance) -> None:
@@ -21,7 +21,6 @@ import ifcopenshell.api
from ifcopenshell import ifcopenshell_wrapper from ifcopenshell import ifcopenshell_wrapper
import ifcopenshell.geom import ifcopenshell.geom
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from typing import Sequence
import numpy as np import numpy as np
import math import math
@@ -19,7 +19,6 @@
import ifcopenshell import ifcopenshell
import ifcopenshell.api.alignment import ifcopenshell.api.alignment
import math import math
from typing import Sequence
import numpy as np import numpy as np
@@ -16,7 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell import ifcopenshell
from typing import Union, Literal, Sequence from typing import Union, Literal
from collections.abc import Sequence
IfcLogical = Union[bool, Literal["UNKNOWN"]] IfcLogical = Union[bool, Literal["UNKNOWN"]]
@@ -18,7 +18,7 @@
import ifcopenshell.api.style import ifcopenshell.api.style
import ifcopenshell.util.element import ifcopenshell.util.element
from typing import Iterable from collections.abc import Iterable
def remove_style(file: ifcopenshell.file, style: ifcopenshell.entity_instance) -> None: def remove_style(file: ifcopenshell.file, style: ifcopenshell.entity_instance) -> None:
@@ -22,7 +22,7 @@ import ifcopenshell.api.owner
import ifcopenshell.api.material import ifcopenshell.api.material
import ifcopenshell.guid import ifcopenshell.guid
import ifcopenshell.util.element import ifcopenshell.util.element
from typing import Union, Iterable, Any from typing import Union
def assign_type( def assign_type(
+1 -1
View File
@@ -29,7 +29,7 @@ import ifcopenshell.geom
from xml.dom.minidom import parseString from xml.dom.minidom import parseString
from dataclasses import dataclass, fields, field from dataclasses import dataclass, fields, field
from typing import Callable, Sequence from collections.abc import Callable, Sequence
import numpy import numpy
@@ -25,7 +25,8 @@ import operator
import subprocess import subprocess
import sys import sys
import time import time
from typing import Union, Any, Callable, TypeVar, overload, Iterable, Sequence from typing import Union, Any, TypeVar, overload
from collections.abc import Callable, Sequence
from . import ifcopenshell_wrapper from . import ifcopenshell_wrapper
from . import settings from . import settings
+2 -9
View File
@@ -24,15 +24,8 @@ import zipfile
import functools import functools
import ifcopenshell import ifcopenshell
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any, Optional, TYPE_CHECKING, Union, overload, Literal, TypedDict
from typing import Callable from collections.abc import Callable, Generator
from typing import Generator
from typing import Optional
from typing import TYPE_CHECKING
from typing import Union
from typing import overload
from typing import Literal
from typing import TypedDict
# py39 compat: re-enable when support is dropped # py39 compat: re-enable when support is dropped
# from typing_extensions import assert_never # from typing_extensions import assert_never
@@ -34,11 +34,7 @@ except ImportError:
USE_OCCT_HANDLE = True USE_OCCT_HANDLE = True
from collections import defaultdict, OrderedDict from collections import defaultdict, OrderedDict
from collections.abc import Iterable
try: # python 3.3+
from collections.abc import Iterable
except ModuleNotFoundError: # python 2
from collections import Iterable
try: try:
QString = unicode QString = unicode
@@ -28,7 +28,8 @@ from ..entity_instance import entity_instance
from . import has_occ from . import has_occ
from typing import TypeVar, Union, Optional, Generator, Any, Literal, overload, TYPE_CHECKING, Iterable, cast, TypedDict from typing import TypeVar, Union, Optional, Any, Literal, overload, TYPE_CHECKING, cast
from collections.abc import Generator, Iterable
if TYPE_CHECKING: if TYPE_CHECKING:
from OCC.Core import TopoDS from OCC.Core import TopoDS
@@ -18,7 +18,8 @@
import lark import lark
import ifcopenshell import ifcopenshell
from typing import Optional, Union, Literal, Generator, Any from typing import Optional, Union, Literal, Any
from collections.abc import Generator
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
from ifcopenshell.util.doc import get_predefined_type_doc from ifcopenshell.util.doc import get_predefined_type_doc
from ifcopenshell.util.element import get_psets from ifcopenshell.util.element import get_psets
@@ -20,7 +20,8 @@ import ifcopenshell
import ifcopenshell.guid import ifcopenshell.guid
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.representation import ifcopenshell.util.representation
from typing import Any, Callable, Optional, Union, Literal, overload, Sequence, Generator from typing import Any, Callable, Optional, Union, Literal, overload
from collections.abc import Generator, Sequence
from collections import namedtuple from collections import namedtuple
@@ -19,8 +19,8 @@
import numpy as np import numpy as np
import numpy.typing as npt import numpy.typing as npt
import ifcopenshell import ifcopenshell
from typing import Literal, Iterable, Optional from typing import Literal, Optional
from collections.abc import Iterable
MatrixType = npt.NDArray[np.float64] MatrixType = npt.NDArray[np.float64]
"""`npt.NDArray[np.float64]`""" """`npt.NDArray[np.float64]`"""
@@ -22,7 +22,8 @@ import ifcopenshell
import ifcopenshell.util.representation import ifcopenshell.util.representation
import ifcopenshell.util.placement import ifcopenshell.util.placement
import ifcopenshell.util.shape import ifcopenshell.util.shape
from typing import Optional, Union, TypedDict, Literal, Generator, Sequence from typing import Optional, Union, TypedDict, Literal
from collections.abc import Generator, Sequence
CONTEXT_TYPE = Literal["Model", "Plan", "NotDefined"] CONTEXT_TYPE = Literal["Model", "Plan", "NotDefined"]
@@ -35,7 +35,8 @@ import ifcopenshell.util.shape
import ifcopenshell.util.system import ifcopenshell.util.system
import ifcopenshell.util.unit import ifcopenshell.util.unit
from decimal import Decimal from decimal import Decimal
from typing import Optional, Any, Union, Iterable from typing import Optional, Any, Union
from collections.abc import Iterable
if sys.version_info >= (3, 10): if sys.version_info >= (3, 10):
from types import EllipsisType from types import EllipsisType
@@ -20,7 +20,8 @@ import datetime
import ifcopenshell.util.date import ifcopenshell.util.date
from math import floor from math import floor
from functools import cache from functools import cache
from typing import Union, Literal, Optional, Iterator from typing import Union, Literal, Optional
from collections.abc import Iterator
DURATION_TYPE = Literal["ELAPSEDTIME", "WORKTIME", "NOTDEFINED"] DURATION_TYPE = Literal["ELAPSEDTIME", "WORKTIME", "NOTDEFINED"]
@@ -27,7 +27,7 @@ import ifcopenshell.util.representation
from ifcopenshell.util.shape_builder import VectorType from ifcopenshell.util.shape_builder import VectorType
from math import radians, cos from math import radians, cos
from ifcopenshell.geom import ShapeElementType, ShapeType from ifcopenshell.geom import ShapeElementType, ShapeType
from typing import Optional, Literal, Union, Iterable from typing import Optional, Literal, Union
tol = 1e-6 tol = 1e-6
AXIS_LITERAL = Literal["X", "Y", "Z"] AXIS_LITERAL = Literal["X", "Y", "Z"]
@@ -28,7 +28,8 @@ import ifcopenshell.util.placement
import ifcopenshell.util.representation import ifcopenshell.util.representation
import ifcopenshell.util.unit import ifcopenshell.util.unit
from math import cos, sin, pi, tan, radians, degrees, atan, sqrt from math import cos, sin, pi, tan, radians, degrees, atan, sqrt
from typing import Union, Optional, Literal, Any, Sequence, TYPE_CHECKING from typing import Union, Optional, Literal, Any, TYPE_CHECKING
from collections.abc import Sequence
from itertools import chain from itertools import chain
PRECISION = 1.0e-5 PRECISION = 1.0e-5
@@ -18,10 +18,8 @@
from fractions import Fraction from fractions import Fraction
from math import pi from math import pi
from typing import Literal from typing import Literal, Optional, Union
from typing import Optional from collections.abc import Generator
from typing import Union
from typing import Generator
import ifcopenshell import ifcopenshell
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
@@ -50,7 +50,8 @@ import types
import argparse import argparse
from collections import namedtuple from collections import namedtuple
from typing import Union, Iterator, Any, Optional from typing import Union, Any, Optional
from collections.abc import Iterator
from logging import Logger, Handler from logging import Logger, Handler
if sys.version_info >= (3, 10): if sys.version_info >= (3, 10):
+2 -1
View File
@@ -30,8 +30,9 @@ import importlib
import importlib.util import importlib.util
import re import re
from pathlib import Path from pathlib import Path
from typing import Union, Iterable, Optional, Any, TypedDict, Literal, Sequence from typing import Union, Optional, Any, TypedDict
from typing_extensions import NotRequired from typing_extensions import NotRequired
from collections.abc import Sequence
__version__ = version = "0.0.0" __version__ = version = "0.0.0"
+1 -1
View File
@@ -3,7 +3,7 @@ from starlette.background import BackgroundTask
from starlette.responses import StreamingResponse from starlette.responses import StreamingResponse
from fastapi.routing import APIRoute from fastapi.routing import APIRoute
from starlette.types import Message from starlette.types import Message
from typing import Callable, Dict, Any from typing import Callable
import logging import logging
import httpx import httpx