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
+2 -2
View File
@@ -1,9 +1,9 @@
import os
import pathlib import pathlib
import shutil import shutil
import zipfile
import requests import requests
import zipfile
import os
# To test this locally, set these environment variables # To test this locally, set these environment variables
REPO_OWNER = os.environ.get("REPO_OWNER", "IfcOpenShell/IfcOpenShell") REPO_OWNER = os.environ.get("REPO_OWNER", "IfcOpenShell/IfcOpenShell")
+1 -1
View File
@@ -1,6 +1,6 @@
import boto3
import ifcopenshell import ifcopenshell
import ifcopenshell.util.element import ifcopenshell.util.element
import boto3
s3 = boto3.client('s3') s3 = boto3.client('s3')
+3 -2
View File
@@ -13,9 +13,10 @@ import hashlib
import os import os
import pathlib import pathlib
import re import re
from urllib import request
from github import Github
from typing import NoReturn from typing import NoReturn
from urllib import request
from github import Github
def get_repo_tag_names() -> list[str]: def get_repo_tag_names() -> list[str]:
@@ -1,6 +1,5 @@
import bpy import bpy
bpy.ops.preferences.addon_disable(module='blenderbim') bpy.ops.preferences.addon_disable(module='blenderbim')
bpy.ops.wm.save_userpref() bpy.ops.wm.save_userpref()
@@ -1,6 +1,5 @@
import bpy import bpy
bpy.ops.preferences.addon_enable(module='blenderbim') bpy.ops.preferences.addon_enable(module='blenderbim')
bpy.ops.wm.save_userpref() bpy.ops.wm.save_userpref()
+2 -1
View File
@@ -1,7 +1,8 @@
import re
import argparse import argparse
import re
from pathlib import Path from pathlib import Path
def update_version(file_path: str, version: str) -> None: def update_version(file_path: str, version: str) -> None:
"""Update the version string in the given __init__.py file.""" """Update the version string in the given __init__.py file."""
file_path = Path(file_path) file_path = Path(file_path)
+1
View File
@@ -1,4 +1,5 @@
import textwrap import textwrap
# The `extensions` list should already be in here from `sphinx-quickstart` # The `extensions` list should already be in here from `sphinx-quickstart`
extensions = [ extensions = [
# there may be others here already, e.g. 'sphinx.ext.mathjax' # there may be others here already, e.g. 'sphinx.ext.mathjax'
+2 -2
View File
@@ -1,10 +1,10 @@
# This program requires doxygen, sphinx, breathe and exhale. # This program requires doxygen, sphinx, breathe and exhale.
import multiprocessing
import os import os
import sys
import shutil import shutil
import subprocess import subprocess
import multiprocessing import sys
# some extra check to see if we can find sphinx in pypy bin dir # some extra check to see if we can find sphinx in pypy bin dir
sphinx_build = os.path.join(os.path.dirname(sys.executable), 'sphinx-build') sphinx_build = os.path.join(os.path.dirname(sys.executable), 'sphinx-build')
+13 -12
View File
@@ -99,35 +99,36 @@ Used environment variables:
""" """
import logging
import os
import re
import sys
import glob import glob
import subprocess as sp import logging
import shutil
import tarfile
import multiprocessing import multiprocessing
import os
import platform import platform
import threading import re
import sysconfig import shutil
from datetime import datetime
# @todo temporary for expired mpfr.org certificate on 2023-04-08 # @todo temporary for expired mpfr.org certificate on 2023-04-08
import ssl import ssl
import subprocess as sp
import sys
import sysconfig
import tarfile
import threading
from datetime import datetime
ssl._create_default_https_context = ssl._create_unverified_context ssl._create_default_https_context = ssl._create_unverified_context
import time import time
from urllib.request import urlretrieve
from collections.abc import Generator, Sequence from collections.abc import Generator, Sequence
from pathlib import Path from pathlib import Path
from urllib.request import urlretrieve
try: try:
from typing import Union, Literal from typing import Literal, Union
except: except:
# python 3.6 compatibility for rocky 8 # python 3.6 compatibility for rocky 8
from typing import Union from typing import Union
from typing_extensions import Literal from typing_extensions import Literal
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
+1 -2
View File
@@ -8,12 +8,11 @@ or unpacks existing archives.
Usage: python cache_dependencies.py [pack|unpack] Usage: python cache_dependencies.py [pack|unpack]
""" """
import tarfile
import sys import sys
import tarfile
from pathlib import Path from pathlib import Path
from typing import Literal from typing import Literal
CACHE_PREFIX = "cache-" CACHE_PREFIX = "cache-"
-1
View File
@@ -1,6 +1,5 @@
from pathlib import Path from pathlib import Path
WHEEL_FILENAME = next( WHEEL_FILENAME = next(
p.name for p in (Path.cwd() / "pyodide").iterdir() if p.name.startswith("ifcopenshell-") and p.suffix == ".whl" p.name for p in (Path.cwd() / "pyodide").iterdir() if p.name.startswith("ifcopenshell-") and p.suffix == ".whl"
) )
+1
View File
@@ -47,6 +47,7 @@ select = [
"UP", # pyupgrade "UP", # pyupgrade
"RUF015", # next() > list_comprehension[0] "RUF015", # next() > list_comprehension[0]
"RUF022", # sort __all__ "RUF022", # sort __all__
"I", # import sorting
] ]
ignore = [ ignore = [
"FA100", # Conflicts with Blender using annotations for props definitions. "FA100", # Conflicts with Blender using annotations for props definitions.
+3 -2
View File
@@ -1,7 +1,8 @@
from dataclasses import fields
from typing import NamedTuple, Union
import bcf.v2.model.extensions import bcf.v2.model.extensions
import bcf.v3.model.extensions import bcf.v3.model.extensions
from typing import NamedTuple, Union
from dataclasses import fields
class AttributeData(NamedTuple): class AttributeData(NamedTuple):
+2 -1
View File
@@ -1,6 +1,7 @@
from typing import Union
import bcf.v2.model import bcf.v2.model
import bcf.v3.model import bcf.v3.model
from typing import Union
BimSnippet = Union[bcf.v2.model.BimSnippet, bcf.v3.model.BimSnippet] BimSnippet = Union[bcf.v2.model.BimSnippet, bcf.v3.model.BimSnippet]
BitMap = Union[bcf.v2.model.VisualizationInfoBitmap, bcf.v3.model.Bitmap] BitMap = Union[bcf.v2.model.VisualizationInfoBitmap, bcf.v3.model.Bitmap]
+4 -3
View File
@@ -1,13 +1,14 @@
import tempfile import tempfile
from pathlib import Path
from typing import Optional, Union
import bcf.agnostic.model as mdl
import bcf.v2.bcfxml import bcf.v2.bcfxml
import bcf.v2.model import bcf.v2.model
import bcf.v2.topic import bcf.v2.topic
import bcf.v3.bcfxml import bcf.v3.bcfxml
import bcf.v3.model import bcf.v3.model
import bcf.v3.topic import bcf.v3.topic
import bcf.agnostic.model as mdl
from pathlib import Path
from typing import Union, Optional
from typing_extensions import assert_never from typing_extensions import assert_never
TopicHandler = Union[bcf.v2.topic.TopicHandler, bcf.v3.topic.TopicHandler] TopicHandler = Union[bcf.v2.topic.TopicHandler, bcf.v3.topic.TopicHandler]
+3 -2
View File
@@ -1,5 +1,6 @@
import bcf.v2.visinfo
import bcf.v3.visinfo
from typing import Union from typing import Union
import bcf.v2.visinfo
import bcf.v3.visinfo
VisualizationInfoHandler = Union[bcf.v2.visinfo.VisualizationInfoHandler, bcf.v3.visinfo.VisualizationInfoHandler] VisualizationInfoHandler = Union[bcf.v2.visinfo.VisualizationInfoHandler, bcf.v3.visinfo.VisualizationInfoHandler]
-1
View File
@@ -29,7 +29,6 @@ from bcf.v3.bcfxml import BcfXml as BcfXml3
from bcf.v3.model import Version as Version3 from bcf.v3.model import Version as Version3
from bcf.xml_parser import AbstractXmlParserSerializer, XmlParserSerializer from bcf.xml_parser import AbstractXmlParserSerializer, XmlParserSerializer
BcfXml = Union[BcfXml2, BcfXml3] BcfXml = Union[BcfXml2, BcfXml3]
+1
View File
@@ -7,6 +7,7 @@ original idea from https://stackoverflow.com/a/19722365/1307905
""" """
from __future__ import annotations from __future__ import annotations
import zipfile import zipfile
from io import BytesIO from io import BytesIO
from os import PathLike from os import PathLike
+1
View File
@@ -1,6 +1,7 @@
"""BCF XML V2 handler.""" """BCF XML V2 handler."""
from __future__ import annotations from __future__ import annotations
import uuid import uuid
import warnings import warnings
import zipfile import zipfile
+1
View File
@@ -1,6 +1,7 @@
"""BCF XML V2 Topic handler.""" """BCF XML V2 Topic handler."""
from __future__ import annotations from __future__ import annotations
import datetime import datetime
import tempfile import tempfile
import uuid import uuid
+3 -3
View File
@@ -1,12 +1,12 @@
import uuid import uuid
import zipfile import zipfile
from typing import Any, Optional, Literal, Union
from collections.abc import Iterable from collections.abc import Iterable
from typing import Any, Literal, Optional, Union
import ifcopenshell.util.placement
import ifcopenshell.util.unit
import numpy as np import numpy as np
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
import ifcopenshell.util.unit
import ifcopenshell.util.placement
from numpy.typing import NDArray from numpy.typing import NDArray
import bcf.v2.model as mdl import bcf.v2.model as mdl
+1
View File
@@ -1,6 +1,7 @@
"""BCF XML V3 handlers.""" """BCF XML V3 handlers."""
from __future__ import annotations from __future__ import annotations
import uuid import uuid
import warnings import warnings
import zipfile import zipfile
+1
View File
@@ -1,6 +1,7 @@
"""BCF XML V3 Topic handler.""" """BCF XML V3 Topic handler."""
from __future__ import annotations from __future__ import annotations
import datetime import datetime
import uuid import uuid
import zipfile import zipfile
+3 -3
View File
@@ -1,12 +1,12 @@
import uuid import uuid
import zipfile import zipfile
from typing import Any, Optional, Literal, Union
from collections.abc import Iterable from collections.abc import Iterable
from typing import Any, Literal, Optional, Union
import ifcopenshell.util.placement
import ifcopenshell.util.unit
import numpy as np import numpy as np
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
import ifcopenshell.util.unit
import ifcopenshell.util.placement
from numpy.typing import NDArray from numpy.typing import NDArray
import bcf.v3.model as mdl import bcf.v3.model as mdl
-1
View File
@@ -1,5 +1,4 @@
import pytest import pytest
from bcf.xml_parser import XmlParserSerializer from bcf.xml_parser import XmlParserSerializer
+1 -2
View File
@@ -4,9 +4,8 @@ import uuid
from pathlib import Path from pathlib import Path
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
import pytest
import bcf.v2.model as mdl import bcf.v2.model as mdl
import pytest
from bcf.v2.bcfxml import BcfXml from bcf.v2.bcfxml import BcfXml
from bcf.v2.topic import TopicHandler from bcf.v2.topic import TopicHandler
from bcf.v2.visinfo import ( from bcf.v2.visinfo import (
+1 -2
View File
@@ -3,11 +3,10 @@ import os
import zipfile import zipfile
from pathlib import Path from pathlib import Path
from xsdata.models.datatype import XmlDateTime
import bcf.v2.model as mdl import bcf.v2.model as mdl
from bcf.v2.bcfxml import BcfXml from bcf.v2.bcfxml import BcfXml
from bcf.v2.topic import TopicHandler from bcf.v2.topic import TopicHandler
from xsdata.models.datatype import XmlDateTime
def test_maximum_information() -> None: def test_maximum_information() -> None:
-1
View File
@@ -1,6 +1,5 @@
import numpy as np import numpy as np
import pytest import pytest
from bcf.v2.bcfxml import BcfXml from bcf.v2.bcfxml import BcfXml
+1 -2
View File
@@ -4,9 +4,8 @@ import uuid
from pathlib import Path from pathlib import Path
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
import pytest
import bcf.v3.model as mdl import bcf.v3.model as mdl
import pytest
from bcf.v3.bcfxml import BcfXml from bcf.v3.bcfxml import BcfXml
from bcf.v3.topic import TopicHandler from bcf.v3.topic import TopicHandler
from bcf.v3.visinfo import ( from bcf.v3.visinfo import (
+1 -2
View File
@@ -3,11 +3,10 @@ import os
import zipfile import zipfile
from pathlib import Path from pathlib import Path
from xsdata.models.datatype import XmlDateTime
import bcf.v3.model as mdl import bcf.v3.model as mdl
from bcf.v3.bcfxml import BcfXml from bcf.v3.bcfxml import BcfXml
from bcf.v3.topic import TopicHandler from bcf.v3.topic import TopicHandler
from xsdata.models.datatype import XmlDateTime
def test_doc_ref_internal() -> None: def test_doc_ref_internal() -> None:
-1
View File
@@ -1,6 +1,5 @@
import numpy as np import numpy as np
import pytest import pytest
from bcf.v3.bcfxml import BcfXml from bcf.v3.bcfxml import BcfXml
+5
View File
@@ -38,3 +38,8 @@ exclude = ["test*"]
[tool.ruff] [tool.ruff]
extend = "../../pyproject.toml" extend = "../../pyproject.toml"
[tool.ruff.lint]
ignore = [
"I", # import sorting - ignore it temporarily, still need to do some tests
]
+5 -5
View File
@@ -17,15 +17,15 @@
# along with bSDD. If not, see <http://www.gnu.org/licenses/>. # along with bSDD. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import uuid import http.server
import time import time
import urllib.parse import urllib.parse
import requests import uuid
import webbrowser import webbrowser
import http.server from typing import TYPE_CHECKING, Any, Literal, Optional, TypedDict
from typing import TypedDict, Literal, Optional, TYPE_CHECKING, Any
from typing_extensions import NotRequired
import requests
from typing_extensions import NotRequired
if TYPE_CHECKING: if TYPE_CHECKING:
import ifcopenshell import ifcopenshell
+6 -4
View File
@@ -1,11 +1,13 @@
from __future__ import annotations from __future__ import annotations
from .type_hints import *
from typing import Optional, Literal
from datetime import datetime
from pydantic import BaseModel, Field, PrivateAttr, model_validator, ConfigDict
import json import json
import weakref import weakref
from datetime import datetime
from typing import Literal, Optional
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr, model_validator
from .type_hints import *
def _lower_first(s: str) -> str: def _lower_first(s: str) -> str:
-1
View File
@@ -1,6 +1,5 @@
from typing import Literal from typing import Literal
COUNTRY_CODE = Literal[ COUNTRY_CODE = Literal[
"AF", "AF",
"AX", "AX",
+1 -1
View File
@@ -1,8 +1,8 @@
import yaml
import sys import sys
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any
import yaml
type_to_python_type = { type_to_python_type = {
"string": "str", "string": "str",
+3 -2
View File
@@ -17,11 +17,12 @@
# along with Ifc2CA. If not, see <http://www.gnu.org/licenses/>. # along with Ifc2CA. If not, see <http://www.gnu.org/licenses/>.
import json import json
import ifcopenshell
import ifcopenshell.guid
import os import os
from datetime import datetime from datetime import datetime
import ifcopenshell
import ifcopenshell.guid
class CA2IFC: class CA2IFC:
def __init__(self, inputFilename, outputFilename): def __init__(self, inputFilename, outputFilename):
@@ -16,11 +16,12 @@
# 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 Ifc2CA. If not, see <http://www.gnu.org/licenses/>. # along with Ifc2CA. If not, see <http://www.gnu.org/licenses/>.
import json
import numpy as np
import itertools import itertools
import json
from pathlib import Path from pathlib import Path
import numpy as np
flatten = itertools.chain.from_iterable flatten = itertools.chain.from_iterable
ScaleFactor = 1.0 ScaleFactor = 1.0
+8 -6
View File
@@ -16,15 +16,16 @@
# 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 Ifc2CA. If not, see <http://www.gnu.org/licenses/>. # along with Ifc2CA. If not, see <http://www.gnu.org/licenses/>.
import itertools
import json
import os import os
import time import time
import json from pathlib import Path
import numpy as np
import salome import salome
import salome_notebook import salome_notebook
import salome_version import salome_version
import numpy as np
import itertools
from pathlib import Path
flatten = itertools.chain.from_iterable flatten = itertools.chain.from_iterable
@@ -155,10 +156,11 @@ class MODEL:
### ###
### GEOM component ### GEOM component
### ###
import GEOM
from salome.geom import geomBuilder
import math import math
import GEOM
import SALOMEDS import SALOMEDS
from salome.geom import geomBuilder
gg = salome.ImportComponentGUI("GEOM") gg = salome.ImportComponentGUI("GEOM")
if NEW_SALOME: if NEW_SALOME:
+1
View File
@@ -17,6 +17,7 @@
# along with Ifc2CA. If not, see <http://www.gnu.org/licenses/>. # along with Ifc2CA. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import json import json
import os import os
import subprocess import subprocess
+3 -4
View File
@@ -1,13 +1,12 @@
import argparse
import os import os
import sys import sys
import argparse
import ifcopenshell
from ifc4d.msp2ifc import MSP2Ifc
from ifc4d.p6xer2ifc import P6XER2Ifc from ifc4d.p6xer2ifc import P6XER2Ifc
from ifc4d.p62ifc import P62Ifc from ifc4d.p62ifc import P62Ifc
from ifc4d.msp2ifc import MSP2Ifc
from ifc4d.pp2ifc import PP2Ifc from ifc4d.pp2ifc import PP2Ifc
import ifcopenshell
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("-f", "--file", action="store", type=str, required=True, help="schedule file name to be parsed") parser.add_argument("-f", "--file", action="store", type=str, required=True, help="schedule file name to be parsed")
+4 -2
View File
@@ -1,12 +1,14 @@
from __future__ import annotations from __future__ import annotations
from datetime import date, datetime, timedelta
from typing import Any, TypedDict, Union
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.api.control import ifcopenshell.api.control
import ifcopenshell.api.resource import ifcopenshell.api.resource
import ifcopenshell.api.sequence import ifcopenshell.api.sequence
import ifcopenshell.util.date import ifcopenshell.util.date
from datetime import datetime, timedelta, date
from typing import Union, Any, TypedDict
from typing_extensions import NotRequired from typing_extensions import NotRequired
+7 -6
View File
@@ -17,23 +17,24 @@
# along with IfcResources. If not, see <http://www.gnu.org/licenses/>. # along with IfcResources. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import csv
import _csv import _csv
import ifcopenshell.api.resource import csv
import isodate import datetime
from typing import Any, Literal, NamedTuple, Optional, Union, cast, get_args
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.api.cost import ifcopenshell.api.cost
import ifcopenshell.api.pset import ifcopenshell.api.pset
import ifcopenshell.api.resource
import ifcopenshell.api.root import ifcopenshell.api.root
import ifcopenshell.api.unit import ifcopenshell.api.unit
import ifcopenshell.util.date import ifcopenshell.util.date
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.resource import ifcopenshell.util.resource
import ifcopenshell.util.unit import ifcopenshell.util.unit
import datetime import isodate
from typing import Any, Optional, Union, Literal, get_args, NamedTuple, cast
SUPPORTED_COLUMN = Literal[ SUPPORTED_COLUMN = Literal[
"HIERARCHY", "HIERARCHY",
+3 -2
View File
@@ -18,13 +18,14 @@
import csv import csv
import locale
import re
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.api.root import ifcopenshell.api.root
import ifcopenshell.api.sequence import ifcopenshell.api.sequence
import ifcopenshell.util.date import ifcopenshell.util.date
import locale
import re
class Csv2Ifc: class Csv2Ifc:
+3 -2
View File
@@ -16,12 +16,13 @@
# 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 Ifc4D. If not, see <http://www.gnu.org/licenses/>. # along with Ifc4D. If not, see <http://www.gnu.org/licenses/>.
import uuid
import datetime import datetime
import uuid
import xml.etree.ElementTree as ET
import ifcopenshell import ifcopenshell
import ifcopenshell.util.date import ifcopenshell.util.date
import ifcopenshell.util.sequence import ifcopenshell.util.sequence
import xml.etree.ElementTree as ET
class Ifc2Msp: class Ifc2Msp:
+4 -2
View File
@@ -16,12 +16,14 @@
# 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 Ifc4D. If not, see <http://www.gnu.org/licenses/>. # along with Ifc4D. If not, see <http://www.gnu.org/licenses/>.
import uuid
import datetime import datetime
import uuid
import xml.etree.ElementTree as ET
import ifcopenshell import ifcopenshell
import ifcopenshell.util.date import ifcopenshell.util.date
import ifcopenshell.util.sequence import ifcopenshell.util.sequence
import xml.etree.ElementTree as ET
from .common import ScheduleIfcGenerator from .common import ScheduleIfcGenerator
+3 -2
View File
@@ -17,7 +17,9 @@
# along with Ifc4D. If not, see <http://www.gnu.org/licenses/>. # along with Ifc4D. If not, see <http://www.gnu.org/licenses/>.
import datetime import datetime
from datetime import timedelta, date import xml.etree.ElementTree as ET
from datetime import date, timedelta
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.api.control import ifcopenshell.api.control
@@ -25,7 +27,6 @@ import ifcopenshell.api.pset
import ifcopenshell.api.root import ifcopenshell.api.root
import ifcopenshell.api.sequence import ifcopenshell.api.sequence
import ifcopenshell.util.date import ifcopenshell.util.date
import xml.etree.ElementTree as ET
class MSP2Ifc: class MSP2Ifc:
+4 -2
View File
@@ -16,12 +16,14 @@
# 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 Ifc4D. If not, see <http://www.gnu.org/licenses/>. # along with Ifc4D. If not, see <http://www.gnu.org/licenses/>.
import math
import datetime import datetime
import math
import xml.etree.ElementTree as ET
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.util.date import ifcopenshell.util.date
import xml.etree.ElementTree as ET
from .common import ScheduleIfcGenerator from .common import ScheduleIfcGenerator
+4 -2
View File
@@ -16,11 +16,13 @@
# 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 Ifc4D. If not, see <http://www.gnu.org/licenses/>. # along with Ifc4D. If not, see <http://www.gnu.org/licenses/>.
from xerparser.reader import Reader from datetime import date, datetime, timedelta
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.util.date import ifcopenshell.util.date
from datetime import datetime, timedelta, date from xerparser.reader import Reader
from .common import ScheduleIfcGenerator from .common import ScheduleIfcGenerator
+6 -5
View File
@@ -5,16 +5,17 @@ import sys
print("In module products sys.path[0], __package__ ==", sys.path[0], __package__) print("In module products sys.path[0], __package__ ==", sys.path[0], __package__)
sys.path.append(sys.path[0]) sys.path.append(sys.path[0])
import sqlite3
import datetime import datetime
from datetime import timedelta import sqlite3
import ifcopenshell.util.date
from .wpattern import AstaCalendarWorkPattern
from .common import ScheduleIfcGenerator, Calendar, WBSEntry, Activity
import time import time
from collections import defaultdict from collections import defaultdict
from datetime import timedelta
from typing import Any from typing import Any
import ifcopenshell.util.date
from .common import Activity, Calendar, ScheduleIfcGenerator, WBSEntry
from .wpattern import AstaCalendarWorkPattern
list_of_tables = [ list_of_tables = [
"BAR", "BAR",
+2 -1
View File
@@ -7,8 +7,9 @@ for each day as a key there is a list of working times with the format
""" """
import re import re
from datetime import time, datetime from datetime import datetime, time
from typing import Any from typing import Any
from ifc4d.common import WorkSlot from ifc4d.common import WorkSlot
+8 -6
View File
@@ -17,19 +17,21 @@
# along with Ifc5D. If not, see <http://www.gnu.org/licenses/>. # along with Ifc5D. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import csv import csv
import locale
from pathlib import Path
from typing import Optional, TypedDict, Union
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.api.control import ifcopenshell.api.control
import ifcopenshell.api.cost import ifcopenshell.api.cost
import ifcopenshell.api.root import ifcopenshell.api.root
import ifcopenshell.util.unit
import ifcopenshell.util.selector
import ifcopenshell.util.element
import ifcopenshell.util.cost import ifcopenshell.util.cost
import locale import ifcopenshell.util.element
from pathlib import Path import ifcopenshell.util.selector
from typing import Union, Optional, TypedDict import ifcopenshell.util.unit
from typing_extensions import NotRequired from typing_extensions import NotRequired
+3 -3
View File
@@ -1,11 +1,11 @@
import ifcopenshell
import ifcopenshell.util.unit
from typing import Any from typing import Any
import ifcopenshell
import ifcopenshell.util.cost import ifcopenshell.util.cost
import ifcopenshell.util.date import ifcopenshell.util.date
import ifcopenshell.util.unit
from ifcopenshell.util.classification import get_references from ifcopenshell.util.classification import get_references
CostItem = dict[str, Any] CostItem = dict[str, Any]
+14 -10
View File
@@ -18,18 +18,20 @@
from __future__ import annotations from __future__ import annotations
import os
import time
import argparse import argparse
import datetime import datetime
import logging import logging
import os
import time
from collections import Counter
from typing import Any, Optional, TypedDict, Union
import ifcopenshell import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.cost import ifcopenshell.util.cost
import ifcopenshell.util.date import ifcopenshell.util.date
import ifcopenshell.util.element
import ifcopenshell.util.unit import ifcopenshell.util.unit
from collections import Counter
from typing import Union, Optional, Any, TypedDict
class CostItem(TypedDict): class CostItem(TypedDict):
@@ -418,9 +420,9 @@ class Ifc5DCsvWriter(Ifc5Dwriter):
class Ifc5DOdsWriter(Ifc5Dwriter): class Ifc5DOdsWriter(Ifc5Dwriter):
def write(self) -> None: def write(self) -> None:
from odf.number import CurrencyStyle, CurrencySymbol, Number, NumberStyle, Text
from odf.opendocument import OpenDocumentSpreadsheet from odf.opendocument import OpenDocumentSpreadsheet
from odf.style import Style, TableCellProperties from odf.style import Style, TableCellProperties
from odf.number import NumberStyle, CurrencyStyle, CurrencySymbol, Number, Text
super().write() super().write()
@@ -448,9 +450,9 @@ class Ifc5DOdsWriter(Ifc5Dwriter):
self.doc.save(os.path.join(self.output, file_name), True) self.doc.save(os.path.join(self.output, file_name), True)
def write_table(self, cost_schedule): def write_table(self, cost_schedule):
from odf.table import Table, TableRow, TableCell from odf.number import CurrencyStyle, CurrencySymbol, Number, NumberStyle, Text
from odf.table import Table, TableCell, TableRow
from odf.text import P from odf.text import P
from odf.number import NumberStyle, CurrencyStyle, CurrencySymbol, Number, Text
def row(): def row():
return TableRow() return TableRow()
@@ -594,11 +596,13 @@ class Ifc5DPdfWriter(Ifc5Dwriter):
def write(self) -> None: def write(self) -> None:
import os import os
import ifc5d
import shutil import shutil
import typst
import tempfile import tempfile
import typst
import ifc5d
DEFAULT_OPTIONS = { DEFAULT_OPTIONS = {
"nested_structure_depth": 0, "nested_structure_depth": 0,
"parent_to_new_page_up_to_depth": 0, "parent_to_new_page_up_to_depth": 0,
+9 -8
View File
@@ -18,24 +18,25 @@
import functools import functools
import itertools import itertools
import json
import multiprocessing
import os import os
import types import types
import json from collections import defaultdict
from collections.abc import Iterable
from typing import Any, Literal, NamedTuple, Union, get_args
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.api.pset import ifcopenshell.api.pset
import ifcopenshell.geom import ifcopenshell.geom
import ifcopenshell.ifcopenshell_wrapper as W import ifcopenshell.ifcopenshell_wrapper as W
import ifcopenshell.util.unit
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.representation
import ifcopenshell.util.selector import ifcopenshell.util.selector
import ifcopenshell.util.shape import ifcopenshell.util.shape
import ifcopenshell.util.representation
import ifcopenshell.util.type import ifcopenshell.util.type
import multiprocessing import ifcopenshell.util.unit
from collections import defaultdict
from typing import Any, Literal, get_args, Union, NamedTuple
from collections.abc import Iterable
class Function(NamedTuple): class Function(NamedTuple):
@@ -545,8 +546,8 @@ class Blender(QtoCalculator):
@classmethod @classmethod
def calculate(cls, ifc_file, elements, qtos, results): def calculate(cls, ifc_file, elements, qtos, results):
import bonsai.tool as tool
import bonsai.bim.module.qto.calculator as calculator import bonsai.bim.module.qto.calculator as calculator
import bonsai.tool as tool
unit_converter = SI2ProjectUnitConverter(ifc_file) unit_converter = SI2ProjectUnitConverter(ifc_file)
formula_functions: dict[str, types.FunctionType] = {} formula_functions: dict[str, types.FunctionType] = {}
+6 -5
View File
@@ -16,17 +16,18 @@
# 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 tempfile
import csv import csv
import pytest import tempfile
from pathlib import Path
import ifc5d.csv2ifc
import ifc5d.ifc5Dspreadsheet
import ifcopenshell import ifcopenshell
import ifcopenshell.api.root import ifcopenshell.api.root
import ifcopenshell.api.unit import ifcopenshell.api.unit
import ifcopenshell.util.cost import ifcopenshell.util.cost
import ifcopenshell.util.element import ifcopenshell.util.element
import ifc5d.csv2ifc import pytest
import ifc5d.ifc5Dspreadsheet
from pathlib import Path
class TestCsv2Ifc: class TestCsv2Ifc:
+1 -2
View File
@@ -16,8 +16,7 @@
# 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 BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
from os.path import dirname from os.path import dirname, realpath
from os.path import realpath
__version__ = version = "0.0.0" __version__ = version = "0.0.0"
+2 -1
View File
@@ -16,10 +16,11 @@
# 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 BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell
import os import os
from pathlib import Path from pathlib import Path
import ifcopenshell
class TestPurger: class TestPurger:
def __init__(self): def __init__(self):
@@ -17,15 +17,12 @@
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
import os import os
from behave.model import Scenario
from behave.model import Scenario
from bimtester.ifc import IfcStore from bimtester.ifc import IfcStore
from bimtester.lang import switch_locale from bimtester.lang import switch_locale
from logfile import append_logfile from logfile import append_logfile, create_logfile
from logfile import create_logfile from zoom_smart_view import add_smartview, create_zoom_set_of_smartviews
from zoom_smart_view import add_smartview
from zoom_smart_view import create_zoom_set_of_smartviews
this_path = os.path.dirname(os.path.realpath(__file__)) this_path = os.path.dirname(os.path.realpath(__file__))
@@ -16,8 +16,7 @@
# 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 BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
from behave import step, given, when, then, use_step_matcher from behave import given, step, then, use_step_matcher, when
from bimtester import util from bimtester import util
from bimtester.ifc import IfcStore from bimtester.ifc import IfcStore
from bimtester.table import TableModel from bimtester.table import TableModel
@@ -26,7 +26,7 @@ use_step_matcher("parse")
from bimtester.features.steps.attributes_eleclasses import de, en from bimtester.features.steps.attributes_eleclasses import de, en
use_step_matcher("parse") use_step_matcher("parse")
from bimtester.features.steps.attributes_psets import en, de from bimtester.features.steps.attributes_psets import de, en
use_step_matcher("parse") use_step_matcher("parse")
from bimtester.features.steps.attributes_qsets import en from bimtester.features.steps.attributes_qsets import en
@@ -17,7 +17,6 @@
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
from behave import step from behave import step
from bimtester.ifc import IfcStore from bimtester.ifc import IfcStore
from bimtester.lang import _ from bimtester.lang import _
@@ -17,9 +17,7 @@
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell.util.element as eleutils import ifcopenshell.util.element as eleutils
from behave import step from behave import step
from bimtester import util from bimtester import util
from bimtester.ifc import IfcStore from bimtester.ifc import IfcStore
from bimtester.lang import _ from bimtester.lang import _
@@ -16,9 +16,7 @@
# 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 BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
from behave import step from behave import step, use_step_matcher
from behave import use_step_matcher
from bimtester import util from bimtester import util
from bimtester.ifc import IfcStore from bimtester.ifc import IfcStore
from bimtester.lang import _ from bimtester.lang import _
@@ -48,6 +46,7 @@ def step_impl(context, ifc_class, property_path):
) )
def step_impl(context, ifc_class, property_path, pattern): def step_impl(context, ifc_class, property_path, pattern):
import re import re
from ifcopenshell.util.element import get_psets from ifcopenshell.util.element import get_psets
pset_name, property_name = property_path.split(".") pset_name, property_name = property_path.split(".")
@@ -17,8 +17,8 @@
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
import json import json
from behave import step
from behave import step
from bimtester import util from bimtester import util
from bimtester.ifc import IfcStore from bimtester.ifc import IfcStore
from bimtester.lang import _ from bimtester.lang import _
@@ -17,7 +17,6 @@
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
from behave import step from behave import step
from bimtester import util from bimtester import util
from bimtester.ifc import IfcStore from bimtester.ifc import IfcStore
from bimtester.lang import _ from bimtester.lang import _
@@ -17,7 +17,6 @@
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
from behave import step, use_step_matcher from behave import step, use_step_matcher
from bimtester import util from bimtester import util
from bimtester.ifc import IfcStore from bimtester.ifc import IfcStore
from bimtester.lang import _ from bimtester.lang import _
@@ -17,14 +17,13 @@
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
import math import math
import numpy as np
import ifcopenshell import ifcopenshell
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.placement
import ifcopenshell.util.geolocation import ifcopenshell.util.geolocation
import ifcopenshell.util.placement
import numpy as np
from behave import step from behave import step
from bimtester import util from bimtester import util
from bimtester.ifc import IfcStore from bimtester.ifc import IfcStore
from bimtester.lang import _ from bimtester.lang import _
@@ -17,7 +17,6 @@
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
from behave import step from behave import step
from bimtester import util from bimtester import util
from bimtester.ifc import IfcStore from bimtester.ifc import IfcStore
from bimtester.lang import _ from bimtester.lang import _
@@ -18,9 +18,7 @@
import ifcopenshell.util.geolocation import ifcopenshell.util.geolocation
import ifcopenshell.util.placement import ifcopenshell.util.placement
from behave import step from behave import step
from bimtester import util from bimtester import util
from bimtester.ifc import IfcStore from bimtester.ifc import IfcStore
from bimtester.lang import _ from bimtester.lang import _
@@ -17,7 +17,6 @@
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
from behave import step from behave import step
from bimtester import util from bimtester import util
from bimtester.ifc import IfcStore from bimtester.ifc import IfcStore
from bimtester.lang import _ from bimtester.lang import _
@@ -17,7 +17,6 @@
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
from behave import step from behave import step
from bimtester.ifc import IfcStore from bimtester.ifc import IfcStore
from bimtester.lang import _ from bimtester.lang import _
+3 -5
View File
@@ -16,18 +16,16 @@
# 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 BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
import os
import json import json
import os
import sys import sys
import webbrowser import webbrowser
from PySide2 import QtCore, QtGui, QtWidgets
import bimtester.reports import bimtester.reports
import bimtester.run import bimtester.run
from PySide2 import QtCore
from PySide2 import QtGui
from PySide2 import QtWidgets
def run(): def run():
app = QtWidgets.QApplication(sys.argv) app = QtWidgets.QApplication(sys.argv)
+3 -1
View File
@@ -19,8 +19,10 @@
import datetime import datetime
import json import json
import os import os
import pystache
import sys import sys
import pystache
from bimtester.lang import _ from bimtester.lang import _
+9 -7
View File
@@ -16,27 +16,29 @@
# 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 BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import json import json
import shutil
import logging import logging
import os
import shutil
import sys
import tempfile import tempfile
import ifcopenshell import ifcopenshell
try: try:
import ifcopenshell.express import ifcopenshell.express
except: except:
pass # They are using an old version of IfcOpenShell. Gracefully degrade for now. pass # They are using an old version of IfcOpenShell. Gracefully degrade for now.
import behave.formatter.pretty # Needed for pyinstaller to package it
from bimtester.ifc import IfcStore
from distutils.dir_util import copy_tree from distutils.dir_util import copy_tree
from behave.__main__ import main as behave_main
# TODO: refactor when this isn't super experimental # TODO: refactor when this isn't super experimental
from logging import StreamHandler from logging import StreamHandler
import behave.formatter.pretty # Needed for pyinstaller to package it
from behave.__main__ import main as behave_main
from bimtester.ifc import IfcStore
class TestRunner: class TestRunner:
def __init__(self, ifc_path, schema_path=None, ifc=None): def __init__(self, ifc_path, schema_path=None, ifc=None):
+3 -1
View File
@@ -16,10 +16,12 @@
# 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 BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
import json
import ifcopenshell import ifcopenshell
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.validate import ifcopenshell.validate
import json
from bimtester.lang import _ from bimtester.lang import _
+2 -1
View File
@@ -19,8 +19,9 @@
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
import os
import argparse import argparse
import os
import bimtester.clean import bimtester.clean
import bimtester.reports import bimtester.reports
import bimtester.run import bimtester.run
@@ -16,7 +16,7 @@
# 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 BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
from behave import step, given, when, then, use_step_matcher from behave import given, step, then, use_step_matcher, when
use_step_matcher("parse") use_step_matcher("parse")
@@ -17,10 +17,8 @@
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>. # along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
from behave import step from behave import step
from utils import IfcFile from utils import IfcFile
use_step_matcher("re") use_step_matcher("re")
-1
View File
@@ -21,5 +21,4 @@
from bimtester.guiwidget import run from bimtester.guiwidget import run
run() run()
@@ -40,17 +40,18 @@ if "bpy" in locals():
if "ifcopenshell" in locals(): if "ifcopenshell" in locals():
importlib.reload(ifcopenshell) importlib.reload(ifcopenshell)
import logging
import os
from collections import defaultdict
import bpy
import mathutils
from bpy.props import ( from bpy.props import (
BoolProperty, BoolProperty,
IntProperty, IntProperty,
StringProperty, StringProperty,
) )
from bpy_extras.io_utils import ImportHelper from bpy_extras.io_utils import ImportHelper
from collections import defaultdict
import bpy
import logging
import mathutils
import os
major, minor = bpy.app.version[0:2] major, minor = bpy.app.version[0:2]
transpose_matrices = minor >= 62 transpose_matrices = minor >= 62
+2
View File
@@ -17,7 +17,9 @@
# along with ifccityjson. If not, see <http://www.gnu.org/licenses/>. # along with ifccityjson. If not, see <http://www.gnu.org/licenses/>.
import argparse import argparse
from cjio import cityjson from cjio import cityjson
from .cityjson2ifc import Cityjson2ifc from .cityjson2ifc import Cityjson2ifc
@@ -18,6 +18,8 @@
# along with ifccityjson. If not, see <http://www.gnu.org/licenses/>. # along with ifccityjson. If not, see <http://www.gnu.org/licenses/>.
import os import os
from datetime import datetime
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.api.context import ifcopenshell.api.context
@@ -26,10 +28,9 @@ import ifcopenshell.api.pset
import ifcopenshell.api.root import ifcopenshell.api.root
import ifcopenshell.api.unit import ifcopenshell.api.unit
import ifcopenshell.guid import ifcopenshell.guid
from datetime import datetime
from .geometry import GeometryIO
from . import __version__ from . import __version__
from .geometry import GeometryIO
JSON_TO_IFC = { JSON_TO_IFC = {
"Building": ["IfcBuilding"], "Building": ["IfcBuilding"],
+3 -2
View File
@@ -18,10 +18,11 @@
# 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 IfcClash. If not, see <http://www.gnu.org/licenses/>. # along with IfcClash. If not, see <http://www.gnu.org/licenses/>.
import sys import argparse
import json import json
import logging import logging
import argparse import sys
from .ifcclash import Clasher, ClashSettings from .ifcclash import Clasher, ClashSettings
parser = argparse.ArgumentParser(description="Clashes geometry between two IFC files") parser = argparse.ArgumentParser(description="Clashes geometry between two IFC files")
+8 -5
View File
@@ -20,15 +20,17 @@
from __future__ import annotations from __future__ import annotations
import json import json
import time
import numpy as np
import multiprocessing import multiprocessing
import time
from logging import Logger
from typing import Literal, TypedDict, Union
import ifcopenshell import ifcopenshell
import ifcopenshell.geom import ifcopenshell.geom
import ifcopenshell.util.selector import ifcopenshell.util.selector
from logging import Logger import numpy as np
from typing import Literal, TypedDict, Union
from typing_extensions import NotRequired, assert_never from typing_extensions import NotRequired, assert_never
@@ -256,9 +258,10 @@ class Clasher:
json.dump(clash_sets, clashes_file, indent=4) json.dump(clash_sets, clashes_file, indent=4)
def smart_group_clashes(self, clash_sets: list[ClashSet], max_clustering_distance: float): def smart_group_clashes(self, clash_sets: list[ClashSet], max_clustering_distance: float):
from sklearn.cluster import OPTICS
from collections import defaultdict from collections import defaultdict
from sklearn.cluster import OPTICS
count_of_input_clashes = 0 count_of_input_clashes = 0
count_of_clash_sets = 0 count_of_clash_sets = 0
count_of_smart_groups = 0 count_of_smart_groups = 0
-1
View File
@@ -21,6 +21,5 @@
import os import os
import subprocess import subprocess
cmd = "pyinstaller ./bootstrap.py --name ifcclash --onefile --clean" cmd = "pyinstaller ./bootstrap.py --name ifcclash --onefile --clean"
subprocess.check_output(cmd, shell=True) subprocess.check_output(cmd, shell=True)
+8 -7
View File
@@ -20,23 +20,24 @@
# This can be packaged with `pyinstaller --onefile --clean --icon=icon.ico ifccsv.py` # This can be packaged with `pyinstaller --onefile --clean --icon=icon.ico ifccsv.py`
import argparse
import csv
import os import os
import re import re
import csv from collections.abc import Iterable
import argparse from statistics import mean
from typing import Literal, Optional, Union
import ifcopenshell import ifcopenshell
import ifcopenshell.util.selector
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.schema import ifcopenshell.util.schema
from statistics import mean import ifcopenshell.util.selector
from typing import Optional, Union, Literal
from collections.abc import Iterable
try: try:
from odf.namespaces import OFFICENS from odf.namespaces import OFFICENS
from odf.opendocument import OpenDocumentSpreadsheet, load from odf.opendocument import OpenDocumentSpreadsheet, load
from odf.style import Style, TableCellProperties from odf.style import Style, TableCellProperties
from odf.table import Table, TableRow, TableCell from odf.table import Table, TableCell, TableRow
from odf.text import P from odf.text import P
except: except:
pass # No ODF support pass # No ODF support
+8 -8
View File
@@ -20,23 +20,23 @@
# This can be packaged with `pyinstaller --onefile --clean --icon=icon.ico ifcdiff.py` # This can be packaged with `pyinstaller --onefile --clean --icon=icon.ico ifcdiff.py`
import time import argparse
import json import json
import logging import logging
import argparse
import numpy as np
import multiprocessing import multiprocessing
import time
from typing import Any, Literal, Optional, Union
import ifcopenshell import ifcopenshell
import ifcopenshell.geom import ifcopenshell.geom
import ifcopenshell.util.element
import ifcopenshell.util.selector
import ifcopenshell.util.placement
import ifcopenshell.util.classification import ifcopenshell.util.classification
import ifcopenshell.util.element
import ifcopenshell.util.placement
import ifcopenshell.util.representation import ifcopenshell.util.representation
import ifcopenshell.util.selector
import numpy as np
from deepdiff import DeepDiff from deepdiff import DeepDiff
from orderly_set import OrderedSet from orderly_set import OrderedSet
from typing import Optional, Union, Literal, Any
__version__ = version = "0.0.0" __version__ = version = "0.0.0"
+2 -1
View File
@@ -16,7 +16,6 @@
# 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 ifcdiff
import ifcopenshell import ifcopenshell
import ifcopenshell.api.context import ifcopenshell.api.context
import ifcopenshell.api.geometry import ifcopenshell.api.geometry
@@ -24,6 +23,8 @@ import ifcopenshell.api.root
import ifcopenshell.api.unit import ifcopenshell.api.unit
import ifcopenshell.util.representation import ifcopenshell.util.representation
import ifcdiff
def setup_project() -> ifcopenshell.file: def setup_project() -> ifcopenshell.file:
ifc_file = ifcopenshell.file(schema="IFC4") ifc_file = ifcopenshell.file(schema="IFC4")
+8 -6
View File
@@ -17,15 +17,17 @@
# along with IfcFM. If not, see <http://www.gnu.org/licenses/>. # along with IfcFM. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations from __future__ import annotations
import os
import re
import csv import csv
import importlib import importlib
import ifcopenshell.util.selector import os
from pathlib import Path import re
from collections import defaultdict from collections import defaultdict
from typing import Literal, Union, Any, TYPE_CHECKING
from collections.abc import Callable from collections.abc import Callable
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal, Union
import ifcopenshell.util.selector
try: try:
from openpyxl import Workbook from openpyxl import Workbook
@@ -37,7 +39,7 @@ try:
import odf.namespaces as odf_ns import odf.namespaces as odf_ns
from odf.opendocument import OpenDocumentSpreadsheet from odf.opendocument import OpenDocumentSpreadsheet
from odf.style import Style, TableCellProperties, TableProperties from odf.style import Style, TableCellProperties, TableProperties
from odf.table import Table, TableRow, TableCell from odf.table import Table, TableCell, TableRow
from odf.text import P from odf.text import P
except: except:
pass # No ODF support pass # No ODF support
+3 -1
View File
@@ -16,10 +16,12 @@
# 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 IfcFM. If not, see <http://www.gnu.org/licenses/>. # along with IfcFM. If not, see <http://www.gnu.org/licenses/>.
import ifcfm
import argparse import argparse
import ifcopenshell import ifcopenshell
import ifcfm
parser = argparse.ArgumentParser(description="Extracts FM data from IFC to spreadsheets") parser = argparse.ArgumentParser(description="Extracts FM data from IFC to spreadsheets")
parser.add_argument( parser.add_argument(
"-p", "-p",
+2 -1
View File
@@ -16,6 +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 IfcFM. If not, see <http://www.gnu.org/licenses/>. # along with IfcFM. If not, see <http://www.gnu.org/licenses/>.
from typing import Any, Optional, Union
import ifcopenshell import ifcopenshell
import ifcopenshell.util.classification import ifcopenshell.util.classification
import ifcopenshell.util.date import ifcopenshell.util.date
@@ -23,7 +25,6 @@ import ifcopenshell.util.element
import ifcopenshell.util.fm import ifcopenshell.util.fm
import ifcopenshell.util.placement import ifcopenshell.util.placement
import ifcopenshell.util.system import ifcopenshell.util.system
from typing import Any, Union, Optional
def get_facilities(ifc_file: ifcopenshell.file) -> list[ifcopenshell.entity_instance]: def get_facilities(ifc_file: ifcopenshell.file) -> list[ifcopenshell.entity_instance]:
+3 -3
View File
@@ -16,6 +16,9 @@
# 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 IfcFM. If not, see <http://www.gnu.org/licenses/>. # along with IfcFM. If not, see <http://www.gnu.org/licenses/>.
from collections.abc import Generator
from typing import Any, Optional, Union
import ifcopenshell import ifcopenshell
import ifcopenshell.geom import ifcopenshell.geom
import ifcopenshell.util.classification import ifcopenshell.util.classification
@@ -26,9 +29,6 @@ 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
from collections.abc import Generator
# The original BIMServer plugin has a function called ifcToCOBie: # The original BIMServer plugin has a function called ifcToCOBie:
# https://github.com/opensourceBIM/COBie-plugins/blob/master/COBieShared/src/org/bimserver/cobie/shared/serialization/COBieTabSerializer.java#L54 # https://github.com/opensourceBIM/COBie-plugins/blob/master/COBieShared/src/org/bimserver/cobie/shared/serialization/COBieTabSerializer.java#L54
+2 -2
View File
@@ -16,6 +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 IfcFM. If not, see <http://www.gnu.org/licenses/>. # along with IfcFM. If not, see <http://www.gnu.org/licenses/>.
from typing import Any, Optional, Union
import ifcopenshell import ifcopenshell
import ifcopenshell.guid import ifcopenshell.guid
import ifcopenshell.util.classification import ifcopenshell.util.classification
@@ -24,8 +26,6 @@ import ifcopenshell.util.element
import ifcopenshell.util.fm import ifcopenshell.util.fm
import ifcopenshell.util.placement import ifcopenshell.util.placement
import ifcopenshell.util.system import ifcopenshell.util.system
from typing import Any, Union, Optional
# The original BIMServer plugin has a function called ifcToCOBie: # The original BIMServer plugin has a function called ifcToCOBie:
# https://github.com/opensourceBIM/COBie-plugins/blob/master/COBieShared/src/org/bimserver/cobie/shared/serialization/COBieTabSerializer.java#L54 # https://github.com/opensourceBIM/COBie-plugins/blob/master/COBieShared/src/org/bimserver/cobie/shared/serialization/COBieTabSerializer.java#L54
@@ -54,13 +54,14 @@ Example:
print(wall.Name) print(wall.Name)
""" """
from __future__ import annotations from __future__ import annotations
import os import os
import sys import sys
import zipfile
import tempfile import tempfile
from pathlib import Path import zipfile
from typing import Optional, Union, TYPE_CHECKING, Any, overload, Literal
from collections.abc import Generator, Sequence from collections.abc import Generator, Sequence
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal, Optional, Union, overload
if TYPE_CHECKING: if TYPE_CHECKING:
import ifcopenshell.express.schema_class import ifcopenshell.express.schema_class
@@ -88,12 +89,10 @@ except Exception:
# `_file`, `_stream` is used only for annotations inside this file, # `_file`, `_stream` is used only for annotations inside this file,
# see https://github.com/microsoft/pyright/discussions/9065. # see https://github.com/microsoft/pyright/discussions/9065.
from .file import file as _file
from .file import file
from .file import rocksdb_lazy_instance
from . import guid from . import guid
from .entity_instance import entity_instance, register_schema_attributes from .entity_instance import entity_instance, register_schema_attributes
from .file import file, rocksdb_lazy_instance
from .file import file as _file
from .sql import sqlite, sqlite_entity from .sql import sqlite, sqlite_entity
# explicitly specify available imported symbols # explicitly specify available imported symbols
@@ -110,8 +109,8 @@ __all__ = [
] ]
try: try:
from .stream import stream as _stream, stream_entity from .stream import stream, stream_entity
from .stream import stream from .stream import stream as _stream
except: except:
pass pass
@@ -38,14 +38,16 @@ Also see how to `create a simple model from scratch
<https://docs.ifcopenshell.org/ifcopenshell-python/code_examples.html#create-a-simple-model-from-scratch>`_. <https://docs.ifcopenshell.org/ifcopenshell-python/code_examples.html#create-a-simple-model-from-scratch>`_.
""" """
import json
import numpy
import inspect
import importlib import importlib
import ifcopenshell import inspect
import json
from collections.abc import Callable from collections.abc import Callable
from typing import Any, Optional, TYPE_CHECKING
from functools import partial from functools import partial
from typing import TYPE_CHECKING, Any, Optional
import numpy
import ifcopenshell
if TYPE_CHECKING: if TYPE_CHECKING:
import ifcopenshell.api import ifcopenshell.api
@@ -187,8 +189,8 @@ def remove_all_listeners():
def extract_docs(module: str, usecase: str) -> dict[str, Any]: def extract_docs(module: str, usecase: str) -> dict[str, Any]:
import typing
import collections import collections
import typing
inputs = collections.OrderedDict() inputs = collections.OrderedDict()
@@ -304,8 +306,8 @@ def wrap_usecase(usecase_path, usecase):
def wrap_usecases(path, name): def wrap_usecases(path, name):
"""This developer feature wraps an API module's usecases with listeners.""" """This developer feature wraps an API module's usecases with listeners."""
import sys
import pkgutil import pkgutil
import sys
module_name = name.split(".")[-1] module_name = name.split(".")[-1]
module = sys.modules[name] module = sys.modules[name]
@@ -16,14 +16,15 @@
# 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/>.
from typing import Union
import ifcopenshell import ifcopenshell
import ifcopenshell.api.geometry
import ifcopenshell.api.owner import ifcopenshell.api.owner
import ifcopenshell.api.spatial import ifcopenshell.api.spatial
import ifcopenshell.api.geometry
import ifcopenshell.guid import ifcopenshell.guid
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.placement import ifcopenshell.util.placement
from typing import Union
def assign_object( def assign_object(
@@ -47,45 +47,48 @@ Future versions of this API may support:
5. Adding a segment at any location along a curve 5. Adding a segment at any location along a curve
""" """
from ._get_segment_start_point_label import register_referent_name_callback
from .add_stationing_referent import add_stationing_referent from .add_stationing_referent import add_stationing_referent
from .add_vertical_layout import add_vertical_layout from .add_vertical_layout import add_vertical_layout
from .add_zero_length_segment import add_zero_length_segment from .add_zero_length_segment import add_zero_length_segment
from .create_layout_segment import create_layout_segment
from .create import create from .create import create
from .create_as_offset_curve import create_as_offset_curve from .create_as_offset_curve import create_as_offset_curve
from .create_as_polyline import create_as_polyline from .create_as_polyline import create_as_polyline
from .create_by_pi_method import create_by_pi_method from .create_by_pi_method import create_by_pi_method
from .create_from_csv import create_from_csv from .create_from_csv import create_from_csv
from .create_segment_representations import create_segment_representations from .create_layout_segment import create_layout_segment
from .create_representation import create_representation from .create_representation import create_representation
from .create_segment_representations import create_segment_representations
from .distance_along_from_station import distance_along_from_station from .distance_along_from_station import distance_along_from_station
from .get_alignment import get_alignment from .get_alignment import get_alignment
from .get_alignment_layout_nest import get_alignment_layout_nest from .get_alignment_layout_nest import get_alignment_layout_nest
from .get_alignment_layouts import get_alignment_layouts
from .get_alignment_segment_nest import get_alignment_segment_nest from .get_alignment_segment_nest import get_alignment_segment_nest
from .get_alignment_start_station import get_alignment_start_station from .get_alignment_start_station import get_alignment_start_station
from .get_curve_segment_transition_code import get_curve_segment_transition_code
from .get_layout_segments import get_layout_segments
from .get_horizontal_layout import get_horizontal_layout
from .get_vertical_layout import get_vertical_layout
from .get_cant_layout import get_cant_layout
from .get_alignment_layouts import get_alignment_layouts
from .get_axis_subcontext import get_axis_subcontext from .get_axis_subcontext import get_axis_subcontext
from .get_basis_curve import get_basis_curve from .get_basis_curve import get_basis_curve
from .get_cant_layout import get_cant_layout
from .get_child_alignments import get_child_alignments from .get_child_alignments import get_child_alignments
from .get_curve import get_curve from .get_curve import get_curve
from .get_curve_segment_transition_code import get_curve_segment_transition_code
from .get_horizontal_layout import get_horizontal_layout
from .get_layout_curve import get_layout_curve from .get_layout_curve import get_layout_curve
from .get_layout_segments import get_layout_segments
from .get_mapped_segments import get_mapped_segments from .get_mapped_segments import get_mapped_segments
from .get_parent_alignment import get_parent_alignment from .get_parent_alignment import get_parent_alignment
from .get_referent_nest import get_referent_nest from .get_referent_nest import get_referent_nest
from .get_vertical_layout import get_vertical_layout
from .has_zero_length_segment import has_zero_length_segment from .has_zero_length_segment import has_zero_length_segment
from .layout_horizontal_alignment_by_pi_method import layout_horizontal_alignment_by_pi_method from .layout_horizontal_alignment_by_pi_method import (
from .layout_vertical_alignment_by_pi_method import layout_vertical_alignment_by_pi_method layout_horizontal_alignment_by_pi_method,
)
from .layout_vertical_alignment_by_pi_method import (
layout_vertical_alignment_by_pi_method,
)
from .name_segments import name_segments from .name_segments import name_segments
from .update_fallback_position import update_fallback_position from .update_fallback_position import update_fallback_position
from .util import * from .util import *
from ._get_segment_start_point_label import register_referent_name_callback
__all__ = [ __all__ = [
"add_stationing_referent", "add_stationing_referent",
"add_vertical_layout", "add_vertical_layout",
@@ -16,19 +16,27 @@
# 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 numpy as np
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.api.alignment import ifcopenshell.api.alignment
import ifcopenshell.geom import ifcopenshell.geom
import ifcopenshell.util.unit
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
import numpy as np import ifcopenshell.util.unit
from ifcopenshell import entity_instance from ifcopenshell import entity_instance
from ifcopenshell.api.alignment._map_alignment_cant_segment import (
from ifcopenshell.api.alignment._update_curve_segment_transition_code import _update_curve_segment_transition_code _map_alignment_cant_segment,
from ifcopenshell.api.alignment._map_alignment_horizontal_segment import _map_alignment_horizontal_segment )
from ifcopenshell.api.alignment._map_alignment_vertical_segment import _map_alignment_vertical_segment from ifcopenshell.api.alignment._map_alignment_horizontal_segment import (
from ifcopenshell.api.alignment._map_alignment_cant_segment import _map_alignment_cant_segment _map_alignment_horizontal_segment,
)
from ifcopenshell.api.alignment._map_alignment_vertical_segment import (
_map_alignment_vertical_segment,
)
from ifcopenshell.api.alignment._update_curve_segment_transition_code import (
_update_curve_segment_transition_code,
)
def _add_curve_segment_to_composite_curve( def _add_curve_segment_to_composite_curve(
@@ -16,6 +16,11 @@
# 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 math
from collections.abc import Sequence
import numpy as np
import ifcopenshell import ifcopenshell
import ifcopenshell.api.alignment import ifcopenshell.api.alignment
import ifcopenshell.api.nest import ifcopenshell.api.nest
@@ -23,14 +28,11 @@ import ifcopenshell.api.pset
import ifcopenshell.geom import ifcopenshell.geom
import ifcopenshell.util.alignment import ifcopenshell.util.alignment
import ifcopenshell.util.unit import ifcopenshell.util.unit
from ifcopenshell import ifcopenshell_wrapper from ifcopenshell import entity_instance, ifcopenshell_wrapper
import numpy as np
import math
from ifcopenshell import entity_instance
from collections.abc import Sequence
from ifcopenshell.api.alignment._add_segment_to_curve import _add_segment_to_curve from ifcopenshell.api.alignment._add_segment_to_curve import _add_segment_to_curve
from ifcopenshell.api.alignment._get_segment_start_point_label import _get_segment_start_point_label from ifcopenshell.api.alignment._get_segment_start_point_label import (
_get_segment_start_point_label,
)
def _add_segment_to_layout(file: ifcopenshell.file, layout: entity_instance, segment: entity_instance) -> None: def _add_segment_to_layout(file: ifcopenshell.file, layout: entity_instance, segment: entity_instance) -> None:

Some files were not shown because too many files have changed in this diff Show More