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
@@ -17,6 +17,7 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import math
import ifcopenshell
import ifcopenshell.util.unit
@@ -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/>.
from typing import Literal, Union
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
from typing import Union, Literal
PrimitiveType = Literal["entity", "string", "float", "integer", "boolean", "enum", "binary"]
ComplexPrimitiveType = Literal["list", "array", "set"]
@@ -16,14 +16,14 @@
# 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 os
import json
import os
from typing import Union
import ifcopenshell
import ifcopenshell.util.classification
import ifcopenshell.util.element
import ifcopenshell.util.system
from typing import Union
cwd = os.path.dirname(os.path.realpath(__file__))
@@ -16,9 +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 ifcopenshell.util.element
from typing import Optional
import ifcopenshell.util.element
def get_references(element: ifcopenshell.entity_instance, should_inherit=True) -> set[ifcopenshell.entity_instance]:
"""Gets classification references associated with the element
@@ -18,9 +18,10 @@
#
#
import ifcopenshell
from typing import Union
import ifcopenshell
def get_constraints(product: ifcopenshell.entity_instance) -> list[ifcopenshell.entity_instance]:
"""
@@ -16,10 +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 lark
import ifcopenshell
from typing import Optional, Union, Literal, Any
from collections.abc import Generator
from typing import Any, Literal, Optional, Union
import lark
import ifcopenshell
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
import ifcopenshell.util.attribute
import ifcopenshell.util.element
@@ -17,10 +17,13 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations
import numpy as np
import ifcopenshell
from typing import Any, Union
from dataclasses import dataclass
from typing import Any, Union
import numpy as np
import ifcopenshell
from ifcopenshell.util.shape_builder import ShapeBuilder
@@ -16,12 +16,14 @@
# 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 datetime
import isodate
from re import findall
from typing import Any, Literal, Union, overload
import isodate
from dateutil import parser
from typing import Literal, Union, Any, overload
import ifcopenshell
def timedelta2duration(timedelta):
@@ -16,27 +16,30 @@
# 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 copy
import json
from pathlib import Path
import copy
from typing import Any, Literal, Optional, TypedDict, Union
from typing_extensions import NotRequired
import ifcopenshell
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
import ifcopenshell.util.attribute
import ifcopenshell.util.schema
from typing import Optional, Literal, Any, Union, TypedDict
from typing_extensions import NotRequired
try:
import glob
import warnings
import requests
import urllib.parse
from markdown import markdown
from bs4 import BeautifulSoup, MarkupResemblesLocatorWarning
import zipfile
from lxml import etree
import re
import shutil
import urllib.parse
import warnings
import zipfile
import requests
from bs4 import BeautifulSoup, MarkupResemblesLocatorWarning
from lxml import etree
from markdown import markdown
except:
pass # Only necessary if you're using it to generate the docs database
@@ -16,14 +16,14 @@
# 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 collections import namedtuple
from collections.abc import Callable, Generator, Sequence
from typing import Any, Literal, Optional, Union, overload
import ifcopenshell
import ifcopenshell.guid
import ifcopenshell.util.element
import ifcopenshell.util.representation
from typing import Any, Optional, Union, Literal, overload
from collections.abc import Callable, Generator, Sequence
from collections import namedtuple
MATERIAL_TYPE = Literal[
"IfcMaterial",
@@ -17,7 +17,8 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import zipfile
from typing import IO, Union, TypedDict
from typing import IO, TypedDict, Union
from typing_extensions import NotRequired
@@ -16,11 +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/>.
from typing import Literal
from typing_extensions import assert_never
import ifcopenshell
import ifcopenshell.ifcopenshell_wrapper as W
import ifcopenshell.util.attribute
from typing import Literal
from typing_extensions import assert_never
# COBie actually uses an exclusion list, but this inclusion list is equivalent.
cobie_type_classes = [
@@ -18,22 +18,23 @@
RUN_FROM_DEV_REPO = False
import ifcopenshell.ifcopenshell_wrapper as W
import ifcopenshell.api.unit
import ifcopenshell.api.project
import ifcopenshell.guid
import ifcopenshell.util.attribute
import glob
import sys
from pathlib import Path
from lxml import etree
from itertools import chain
from pathlib import Path
from typing import cast
from lxml import etree
import ifcopenshell.api.project
import ifcopenshell.api.unit
import ifcopenshell.guid
import ifcopenshell.ifcopenshell_wrapper as W
import ifcopenshell.util.attribute
if not RUN_FROM_DEV_REPO:
import zipfile
import shutil
import zipfile
BASE_MODULE_PATH = Path(__file__).parent
@@ -17,12 +17,14 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import math
from decimal import ROUND_HALF_UP, Decimal
from typing import NamedTuple, Optional, Union
import numpy as np
import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.placement
from typing import NamedTuple, Optional, Union
from decimal import Decimal, ROUND_HALF_UP
MatrixType = ifcopenshell.util.placement.MatrixType
@@ -17,7 +17,12 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
try:
from server import get_resource_path, resource_documentation_builder, process_markdown, R
from server import (
R,
get_resource_path,
process_markdown,
resource_documentation_builder,
)
except ModuleNotFoundError as e:
print(
"ERROR. Failed to import `server.py`.\n"
@@ -26,13 +31,15 @@ except ModuleNotFoundError as e:
raise e
import itertools
import operator
import json
import ifcopenshell
import operator
from collections import Counter
from bs4 import BeautifulSoup
from typing import Any, Union
from bs4 import BeautifulSoup
import ifcopenshell
# Hacky modified functions from server.py to make parser work
def get_definition_from_md(resource: str, mdc: str) -> str:
@@ -26,8 +26,8 @@ try:
except ImportError:
LARK_AVAILABLE = False
from typing import Union
import re
from typing import Union
if LARK_AVAILABLE:
mvd_grammar = r"""
@@ -16,11 +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/>.
from collections.abc import Iterable
from typing import Literal, Optional
import numpy as np
import numpy.typing as npt
import ifcopenshell
from typing import Literal, Optional
from collections.abc import Iterable
MatrixType = npt.NDArray[np.float64]
"""`npt.NDArray[np.float64]`"""
@@ -16,15 +16,16 @@
# 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 re
import pathlib
import re
from functools import lru_cache
from typing import Literal, NamedTuple, Optional, Union
import ifcopenshell
import ifcopenshell.ifcopenshell_wrapper as W
import ifcopenshell.util.schema
import ifcopenshell.util.type
from ifcopenshell.entity_instance import entity_instance
from functools import lru_cache
from typing import Optional, Literal, NamedTuple, Union
templates: dict[ifcopenshell.util.schema.IFC_SCHEMA, "PsetQto"] = {}
@@ -16,15 +16,16 @@
# 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 collections.abc import Generator, Sequence
from typing import Literal, Optional, TypedDict, Union
import numpy as np
import numpy.typing as npt
import ifcopenshell
import ifcopenshell.util.representation
import ifcopenshell.util.placement
import ifcopenshell.util.shape
from typing import Optional, Union, TypedDict, Literal
from collections.abc import Generator, Sequence
import ifcopenshell
import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.shape
CONTEXT_TYPE = Literal["Model", "Plan", "NotDefined"]
REPRESENTATION_IDENTIFIER = Literal[
@@ -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 ifcopenshell.util.cost
import ifcopenshell.util.element
import ifcopenshell.util.date
from typing import Union, Any
from typing import Any, Union
import ifcopenshell.util.cost
import ifcopenshell.util.date
import ifcopenshell.util.element
PRODUCTIVITY_PSET_DATA = Union[dict[str, Any], None]
# https://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/IfcConstructionResource.htm#Table-7.3.3.7.1.3.H
@@ -16,13 +16,14 @@
# 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 os
import json
import os
import time
from typing import Any, Literal, Union
import ifcopenshell
import ifcopenshell.util.attribute
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
from typing import Union, Any, Literal
import ifcopenshell.util.attribute
# This is highly experimental and incomplete, however, it may work for simple datasets.
@@ -30,6 +30,7 @@ import ast
import difflib
from pathlib import Path
from typing import Union
from typing_extensions import assert_never
@@ -18,10 +18,16 @@
import re
import sys
from collections.abc import Iterable
from decimal import Decimal
from types import EllipsisType
from typing import Any, Optional, Union
import lark
import numpy as np
import ifcopenshell.api.pset
import ifcopenshell.api.geometry
import ifcopenshell.api.pset
import ifcopenshell.util
import ifcopenshell.util.attribute
import ifcopenshell.util.classification
@@ -34,11 +40,6 @@ import ifcopenshell.util.schema
import ifcopenshell.util.shape
import ifcopenshell.util.system
import ifcopenshell.util.unit
from decimal import Decimal
from typing import Optional, Any, Union
from collections.abc import Iterable
from types import EllipsisType
filter_elements_grammar = lark.Lark(
"""start: filter_group
@@ -17,13 +17,13 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import datetime
from collections.abc import Generator
from functools import cache
from math import floor
from typing import Literal, Optional, Union
import ifcopenshell.util.date
import ifcopenshell.util.element
from math import floor
from functools import cache
from typing import Union, Literal, Optional
from collections.abc import Generator
DURATION_TYPE = Literal["ELAPSEDTIME", "WORKTIME", "NOTDEFINED"]
RECURRENCE_TYPE = Literal[
@@ -16,18 +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 shapely
import shapely.ops
from math import cos, radians
from typing import Literal, Optional, Union
import numpy as np
import numpy.typing as npt
import shapely
import shapely.ops
import ifcopenshell.ifcopenshell_wrapper as W
import ifcopenshell.util.element
import ifcopenshell.util.placement
import ifcopenshell.util.representation
from ifcopenshell.util.shape_builder import VectorType
from math import radians, cos
from ifcopenshell.geom import ShapeElementType
from typing import Optional, Literal, Union
from ifcopenshell.util.shape_builder import VectorType
tol = 1e-6
AXIS_LITERAL = Literal["X", "Y", "Z"]
@@ -17,20 +17,23 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations
import numpy as np
import numpy.typing as npt
import collections
import collections.abc
from collections.abc import Sequence
from itertools import chain
from math import atan, cos, degrees, pi, radians, sin, sqrt, tan
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
import numpy as np
import numpy.typing as npt
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.util.element
import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.unit
from math import cos, sin, pi, tan, radians, degrees, atan, sqrt
from typing import Union, Optional, Literal, Any, TYPE_CHECKING
from collections.abc import Sequence
from itertools import chain
PRECISION = 1.0e-5
@@ -17,8 +17,9 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from typing import Literal, Optional, Union
import ifcopenshell.util.system
from typing import Optional, Union, Literal
group_types: dict[str, tuple[str, ...]] = {
"IfcZone": ("IfcZone", "IfcSpace", "IfcSpatialZone"),
@@ -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 os
import json
import os
import ifcopenshell.util.schema
cwd = os.path.dirname(os.path.realpath(__file__))
@@ -16,14 +16,14 @@
# 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 collections.abc import Generator
from fractions import Fraction
from math import pi
from typing import Literal, Optional, Union
from collections.abc import Generator
import ifcopenshell
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
import ifcopenshell.api.unit
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
prefixes = {
"EXA": 1e18,
@@ -869,10 +869,10 @@ def iter_element_and_attributes_per_type(ifc_file: ifcopenshell.file, attr_type_
def convert_file_length_units(ifc_file: ifcopenshell.file, target_units: str = "METER") -> ifcopenshell.file:
"""Converts all units in an IFC file to the specified target units. Returns a new file."""
import ifcopenshell.util.element
import ifcopenshell.util.geolocation
import ifcopenshell.api.georeference
import ifcopenshell.api.unit
import ifcopenshell.util.element
import ifcopenshell.util.geolocation
prefix = get_prefix(target_units)
si_unit = get_unit_name(target_units)