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
@@ -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