Sort imports

This commit is contained in:
Andrej730
2025-12-19 18:53:04 +05:00
parent 29176330e8
commit 13be6ccd45
731 changed files with 2234 additions and 1709 deletions
+5 -5
View File
@@ -16,11 +16,11 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import toposort
import ifcpatch
import ifcpatch.recipes
import ifcopenshell.util.selector
import ifcopenshell.util.element
import ifcopenshell.util.schema
import ifcopenshell.util.selector
import ifcpatch.__main__
import ifcpatch.recipes
import toposort
import ifcpatch
+10 -10
View File
@@ -18,22 +18,22 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import os
import shutil
import sys
import ifcopenshell
import logging
import typing
import inspect
import collections
import importlib
import importlib.util
import inspect
import logging
import os
import re
from pathlib import Path
from typing import Union, Optional, Any, TypedDict
from typing_extensions import NotRequired
import shutil
import sys
import typing
from collections.abc import Sequence
from pathlib import Path
from typing import Any, Optional, TypedDict, Union
import ifcopenshell
from typing_extensions import NotRequired
__version__ = version = "0.0.0"
+3 -1
View File
@@ -19,9 +19,11 @@
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import argparse
import ifcpatch
import ifcopenshell
import ifcpatch
parser = argparse.ArgumentParser(description="Patches IFC files to fix badly formatted data")
parser.add_argument("-i", "--input", type=str, required=True, help="The IFC file to patch")
parser.add_argument("-o", "--output", type=str, help="The output file to save the patched IFC")
+11 -10
View File
@@ -17,22 +17,23 @@
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import os
import csv
import numpy as np
import os
from itertools import cycle
import ifcopenshell
import ifcopenshell.api.pset
import ifcopenshell.api.root
import ifcopenshell.api.unit
import ifcopenshell.api.style
import ifcopenshell.api.aggregate
import ifcopenshell.api.context
import ifcopenshell.api.document
import ifcopenshell.api.project
import ifcopenshell.api.spatial
import ifcopenshell.api.geometry
import ifcopenshell.api.aggregate
import ifcopenshell.api.project
import ifcopenshell.api.pset
import ifcopenshell.api.root
import ifcopenshell.api.spatial
import ifcopenshell.api.style
import ifcopenshell.api.unit
import ifcopenshell.util.shape_builder
from itertools import cycle
import numpy as np
from ifcopenshell.util.shape_builder import V
@@ -16,13 +16,14 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import typing
from logging import Logger
from typing import Union
import ifcopenshell
import ifcopenshell.util.alignment
import ifcpatch
from logging import Logger
import typing
from typing import Union
import ifcpatch
class Patcher(ifcpatch.BasePatcher):
@@ -16,13 +16,14 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import typing
from logging import Logger
from typing import Union
import ifcopenshell
import ifcopenshell.util.alignment
import ifcpatch
from logging import Logger
import typing
from typing import Union
import ifcpatch
class Patcher(ifcpatch.BasePatcher):
@@ -16,13 +16,14 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import typing
from logging import Logger
from typing import Union
import ifcopenshell
import ifcopenshell.util.alignment
import ifcpatch
from logging import Logger
import typing
from typing import Union
import ifcpatch
class Patcher(ifcpatch.BasePatcher):
@@ -16,10 +16,11 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
from logging import Logger
import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.unit
from logging import Logger
class Patcher:
@@ -16,17 +16,18 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import typing
from logging import Logger
from typing import Union
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.owner.settings
import ifcopenshell.util.pset
import ifcopenshell.util.element
import ifcopenshell.util.pset
import ifcopenshell.util.unit
import ifcpatch
from logging import Logger
import typing
from typing import Union
import ifcpatch
LengthUnit = typing.Literal[
"ATTOMETER",
@@ -16,13 +16,14 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
from logging import Logger
from typing import Union
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.pset
import ifcopenshell.util.pset
import ifcopenshell.util.element
from logging import Logger
from typing import Union
import ifcopenshell.util.pset
class Patcher:
@@ -16,14 +16,16 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
from logging import Logger
from typing import Union
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.project
import ifcopenshell.guid
import ifcopenshell.util.selector
import ifcpatch
from typing import Union
from logging import Logger
class Patcher(ifcpatch.BasePatcher):
@@ -17,11 +17,12 @@
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import json
import os
import re
import json
import time
import tempfile
import time
import ifcopenshell
import ifcopenshell.util.element
@@ -22,13 +22,14 @@ import math
import os
from typing import Union
import ifcpatch
import ifcopenshell
import ifcopenshell.geom
import ifcopenshell.util.element
import ifcopenshell.util.schema
import ifcopenshell.util.unit
import ifcpatch
class Patcher(ifcpatch.BasePatcher):
def __init__(self, file: ifcopenshell.file, logger: Union[logging.Logger, None] = None):
@@ -17,6 +17,7 @@
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import logging
import ifcopenshell
@@ -67,11 +68,11 @@ class Patcher:
self.filepath = filepath
def patch(self) -> None:
import bpy
import bonsai.tool as tool
import bpy
import ifcopenshell
import ifcopenshell.util.element
from mathutils import Vector, Matrix
from mathutils import Matrix, Vector
if len(bpy.data.objects) > 0:
bpy.data.batch_remove(bpy.data.objects)
@@ -17,12 +17,13 @@
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import logging
from typing import Optional
import ifcopenshell
import ifcopenshell.util.schema
import ifcopenshell.util.shape_builder
import ifcopenshell.util.unit
import logging
from typing import Optional
class Patcher:
@@ -110,9 +111,9 @@ class Patcher:
self.should_create_edges = should_create_edges
def patch(self) -> None:
import bpy
import bmesh
import bonsai.tool as tool
import bpy
import ifcopenshell.util.shape_builder
bpy.context.scene.BIMProjectProperties.should_use_native_meshes = True
@@ -161,15 +162,15 @@ class Patcher:
self.file = tool.Ifc.get()
def create_edges(self, obj):
import bpy
import bmesh
import bonsai.tool as tool
import bpy
import ifcopenshell.api.geometry
import ifcopenshell.api.root
import ifcopenshell.api.spatial
import ifcopenshell.api.type
import ifcopenshell.util.element
import ifcopenshell.util.representation
import ifcopenshell.api.root
import ifcopenshell.api.type
import ifcopenshell.api.spatial
import ifcopenshell.api.geometry
element = tool.Ifc.get_entity(obj)
data = obj.data
@@ -229,16 +230,17 @@ class Patcher:
def create_face_sampleable_object(self, obj):
# No sharp faces
import bpy
from math import degrees
import bmesh
import bonsai.tool as tool
import bpy
import ifcopenshell.api.geometry
import ifcopenshell.api.root
import ifcopenshell.api.spatial
import ifcopenshell.api.type
import ifcopenshell.util.element
import ifcopenshell.util.representation
import ifcopenshell.api.root
import ifcopenshell.api.type
import ifcopenshell.api.spatial
import ifcopenshell.api.geometry
from math import degrees
print("working on ", obj.name)
element = tool.Ifc.get_entity(obj)
@@ -278,16 +280,17 @@ class Patcher:
def create_edge_sampleable_object(self, obj):
# This is crazy but we need a sharp face per island
import bpy
from math import degrees, radians, sin
import bmesh
import bonsai.tool as tool
import bpy
import ifcopenshell.api.geometry
import ifcopenshell.api.root
import ifcopenshell.api.spatial
import ifcopenshell.api.type
import ifcopenshell.util.element
import ifcopenshell.util.representation
import ifcopenshell.api.root
import ifcopenshell.api.type
import ifcopenshell.api.spatial
import ifcopenshell.api.geometry
from math import degrees, radians, sin
from mathutils import Matrix
# Get the active object (assumed to have a mesh)
@@ -17,9 +17,10 @@
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell
import logging
import ifcopenshell
class Patcher:
def __init__(self, file: None, logger: logging.Logger, filepath: str, is_solid: bool = True):
@@ -79,10 +80,11 @@ class Patcher:
self.is_solid = is_solid
def patch(self) -> None:
import bpy
from math import degrees
import bmesh
import bonsai.tool as tool
from math import degrees
import bpy
props = tool.Project.get_project_props()
props.should_use_native_meshes = True
+12 -9
View File
@@ -17,16 +17,18 @@
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import itertools
import json
import logging
import multiprocessing
import os
import re
import json
import time
import tempfile
import time
import typing
import itertools
import logging
import numpy as np
import multiprocessing
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal, Union
import ifcopenshell
import ifcopenshell.geom
import ifcopenshell.ifcopenshell_wrapper as W
@@ -37,15 +39,16 @@ import ifcopenshell.util.representation
import ifcopenshell.util.schema
import ifcopenshell.util.shape
import ifcopenshell.util.unit
import ifcpatch
from pathlib import Path
from typing import Any, TYPE_CHECKING, Literal, Union
import numpy as np
from typing_extensions import assert_never
import ifcpatch
SQLTypes = typing.Literal["SQLite", "MySQL"]
if TYPE_CHECKING:
import sqlite3
import mysql.connector
import mysql.connector.abstracts
else:
@@ -16,12 +16,13 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
from logging import Logger
from typing import Any
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.type
import ifcopenshell.util.element
from logging import Logger
from typing import Any
class Patcher:
@@ -16,14 +16,16 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import numpy as np
from logging import Logger
from typing import Union
import ifcopenshell
import ifcopenshell.util.unit
import ifcopenshell.util.element
import ifcopenshell.util.geolocation
import ifcopenshell.util.unit
import numpy as np
from ifcpatch.recipes.SetFalseOrigin import Patcher as SetFalseOrigin
from typing import Union
from logging import Logger
class Patcher:
+5 -3
View File
@@ -16,12 +16,14 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell
import ifcopenshell.util.element
import ifcpatch
import logging
from typing import Union
import ifcopenshell
import ifcopenshell.util.element
import ifcpatch
class Patcher(ifcpatch.BasePatcher):
def __init__(self, file: ifcopenshell.file, logger: Union[logging.Logger, None] = None):
+5 -3
View File
@@ -16,12 +16,14 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import typing
from logging import Logger
from typing import Union
import ifcopenshell
import ifcopenshell.util.schema
import ifcpatch
import typing
from typing import Union
from logging import Logger
class Patcher(ifcpatch.BasePatcher):
@@ -17,10 +17,11 @@
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import math
import numpy as np
import typing
import ifcopenshell
import ifcopenshell.util.placement
import typing
import numpy as np
from ifcopenshell.util.shape_builder import ShapeBuilder
@@ -1,11 +1,12 @@
import typing
from logging import Logger
from typing import Union
import ifcopenshell
import ifcopenshell.api.alignment
import ifcopenshell.util.element
import ifcpatch
from logging import Logger
import typing
from typing import Union
import ifcpatch
class Patcher(ifcpatch.BasePatcher):
+2 -1
View File
@@ -17,9 +17,10 @@
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import datetime
import ifcopenshell
from logging import Logger
import ifcopenshell
class Patcher:
def __init__(self, file: ifcopenshell.file, logger: Logger):
@@ -16,8 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
from collections import deque
import logging
from collections import deque
import ifcopenshell.util.element
@@ -16,9 +16,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
from logging import Logger
import ifcopenshell
import ifcopenshell.guid
from logging import Logger
class Patcher:
@@ -17,10 +17,11 @@
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import logging
from typing import Literal, Optional, Union
import ifcopenshell
import numpy as np
import numpy.typing as npt
import ifcopenshell
from typing import Literal, Optional, Union
class Patcher:
@@ -16,8 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell
import logging
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.geometry
import ifcopenshell.util
@@ -16,11 +16,17 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import typing
import ifcopenshell
import ifcopenshell.api.georeference
import ifcopenshell.util.geolocation
from ifcpatch.recipes import OffsetObjectPlacements, SetWorldCoordinateSystem, ResetSpatialElementLocations
import typing
from ifcpatch.recipes import (
OffsetObjectPlacements,
ResetSpatialElementLocations,
SetWorldCoordinateSystem,
)
class Patcher:
@@ -17,9 +17,10 @@
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import math
import numpy as np
import typing
import numpy as np
class Patcher:
def __init__(
@@ -16,12 +16,13 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import os
import logging
import ifcopenshell
import os
from pathlib import Path
from typing import Union
import ifcopenshell
class Patcher:
def __init__(self, file: ifcopenshell.file, logger: logging.Logger, output_dir: Union[str, None] = None):
@@ -45,10 +46,11 @@ class Patcher:
self.output_dir = output_dir
def patch(self) -> None:
import ifcopenshell
import tempfile
from shutil import copyfile
import ifcopenshell
if self.output_dir is None:
output_dir = Path()
else:
@@ -16,16 +16,17 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import multiprocessing
from logging import Logger
from typing import Union
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.geometry
import ifcopenshell.geom
import ifcopenshell.util.representation
import ifcopenshell.util.selector
import ifcopenshell.util.shape
import ifcopenshell.util.representation
import multiprocessing
from logging import Logger
from typing import Union
class Patcher:
@@ -16,12 +16,13 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
from logging import Logger
import ifcopenshell
import ifcopenshell.api.pset
import ifcopenshell.guid
import ifcopenshell.util.element
import ifcopenshell.util.selector
from logging import Logger
class Patcher:
+2 -2
View File
@@ -16,11 +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 pytest
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.project
import ifcopenshell.api.owner.settings
import ifcopenshell.api.project
import pytest
class IFC4X3:
+2 -1
View File
@@ -16,12 +16,13 @@
# 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 test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.root
import ifcopenshell.api.unit
import ifcopenshell.util.unit
import ifcpatch
import test.bootstrap
class TestConvertLengthUnit(test.bootstrap.IFC4):
@@ -16,11 +16,12 @@
# 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 ifcpatch
import ifcopenshell
import ifcopenshell.api.pset
import ifcopenshell.api.root
import ifcopenshell.util.element
import ifcpatch
import test.bootstrap
+4 -2
View File
@@ -17,14 +17,16 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import os
import pytest
import ifcpatch
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.aggregate
import ifcopenshell.api.root
import ifcopenshell.api.spatial
import ifcopenshell.util.element
import pytest
import ifcpatch
import test.bootstrap
+4 -2
View File
@@ -17,7 +17,8 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import tempfile
import ifcpatch
from pathlib import Path
import ifcopenshell
import ifcopenshell.api.context
import ifcopenshell.api.geometry
@@ -28,7 +29,8 @@ import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.shape
import ifcopenshell.util.shape_builder
from pathlib import Path
import ifcpatch
class TestIfc2Sql:
@@ -17,8 +17,7 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import os
import pytest
import ifcpatch
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.geometry
@@ -27,6 +26,9 @@ import ifcopenshell.api.root
import ifcopenshell.api.type
import ifcopenshell.util.element
import ifcopenshell.util.representation
import pytest
import ifcpatch
import test.bootstrap
+7 -5
View File
@@ -16,7 +16,10 @@
# 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 ifcpatch
import tempfile
from pathlib import Path
from typing import Optional
import ifcopenshell
import ifcopenshell.api.context
import ifcopenshell.api.geometry
@@ -29,11 +32,10 @@ import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.shape
import ifcopenshell.util.shape_builder
import test.bootstrap
import tempfile
import numpy as np
from pathlib import Path
from typing import Optional
import ifcpatch
import test.bootstrap
class TestMergeProjects(test.bootstrap.IFC4):
+2 -1
View File
@@ -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 ifcpatch
import ifcopenshell
import ifcpatch
import test.bootstrap
@@ -17,12 +17,14 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import os
import pytest
import ifcpatch
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.root
import ifcopenshell.util.element
import pytest
import ifcpatch
import test.bootstrap
@@ -16,16 +16,17 @@
# 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 test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.aggregate
import ifcopenshell.api.geometry
import ifcopenshell.api.root
import ifcopenshell.api.unit
import ifcopenshell.util.placement
import ifcpatch
import numpy as np
import ifcpatch
import test.bootstrap
class TestResetSpatialElementLocations(test.bootstrap.IFC4):
def test_run(self):
+3 -2
View File
@@ -16,7 +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 test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.aggregate
import ifcopenshell.api.context
@@ -27,9 +26,11 @@ import ifcopenshell.api.unit
import ifcopenshell.util.element
import ifcopenshell.util.geolocation
import ifcopenshell.util.placement
import ifcpatch
import numpy as np
import ifcpatch
import test.bootstrap
class TestSetFalseOrigin(test.bootstrap.IFC4):
def test_run(self):
+4 -3
View File
@@ -16,19 +16,20 @@
# 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.util.representation
import ifcpatch
import ifcopenshell
import ifcopenshell.api.context
import ifcopenshell.api.geometry
import ifcopenshell.api.profile
import ifcopenshell.api.root
import ifcopenshell.api.unit
import test.bootstrap
import ifcopenshell.geom
import ifcopenshell.util.element
import ifcopenshell.util.representation
from ifcopenshell.util.shape_builder import ShapeBuilder
import ifcpatch
import test.bootstrap
class TestTesselateElements(test.bootstrap.IFC4):
def test_run(self):
+2 -1
View File
@@ -16,11 +16,12 @@
# 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 ifcpatch
import ifcopenshell
import ifcopenshell.api.pset
import ifcopenshell.geom
import ifcopenshell.util.element
import ifcpatch
import test.bootstrap
+4 -2
View File
@@ -17,10 +17,12 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import tempfile
import ifcopenshell.api.root
import ifcpatch
from pathlib import Path
import ifcopenshell.api.root
import ifcpatch
class Test:
def test_parsing_docs(self):