bonsai - sort imports

This commit is contained in:
Andrej730
2026-01-26 17:11:12 +05:00
parent 1319391a6b
commit 953c5fddc6
524 changed files with 3338 additions and 2344 deletions
+7 -5
View File
@@ -4,20 +4,20 @@ try:
# Ensure it's not fake-bpy-module.
if not hasattr(bpy, "context"):
raise ModuleNotFoundError
import bl_i18n_utils
import addon_utils
import bl_i18n_utils
BPY_IS_LOADED = True
except ModuleNotFoundError:
BPY_IS_LOADED = False
import shutil
import tempfile
import importlib
import os
import re
from pathlib import Path
import shutil
import tempfile
from dataclasses import dataclass, field
from pathlib import Path
from typing import Optional
bl_info = {
@@ -274,7 +274,9 @@ if BPY_IS_LOADED:
f"Couldn't find locale path in the source directory, creating dummy directory: {source_locale_path}.",
)
from ui_translate.settings import settings as ui_translate_settings # pyright: ignore[reportMissingImports]
from ui_translate.settings import (
settings as ui_translate_settings, # pyright: ignore[reportMissingImports]
)
from ui_translate.update_ui import ( # pyright: ignore[reportMissingImports]
UI_OT_i18n_updatetranslation_init_settings,
)
@@ -1,4 +1,5 @@
import os
import ifcopenshell
import pandas as pd
+3 -2
View File
@@ -1,12 +1,13 @@
import csv
import os
import json
import os
# import pystache
import subprocess
import ifcopenshell
from pathlib import Path
import ifcopenshell
class Generator:
def __init__(self):
@@ -1,9 +1,10 @@
"""This script converts Graphisoft XML into an IFC file"""
import os
import xml.etree.ElementTree as ET
import ifcopenshell
import ifcopenshell.guid
import os
class IFC4Extractor:
@@ -1,6 +1,10 @@
import bonsai, json, bpy
import json
from pathlib import Path
import bpy
import bonsai
repo_path = Path(bonsai.__file__).resolve().parent
install_path = Path(bonsai.__file__).absolute().parent
assert repo_path != install_path, "Run `dev_environment.py` to setup the development environment symlinks first."
+1 -1
View File
@@ -16,9 +16,9 @@
# You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import ezdxf
import ifcopenshell
import ifcopenshell.guid
import ezdxf
class Dxf2Ifc:
+6 -2
View File
@@ -16,9 +16,13 @@
# You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import xml.sax, json, copy, pathlib
from bs4 import BeautifulSoup # pyright: ignore[reportMissingModuleSource]
import copy
import json
import pathlib
import sys
import xml.sax
from bs4 import BeautifulSoup # pyright: ignore[reportMissingModuleSource]
sys.setrecursionlimit(100)
+4 -3
View File
@@ -16,15 +16,16 @@
# You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy
import uuid
import math
import sys
import uuid
import bpy
import bspy # pyright: ignore[reportMissingImports]
# sys.path.append('C:\Program Files\Python37\Lib\site-packages')
import lxml
import lxml.etree
import bspy # pyright: ignore[reportMissingImports]
from bspy import Gbxml # pyright: ignore[reportMissingImports]
@@ -30,6 +30,7 @@ import ifcopenshell.api.pset
import ifcopenshell.api.root
import ifcopenshell.api.style
import ifcopenshell.api.unit
import bonsai.tool as tool
+3 -1
View File
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
from pathlib import Path
import bpy
import ifcopenshell
import ifcopenshell.api
@@ -31,8 +33,8 @@ import ifcopenshell.api.style
import ifcopenshell.api.unit
import ifcopenshell.util.schema
import ifcopenshell.util.shape_builder
import bonsai.tool as tool
from pathlib import Path
def sync_guids(target_file: ifcopenshell.file, source_file: ifcopenshell.file) -> None:
@@ -17,6 +17,8 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import os
from pathlib import Path
import bpy
import ifcopenshell
import ifcopenshell.api
@@ -26,9 +28,8 @@ import ifcopenshell.api.project
import ifcopenshell.api.root
import ifcopenshell.api.style
import ifcopenshell.api.unit
import bonsai.tool as tool
from pathlib import Path
import bonsai.tool as tool
# When run from Blender
BLEND_DIR = os.path.dirname(bpy.data.filepath)
@@ -16,7 +16,11 @@
# You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import numpy as np
from itertools import chain
from math import cos, pi, tan
from pathlib import Path
from typing import Optional, Union
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.context
@@ -27,11 +31,8 @@ import ifcopenshell.api.root
import ifcopenshell.api.style
import ifcopenshell.api.unit
import ifcopenshell.util.element
from math import cos, tan, pi
from pathlib import Path
from itertools import chain
from ifcopenshell.util.shape_builder import ShapeBuilder, V, np_to_3d, np_normalized
from typing import Optional, Union
import numpy as np
from ifcopenshell.util.shape_builder import ShapeBuilder, V, np_normalized, np_to_3d
GeneratorOutput = Union[list[ifcopenshell.entity_instance], list[list[ifcopenshell.entity_instance]]]
@@ -16,10 +16,16 @@
# You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import os
import bpy
import csv
import os
import random
from collections import namedtuple
from itertools import chain
from math import cos, pi, sin, tan
from pathlib import Path
from random import uniform
import bpy
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.context
@@ -29,15 +35,10 @@ import ifcopenshell.api.root
import ifcopenshell.api.style
import ifcopenshell.api.unit
import ifcopenshell.util.unit
import bonsai.tool as tool
from math import cos, sin, tan, pi
from pathlib import Path
from itertools import chain
from ifcopenshell.util.shape_builder import ShapeBuilder
from collections import namedtuple
from mathutils import Vector, Matrix
from random import uniform
from mathutils import Matrix, Vector
import bonsai.tool as tool
# When run from Blender
BLEND_DIR = os.path.dirname(bpy.data.filepath)
+1 -1
View File
@@ -5,9 +5,9 @@
# to run on mac: python3 generate_png_icons.py
import os
import re
import subprocess
import xml.etree.ElementTree as ET
import re
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
SVG_FILE = os.path.join(SCRIPT_DIR, "bonsai_icons.svg")
@@ -25,6 +25,7 @@ import ifcopenshell.api.project
import ifcopenshell.api.root
import ifcopenshell.api.style
import ifcopenshell.api.unit
import bonsai.tool as tool
@@ -19,15 +19,16 @@
# fmt: off
# pylint: skip-file
from math import cos, pi
from pathlib import Path
import boltspy as bolts # pyright: ignore[reportMissingImports]
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.material
import ifcopenshell.api.project
import ifcopenshell.api.root
import ifcopenshell.api.unit
import boltspy as bolts # pyright: ignore[reportMissingImports]
from math import cos, pi
from pathlib import Path
from ifcopenshell.util.shape_builder import ShapeBuilder, V, ifc_safe_vector_type
@@ -18,6 +18,7 @@
# See bug #1300. Dodgy quick results that we should rebuild later.
import json
import ifcopenshell
import ifcopenshell.util.schema
@@ -17,14 +17,15 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import json
import bmesh
import bpy
import ifcopenshell
import ifcopenshell.api.pset
import ifcopenshell.util.element
import bonsai.tool as tool
import bpy
import bmesh
import json
import bonsai.tool as tool
# Below is the code for
# prototype for geonodes modifier (similar to ifc sverchok modifier)
+1 -1
View File
@@ -18,9 +18,9 @@
"""This script converts the computer iterpretable listing ifcXML XSD into a JSON file"""
import xml.etree.ElementTree as ET
import collections
import json
import xml.etree.ElementTree as ET
class IFC4Extractor:
+4 -3
View File
@@ -1,13 +1,14 @@
"""Update ifc5d json files with qtos from the provided pset templates path."""
import json
import ifcopenshell.util.pset
import ifcopenshell.util.type
import ifc5d
from collections import defaultdict
from pathlib import Path
from typing import Union
import ifc5d
import ifcopenshell.util.pset
import ifcopenshell.util.type
def order_dict(dictionary):
# https://stackoverflow.com/questions/22721579/sorting-a-nested-ordereddict-by-key-recursively
+3 -2
View File
@@ -16,11 +16,12 @@
# You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import os
import re
import html
import json
import os
import re
from pathlib import Path
import ifcopenshell
+3 -2
View File
@@ -16,10 +16,11 @@
# You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import bpy
import bmesh
import pprint
import bmesh
import bpy
material_volumes = {}
for obj in bpy.context.selected_objects:
+1
View File
@@ -1,6 +1,7 @@
# This can be run using `blender -b -P headless_import.py`
import bpy
import bonsai.tool as tool
# When federating, you may wish to manually specify the origin to ensure models
+4 -4
View File
@@ -19,21 +19,21 @@
# This can be packaged with `pyinstaller --onefile --hidden-import numpy --collect-all ifcopenshell --clean obj2ifc.py`
import argparse
import pymeshlab # pyright: ignore[reportMissingImports]
from pathlib import Path
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.aggregate
import ifcopenshell.api.context
import ifcopenshell.api.geometry
import ifcopenshell.api.owner.settings
import ifcopenshell.api.project
import ifcopenshell.api.root
import ifcopenshell.api.spatial
import ifcopenshell.api.unit
import ifcopenshell.api.owner.settings
import ifcopenshell.guid
from pathlib import Path
import numpy as np
import pymeshlab # pyright: ignore[reportMissingImports]
class Obj2Ifc:
+4 -4
View File
@@ -19,21 +19,21 @@
# This can be packaged with `pyinstaller --onefile --hidden-import numpy --collect-all ifcopenshell --clean obj2ifc.py`
import argparse
import pywavefront # pyright: ignore[reportMissingImports]
from pathlib import Path
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.aggregate
import ifcopenshell.api.context
import ifcopenshell.api.geometry
import ifcopenshell.api.owner.settings
import ifcopenshell.api.project
import ifcopenshell.api.root
import ifcopenshell.api.spatial
import ifcopenshell.api.unit
import ifcopenshell.api.owner.settings
import ifcopenshell.guid
from pathlib import Path
import numpy as np
import pywavefront # pyright: ignore[reportMissingImports]
class Obj2Ifc:
+5 -5
View File
@@ -27,15 +27,15 @@ It works on the active ifc file (if exists).
"""
import bonsai.tool as tool
import os
import sys
from sys import platform
import ifcopenshell
import ifcopenshell.api.pset
import ifcopenshell.util.element
import sys
import os
from sys import platform
import bonsai.tool as tool
file = tool.Ifc.get()
if not file:
+1
View File
@@ -25,6 +25,7 @@ to ensure disable and enable occur in the same Blender session.
import bpy
import bonsai.tool as tool
bonsai_name = tool.Blender.get_blender_addon_package_name()
+2 -2
View File
@@ -16,8 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import sys
import subprocess
import sys
from pathlib import Path
print("Here are the detected system paths:")
@@ -45,10 +45,10 @@ for dep in dependencies:
subprocess.check_call(command + [dep])
try:
import pygments
import pytest
import pytest_bdd
import pytest_blender
import pygments
print("Test dependency installation was successful!")
except Exception as e:
@@ -1,6 +1,7 @@
import multiprocessing
import ifcopenshell
import ifcopenshell.geom
import multiprocessing
class BlenderImporter:
+5 -4
View File
@@ -1,10 +1,11 @@
import sys
import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.geom
import multiprocessing
import sys
from typing import NamedTuple
import ifcopenshell
import ifcopenshell.geom
import ifcopenshell.ifcopenshell_wrapper as W
import ifcopenshell.util.element
# W.turn_on_detailed_logging()
@@ -12,20 +12,16 @@ bl_info = {
}
import bpy
from bpy.types import Operator, PropertyGroup, Panel
from mathutils import Vector, Matrix, Euler
from math import radians
import bpy
from bpy.props import (
PointerProperty,
StringProperty,
EnumProperty,
BoolProperty,
IntProperty,
FloatProperty,
FloatVectorProperty,
CollectionProperty,
PointerProperty,
)
from bpy.types import Operator, Panel, PropertyGroup
from mathutils import Euler, Vector
class SectionCutawayManager:
+6 -9
View File
@@ -1,4 +1,8 @@
import numpy as np
# https://stackoverflow.com/a/9184560/9627415
# Possible optimisation to linalg.norm?
from itertools import cycle
from math import radians
import ifcopenshell
import ifcopenshell.api.aggregate
import ifcopenshell.api.context
@@ -12,14 +16,7 @@ import ifcopenshell.api.type
import ifcopenshell.api.unit
import ifcopenshell.util.placement
import ifcopenshell.util.shape_builder
# https://stackoverflow.com/a/9184560/9627415
# Possible optimisation to linalg.norm?
# from ifcopenshell.util.shape_builder import VectorType, SequenceOfVectors
from itertools import cycle
from collections import namedtuple
from math import sin, cos, radians
import numpy as np
f = ifcopenshell.api.project.create_file()