ruff: sort imports

This commit is contained in:
Andrej730
2026-08-10 15:31:39 +05:00
parent 717d6aa2af
commit 7370d07db1
66 changed files with 87 additions and 62 deletions
+1 -1
View File
@@ -132,9 +132,9 @@ from collections.abc import Generator, Sequence
from datetime import datetime
from pathlib import Path
from typing import Literal
from urllib.request import urlretrieve
from typing_extensions import assert_never
from urllib.request import urlretrieve
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
+2 -2
View File
@@ -4,13 +4,13 @@ from datetime import date, datetime, timedelta
from typing import Any, TypedDict, Union
import ifcopenshell
import ifcopenshell.guid
import ifcopenshell.util.date
import ifcopenshell.api.control
import ifcopenshell.api.owner
import ifcopenshell.api.pset
import ifcopenshell.api.resource
import ifcopenshell.api.sequence
import ifcopenshell.guid
import ifcopenshell.util.date
from typing_extensions import NotRequired
+1 -1
View File
@@ -27,13 +27,13 @@ import os
import time
from collections import Counter
from typing import Optional, Union
from typing_extensions import TypedDict
import ifcopenshell
import ifcopenshell.util.cost
import ifcopenshell.util.date
import ifcopenshell.util.element
import ifcopenshell.util.unit
from typing_extensions import TypedDict
class CostItem(TypedDict, extra_items=float):
@@ -62,7 +62,7 @@ import tempfile
import zipfile
from collections.abc import Generator, Sequence
from pathlib import Path
from typing import TYPE_CHECKING, Literal, Optional, Union, Any, overload
from typing import TYPE_CHECKING, Any, Literal, Optional, Union, overload
if TYPE_CHECKING:
import ifcopenshell.express.schema_class
@@ -88,11 +88,13 @@ try:
except Exception as e:
raise ImportError("IfcOpenShell not built for '%s' (%s)" % (python_distribution, e)) from e
from . import file as file_module
from . import guid
from .ifcopenshell_wrapper import entity_instance, file
from .file import rocksdb_lazy_instance
from .sql import sqlite, sqlite_entity
rocksdb_lazy_instance = file_module.rocksdb_lazy_instance
get_log = ifcopenshell_wrapper.get_log
logger = ifcopenshell_wrapper.logger if hasattr(ifcopenshell_wrapper, "logger") else None
if hasattr(ifcopenshell_wrapper, "logger_or_root"):
@@ -48,8 +48,8 @@ Future versions of this API may support:
"""
from ._get_segment_start_point_label import register_referent_name_callback
from .add_stationing_referent import add_stationing_referent
from .add_positioning_referent import add_positioning_referent
from .add_stationing_referent import add_stationing_referent
from .add_vertical_layout import add_vertical_layout
from .add_zero_length_segment import add_zero_length_segment
from .create import create
@@ -17,6 +17,7 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from typing import Union
import numpy as np
import ifcopenshell
@@ -24,8 +25,6 @@ import ifcopenshell.api.alignment
import ifcopenshell.geom
from ifcopenshell import entity_instance
from ifcopenshell.api.alignment._get_segment_endpoint import _get_segment_endpoint
from ifcopenshell.api.alignment._update_zero_length_segment_placement import _update_zero_length_segment_placement
from ifcopenshell.api.alignment._map_alignment_cant_segment import (
_map_alignment_cant_segment,
)
@@ -38,6 +37,7 @@ from ifcopenshell.api.alignment._map_alignment_vertical_segment import (
from ifcopenshell.api.alignment._update_curve_segment_transition_code import (
_update_curve_segment_transition_code,
)
from ifcopenshell.api.alignment._update_zero_length_segment_placement import _update_zero_length_segment_placement
def _add_curve_segment_to_composite_curve(
@@ -22,11 +22,11 @@ import numpy as np
import ifcopenshell
import ifcopenshell.api.alignment
from ifcopenshell.api.alignment._update_zero_length_segment_placement import _update_zero_length_segment_placement
import ifcopenshell.api.nest
from ifcopenshell import entity_instance
from ifcopenshell.api.alignment._add_segment_to_curve import _add_segment_to_curve
from ifcopenshell.api.alignment._get_segment_endpoint import _get_segment_endpoint
from ifcopenshell.api.alignment._update_zero_length_segment_placement import _update_zero_length_segment_placement
def _add_segment_to_layout(
@@ -17,13 +17,15 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import math
from typing import Union
import numpy as np
import ifcopenshell.api.alignment
import ifcopenshell.geom
from ifcopenshell import entity_instance, ifcopenshell_wrapper
from ifcopenshell.api.alignment._map_alignment_segment import _map_alignment_segment
from typing import Union
import math
import numpy as np
def _get_segment_endpoint(file: ifcopenshell.file, segment: entity_instance) -> Union[np.array, None]:
@@ -20,7 +20,6 @@ from collections.abc import Sequence
import ifcopenshell
from ifcopenshell import entity_instance
from ifcopenshell.api.alignment._map_alignment_cant_segment import (
_map_alignment_cant_segment,
)
@@ -16,10 +16,11 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import math
import numpy as np
import ifcopenshell
import math
import ifcopenshell.api.alignment
import ifcopenshell.util.unit
from ifcopenshell import entity_instance
@@ -18,10 +18,10 @@
import ifcopenshell
import ifcopenshell.api.alignment
from ifcopenshell.api.alignment.update_fallback_position import update_fallback_position
import ifcopenshell.api.pset
import ifcopenshell.guid
from ifcopenshell import entity_instance
from ifcopenshell.api.alignment.update_fallback_position import update_fallback_position
def add_positioning_referent(
@@ -20,12 +20,12 @@ from typing import Optional
import ifcopenshell
import ifcopenshell.api.alignment
from ifcopenshell.api.alignment._sort_nest import _sort_nest
from ifcopenshell.api.alignment.update_fallback_position import update_fallback_position
import ifcopenshell.api.pset
import ifcopenshell.guid
import ifcopenshell.util.element
from ifcopenshell import entity_instance
from ifcopenshell.api.alignment._sort_nest import _sort_nest
from ifcopenshell.api.alignment.update_fallback_position import update_fallback_position
def add_stationing_referent(
@@ -20,14 +20,14 @@ import math
import ifcopenshell
import ifcopenshell.api.alignment
from ifcopenshell.api.alignment._get_segment_endpoint import _get_segment_endpoint
from ifcopenshell.api.alignment._update_zero_length_segment_placement import _update_zero_length_segment_placement
import ifcopenshell.api.nest
import ifcopenshell.util.unit
from ifcopenshell import entity_instance
from ifcopenshell.api.alignment._get_segment_endpoint import _get_segment_endpoint
from ifcopenshell.api.alignment._update_curve_segment_transition_code import (
_update_curve_segment_transition_code,
)
from ifcopenshell.api.alignment._update_zero_length_segment_placement import _update_zero_length_segment_placement
def add_zero_length_segment(file: ifcopenshell.file, layout: entity_instance) -> bool:
@@ -17,10 +17,8 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from ifcopenshell import entity_instance
import ifcopenshell.api.alignment
from ifcopenshell import entity_instance
from ifcopenshell.api.alignment.get_mapped_segments import _get_curve_segment_count
@@ -16,8 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell.api.cost
import ifcopenshell.api.control
import ast
import operator
from typing import Any
@@ -25,10 +25,7 @@ geometry extrusions).
from .. import wrap_usecases
from .add_axis_representation import add_axis_representation
from .add_topology_representation import add_topology_representation
from .add_boolean import add_boolean
from .clip_solid import clip_solid
from .clip_solid_bounded import clip_solid_bounded
from .add_door_representation import add_door_representation
from .add_footprint_representation import add_footprint_representation
from .add_mesh_representation import add_mesh_representation
@@ -41,12 +38,15 @@ from .add_profile_representation import add_profile_representation
# round-tripping through an IFC file. Future add_X_representation work is encouraged
# to follow the same shape — sibling compute_X_geometry function + thin IFC wrapper.
from .add_railing_representation import (
RailingSupport,
TERMINAL_TYPE,
RailingSupport,
WallMountedHandrailGeometry,
add_railing_representation,
compute_wall_mounted_handrail_geometry,
)
from .add_topology_representation import add_topology_representation
from .clip_solid import clip_solid
from .clip_solid_bounded import clip_solid_bounded
try:
from .add_representation import add_representation
@@ -61,12 +61,12 @@ from .assign_representation import assign_representation
from .connect_element import connect_element
from .connect_path import connect_path
from .connect_wall import connect_wall
from .copy_representation import copy_representation
from .create_2pt_wall import create_2pt_wall
from .disconnect_element import disconnect_element
from .disconnect_path import disconnect_path
from .edit_object_placement import edit_object_placement
from .map_representation import map_representation
from .copy_representation import copy_representation
from .regenerate_wall_representation import regenerate_wall_representation
from .remove_boolean import remove_boolean
from .remove_representation import remove_representation
@@ -20,6 +20,7 @@ from collections import deque
from collections.abc import Callable
from functools import partial
from typing import Any, Literal, Optional, Union, get_args
import ifcopenshell
import ifcopenshell.api.context
import ifcopenshell.api.geometry
@@ -16,10 +16,11 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from typing import Optional
import ifcopenshell
import ifcopenshell.api.sequence
import ifcopenshell.util.element
from typing import Optional
def unassign_sequence(
@@ -25,9 +25,7 @@ from typing import TYPE_CHECKING, Any, Literal, Optional, TypeVar, Union, cast,
import ifcopenshell
from .. import ifcopenshell_wrapper, open
from .. import entity_instance
from .. import file
from .. import entity_instance, file, ifcopenshell_wrapper, open
from . import has_occ
if TYPE_CHECKING:
+1 -2
View File
@@ -30,8 +30,7 @@ import ifcopenshell
import ifcopenshell.util.attribute
import ifcopenshell.util.schema
from . import ifcopenshell_wrapper
from . import file, entity_instance
from . import entity_instance, file, ifcopenshell_wrapper
if TYPE_CHECKING:
import sqlite3
@@ -28,8 +28,7 @@ try:
import ifcopenshell.util.attribute
import ifcopenshell.util.schema
from . import ifcopenshell_wrapper
from . import file
from . import file, ifcopenshell_wrapper
class StreamTransformer(Transformer):
file: file
@@ -22,6 +22,7 @@ import uuid
from typing import Optional
from ifcopenshell import file
from .guid import compress
from .ifcopenshell_wrapper import version
@@ -57,8 +57,9 @@ from collections.abc import Iterator
from logging import Handler, Logger
from pathlib import Path
from types import EllipsisType
from typing import TYPE_CHECKING, Any, Optional, Union, TypeAlias, Literal
from typing_extensions import TypedDict, NotRequired
from typing import TYPE_CHECKING, Any, Literal, Optional, TypeAlias, Union
from typing_extensions import NotRequired, TypedDict
import ifcopenshell
import ifcopenshell.express.rule_executor
@@ -20,6 +20,7 @@
import math
import pytest
import ifcopenshell
import ifcopenshell.api.aggregate
import ifcopenshell.api.alignment
@@ -1,6 +1,7 @@
import time
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
for i in range(3):
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
for i, box_alignment in enumerate(["top-left", "center", "invalid", "CENTER"]):
@@ -1,6 +1,7 @@
import time
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
latitudes = [
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
for depth in (-1.0, 0.0, 1.0):
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import fail_if, normalize_header, write_fixture
for i, (r1, r2) in enumerate(
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
options = {
@@ -2,6 +2,7 @@ import itertools
import time
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
for pty, ety in itertools.product(("GRILLE", "USERDEFINED"), (None, "Something")):
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import fail_if, normalize_header, write_fixture
create_none = lambda f: None
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import fail_if, normalize_header, write_fixture
create_plane = lambda f: f.createIfcPlane(f.createIfcAxis2Placement3D(f.createIfcCartesianPoint((0.0, 0.0, 0.0))))
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
pts = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0)]
@@ -1,6 +1,7 @@
import itertools
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
defaults = {"Girth": 1.0, "WallThickness": 0.11}
@@ -1,5 +1,6 @@
import ifcopenshell
import ifcopenshell.util.schema
from ...fixture_generate import normalize_header, pass_if, write_fixture
depth = 1.0
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, write_fixture
coords = [(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0)]
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, write_fixture
coords = [(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0)]
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
dims = [
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
coords = [(0.0, 0.0), (10.0, 0.0)]
@@ -1,6 +1,7 @@
import time
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
names = [("Same", "Same"), ("Different", "SomethingElse")]
@@ -1,6 +1,7 @@
import time
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
for i, nm in enumerate(("no-mls", "mls", "mlsu")):
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
for i, type_decl in enumerate(("IfcLengthMeasure", "IfcPlaneAngleMeasure")):
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
make_nd = lambda d: lambda *c: (c + (0.0,)) if d == 3 else c
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
task = lambda f: f.createIfcTask(ifcopenshell.guid.new(), None, "sleep", IsMilestone=True)
@@ -1,6 +1,7 @@
import itertools
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
for cnt in range(0, 3):
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
fns = [
@@ -1,6 +1,7 @@
import time
import ifcopenshell
from ...fixture_generate import normalize_header, pass_if, write_fixture
for ents in [
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import fail_if, normalize_header, write_fixture
segs = [
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, write_fixture
cases = (
@@ -1,4 +1,5 @@
import ifcopenshell
from ...fixture_generate import normalize_header, write_fixture
ifc_file = ifcopenshell.file(schema="IFC2X3")
@@ -1,6 +1,7 @@
import ifcopenshell
import ifcopenshell.api.owner
import ifcopenshell.api.root
from ...fixture_generate import normalize_header, pass_if, write_fixture
guid1 = "3pdqyORIn8KBHZAhhtJ72T"
@@ -16,8 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell
import pytest
import ifcopenshell
import test.bootstrap
@@ -5,6 +5,7 @@ import tabulate
import ifcopenshell.express.rule_executor
import ifcopenshell.validate
from .fixture_generate import FailObj, Result, parse_result
@@ -1,4 +1,5 @@
import csv
from pathlib import Path
import pytest
@@ -6,8 +7,6 @@ import ifcopenshell
import ifcopenshell.geom
import ifcopenshell.util.shape
from pathlib import Path
repo_root = Path(__file__).resolve().parent.parent.parent.parent
test_files = repo_root / "test" / "input" / "tests"
@@ -22,6 +22,7 @@ import pytest
import tabulate
import ifcopenshell.validate
from .fixture_generate import FailObj, Result, parse_result
_filepaths = list((Path(__file__).parent / "fixtures/validate").glob("*.ifc"))
@@ -19,10 +19,9 @@
import ifcopenshell.api.control
import ifcopenshell.api.cost
import test.bootstrap
import ifcopenshell.api.root
import ifcopenshell.util.cost as subject
import test.bootstrap
class TestGetCostItemForProduct(test.bootstrap.IFC4):
@@ -38,7 +38,6 @@ import ifcopenshell.api.sequence
import ifcopenshell.api.spatial
import ifcopenshell.api.style
import ifcopenshell.api.type
import ifcopenshell.api.feature
import ifcopenshell.guid
import ifcopenshell.util.element as subject
import test.bootstrap
@@ -19,12 +19,6 @@
import logging
from typing import TypeVar, Union
import numpy as np
import numpy.typing as npt
import shapely
import shapely.ops
from shapely.geometry.polygon import orient
import ifcopenshell
import ifcopenshell.api.geometry
import ifcopenshell.geom
@@ -33,7 +27,12 @@ import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.shape
import ifcopenshell.util.unit
import numpy as np
import numpy.typing as npt
import shapely
import shapely.ops
from ifcopenshell.util.shape_builder import ShapeBuilder
from shapely.geometry.polygon import orient
import ifcpatch
@@ -19,8 +19,7 @@
from __future__ import annotations
import logging
from typing import Optional, TYPE_CHECKING
from typing import TYPE_CHECKING, Optional
import ifcopenshell
import ifcopenshell.util.shape_builder
@@ -20,7 +20,6 @@ from collections.abc import Sequence
from logging import Logger
from typing import Union
import ifcpatch
import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.geolocation
@@ -16,9 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import numpy as np
import pytest
import ifcopenshell.api.aggregate
import ifcopenshell.api.context
import ifcopenshell.api.geometry
@@ -28,6 +25,8 @@ import ifcopenshell.geom
import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.shape
import numpy as np
import pytest
from ifcopenshell.util.shape_builder import ShapeBuilder
import ifcpatch
+1 -1
View File
@@ -17,9 +17,9 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell.api.project
import pytest
import ifcopenshell.api.project
import ifcpatch
import test.bootstrap
+1 -2
View File
@@ -22,10 +22,9 @@ import logging
import sys
from unittest import mock
import pytest
import ifcopenshell
import ifcopenshell.guid
import pytest
import ifcpatch
import test.bootstrap
+1 -1
View File
@@ -24,12 +24,12 @@ import os
import re
import sys
from typing import Literal, Optional, TypedDict, Union
from typing_extensions import NotRequired
import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.placement
import ifcopenshell.util.unit
from typing_extensions import NotRequired
from .facet import Facet, FacetFailure
from .ids import Ids, Specification