mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
typing
This commit is contained in:
@@ -170,6 +170,6 @@ class ProjectLibraryData:
|
|||||||
|
|
||||||
|
|
||||||
class LinksData:
|
class LinksData:
|
||||||
linked_data = {}
|
linked_data: dict[str, Any] = {}
|
||||||
enable_culling = False
|
enable_culling = False
|
||||||
is_loaded = False
|
is_loaded = False
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
|
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from typing import Union
|
|
||||||
|
|
||||||
import bmesh
|
import bmesh
|
||||||
import bpy
|
import bpy
|
||||||
import gpu
|
import gpu
|
||||||
@@ -54,7 +52,7 @@ class ProjectDecorator:
|
|||||||
installed = None
|
installed = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def install(cls, context):
|
def install(cls, context: bpy.types.Context) -> None:
|
||||||
if cls.installed:
|
if cls.installed:
|
||||||
cls.uninstall()
|
cls.uninstall()
|
||||||
handler = cls()
|
handler = cls()
|
||||||
@@ -99,9 +97,9 @@ class ProjectDecorator:
|
|||||||
# general shader
|
# general shader
|
||||||
self.shader = gpu.shader.from_builtin("UNIFORM_COLOR")
|
self.shader = gpu.shader.from_builtin("UNIFORM_COLOR")
|
||||||
|
|
||||||
selected_vertices = []
|
selected_vertices: list[tuple[float, float, float]] = []
|
||||||
selected_edges = []
|
selected_edges: list[tuple[int, int]] = []
|
||||||
selected_tris = []
|
selected_tris: list[tuple[int, int, int]] = []
|
||||||
|
|
||||||
props = tool.Project.get_project_props()
|
props = tool.Project.get_project_props()
|
||||||
try:
|
try:
|
||||||
@@ -112,7 +110,7 @@ class ProjectDecorator:
|
|||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
root_obj: Union[bpy.types.Object, None] = props.queried_obj_root
|
root_obj = props.queried_obj_root
|
||||||
if root_obj and not (m := root_obj.matrix_world).is_identity:
|
if root_obj and not (m := root_obj.matrix_world).is_identity:
|
||||||
selected_vertices = [m @ Vector(v) for v in selected_vertices]
|
selected_vertices = [m @ Vector(v) for v in selected_vertices]
|
||||||
|
|
||||||
|
|||||||
@@ -27,11 +27,12 @@ import traceback
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from math import radians
|
from math import radians
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import TYPE_CHECKING, Literal, Union, get_args
|
from typing import TYPE_CHECKING, Any, Literal, Union, get_args
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import ifcopenshell.api.attribute
|
import ifcopenshell.api.attribute
|
||||||
|
import ifcopenshell.api.document
|
||||||
import ifcopenshell.api.nest
|
import ifcopenshell.api.nest
|
||||||
import ifcopenshell.api.project
|
import ifcopenshell.api.project
|
||||||
import ifcopenshell.api.root
|
import ifcopenshell.api.root
|
||||||
@@ -1438,8 +1439,13 @@ class LoadLink(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bl_label = "Load Link"
|
bl_label = "Load Link"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
bl_description = "Load the selected file"
|
bl_description = "Load the selected file"
|
||||||
link_index: bpy.props.IntProperty(name="Link Index")
|
|
||||||
use_cache: bpy.props.BoolProperty(name="Use Cache", default=True)
|
link_index: bpy.props.IntProperty(name="Link Index") # pyright: ignore[reportRedeclaration]
|
||||||
|
use_cache: bpy.props.BoolProperty(name="Use Cache", default=True) # pyright: ignore[reportRedeclaration]
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
link_index: int
|
||||||
|
use_cache: bool
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
self.link = tool.Project.get_project_props().links[self.link_index]
|
self.link = tool.Project.get_project_props().links[self.link_index]
|
||||||
@@ -1464,9 +1470,10 @@ class LoadLink(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
empty = bpy.data.objects.new(empty_name, None)
|
empty = bpy.data.objects.new(empty_name, None)
|
||||||
empty.instance_type = "COLLECTION"
|
empty.instance_type = "COLLECTION"
|
||||||
empty.instance_collection = collection
|
empty.instance_collection = collection
|
||||||
empty.matrix_world = Matrix(tool.Project.calculate_link_matrix(self.link))
|
empty.matrix_world = tool.Project.calculate_link_matrix(self.link)
|
||||||
|
|
||||||
tool.Project.set_link_empty_handle(self.link, empty)
|
tool.Project.set_link_empty_handle(self.link, empty)
|
||||||
|
assert bpy.context.scene
|
||||||
bpy.context.scene.collection.objects.link(empty)
|
bpy.context.scene.collection.objects.link(empty)
|
||||||
self.link.is_loaded = True
|
self.link.is_loaded = True
|
||||||
if tool.Ifc.get(): # For non-IFC projects, locking has no meaning
|
if tool.Ifc.get(): # For non-IFC projects, locking has no meaning
|
||||||
@@ -1635,8 +1642,16 @@ class ToggleLinkVisibility(bpy.types.Operator):
|
|||||||
bl_label = "Toggle Link Visibility"
|
bl_label = "Toggle Link Visibility"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
bl_description = "Toggle visibility between SOLID and WIREFRAME"
|
bl_description = "Toggle visibility between SOLID and WIREFRAME"
|
||||||
link_index: bpy.props.IntProperty(name="Link Index")
|
|
||||||
mode: bpy.props.EnumProperty(name="Visibility Mode", items=((i, i, "") for i in ("WIREFRAME", "VISIBLE")))
|
link_index: bpy.props.IntProperty(name="Link Index") # pyright: ignore[reportRedeclaration]
|
||||||
|
mode: bpy.props.EnumProperty( # pyright: ignore[reportRedeclaration]
|
||||||
|
name="Visibility Mode",
|
||||||
|
items=((i, i, "") for i in ("WIREFRAME", "VISIBLE")),
|
||||||
|
)
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
link_index: int
|
||||||
|
mode: Literal["WIREFRAME", "VISIBLE"]
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
props = tool.Project.get_project_props()
|
props = tool.Project.get_project_props()
|
||||||
@@ -1688,8 +1703,11 @@ class EnableEditingLink(bpy.types.Operator):
|
|||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
link = tool.Project.get_project_props().active_link
|
link = tool.Project.get_project_props().active_link
|
||||||
|
assert link
|
||||||
link.is_editing = True
|
link.is_editing = True
|
||||||
tool.Geometry.unlock_object(tool.Project.get_link_empty_handle(link))
|
obj = tool.Project.get_link_empty_handle(link)
|
||||||
|
assert obj
|
||||||
|
tool.Geometry.unlock_object(obj)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -1701,9 +1719,11 @@ class DisableEditingLink(bpy.types.Operator):
|
|||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
link = tool.Project.get_project_props().active_link
|
link = tool.Project.get_project_props().active_link
|
||||||
|
assert link
|
||||||
link.is_editing = False
|
link.is_editing = False
|
||||||
obj = tool.Project.get_link_empty_handle(link)
|
obj = tool.Project.get_link_empty_handle(link)
|
||||||
obj.matrix_world = Matrix(tool.Project.calculate_link_matrix(link))
|
assert obj
|
||||||
|
obj.matrix_world = tool.Project.calculate_link_matrix(link)
|
||||||
tool.Geometry.lock_object(obj)
|
tool.Geometry.lock_object(obj)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -1716,8 +1736,10 @@ class EditLink(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
link = tool.Project.get_project_props().active_link
|
link = tool.Project.get_project_props().active_link
|
||||||
|
assert link
|
||||||
link.is_editing = False
|
link.is_editing = False
|
||||||
obj = tool.Project.get_link_empty_handle(link)
|
obj = tool.Project.get_link_empty_handle(link)
|
||||||
|
assert obj
|
||||||
new_obj_matrix = obj.matrix_world
|
new_obj_matrix = obj.matrix_world
|
||||||
|
|
||||||
filepath = Path(tool.Ifc.resolve_uri(link.filepath))
|
filepath = Path(tool.Ifc.resolve_uri(link.filepath))
|
||||||
@@ -1753,7 +1775,7 @@ class EditLink(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
else:
|
else:
|
||||||
link.transformation = transformation
|
link.transformation = transformation
|
||||||
|
|
||||||
obj.matrix_world = Matrix(tool.Project.calculate_link_matrix(link))
|
obj.matrix_world = tool.Project.calculate_link_matrix(link)
|
||||||
tool.Geometry.lock_object(obj)
|
tool.Geometry.lock_object(obj)
|
||||||
|
|
||||||
|
|
||||||
@@ -2270,7 +2292,8 @@ class QueryLinkedElement(bpy.types.Operator):
|
|||||||
props = tool.Project.get_project_props()
|
props = tool.Project.get_project_props()
|
||||||
props.queried_obj = None
|
props.queried_obj = None
|
||||||
|
|
||||||
for area in bpy.context.screen.areas:
|
assert context.screen
|
||||||
|
for area in context.screen.areas:
|
||||||
if area.type == "PROPERTIES":
|
if area.type == "PROPERTIES":
|
||||||
for region in area.regions:
|
for region in area.regions:
|
||||||
if region.type == "WINDOW":
|
if region.type == "WINDOW":
|
||||||
@@ -2278,6 +2301,7 @@ class QueryLinkedElement(bpy.types.Operator):
|
|||||||
elif area.type == "VIEW_3D":
|
elif area.type == "VIEW_3D":
|
||||||
area.tag_redraw()
|
area.tag_redraw()
|
||||||
|
|
||||||
|
assert context.region and context.region_data
|
||||||
region = context.region
|
region = context.region
|
||||||
rv3d = context.region_data
|
rv3d = context.region_data
|
||||||
coord = (self.mouse_x, self.mouse_y)
|
coord = (self.mouse_x, self.mouse_y)
|
||||||
@@ -2294,18 +2318,20 @@ class QueryLinkedElement(bpy.types.Operator):
|
|||||||
|
|
||||||
guid = None
|
guid = None
|
||||||
guid_start_index = 0
|
guid_start_index = 0
|
||||||
for i, guid_end_index in enumerate(obj["guid_ids"]):
|
guid_ids: list[int] = obj["guid_ids"]
|
||||||
|
for i, guid_end_index in enumerate(guid_ids):
|
||||||
if face_index < guid_end_index:
|
if face_index < guid_end_index:
|
||||||
guid = obj["guids"][i]
|
guid = obj["guids"][i]
|
||||||
props.queried_obj = obj
|
props.queried_obj = obj
|
||||||
props.queried_obj_root = self.find_obj_root(obj, instance_matrix)
|
props.queried_obj_root = self.find_obj_root(obj, instance_matrix)
|
||||||
|
|
||||||
selected_tris = []
|
selected_tris: list[tuple[int, ...]] = []
|
||||||
selected_edges = []
|
selected_edges: list[tuple[int, ...]] = []
|
||||||
vert_indices = set()
|
vert_indices_set: set[int] = set()
|
||||||
|
assert isinstance(obj.data, bpy.types.Mesh)
|
||||||
for polygon in obj.data.polygons[guid_start_index:guid_end_index]:
|
for polygon in obj.data.polygons[guid_start_index:guid_end_index]:
|
||||||
vert_indices.update(polygon.vertices)
|
vert_indices_set.update(polygon.vertices)
|
||||||
vert_indices = list(vert_indices)
|
vert_indices = list(vert_indices_set)
|
||||||
vert_map = {k: v for v, k in enumerate(vert_indices)}
|
vert_map = {k: v for v, k in enumerate(vert_indices)}
|
||||||
selected_vertices = [tuple(obj.matrix_world @ obj.data.vertices[vi].co) for vi in vert_indices]
|
selected_vertices = [tuple(obj.matrix_world @ obj.data.vertices[vi].co) for vi in vert_indices]
|
||||||
for polygon in obj.data.polygons[guid_start_index:guid_end_index]:
|
for polygon in obj.data.polygons[guid_start_index:guid_end_index]:
|
||||||
@@ -2319,13 +2345,14 @@ class QueryLinkedElement(bpy.types.Operator):
|
|||||||
break
|
break
|
||||||
guid_start_index = guid_end_index
|
guid_start_index = guid_end_index
|
||||||
|
|
||||||
|
assert guid is not None
|
||||||
self.db = sqlite3.connect(obj["db"])
|
self.db = sqlite3.connect(obj["db"])
|
||||||
self.c = self.db.cursor()
|
self.c = self.db.cursor()
|
||||||
|
|
||||||
self.c.execute(f"SELECT * FROM elements WHERE global_id = '{guid}' LIMIT 1")
|
self.c.execute(f"SELECT * FROM elements WHERE global_id = '{guid}' LIMIT 1")
|
||||||
element = self.c.fetchone()
|
element = self.c.fetchone()
|
||||||
|
|
||||||
attributes = {}
|
attributes: dict[str, Any] = {}
|
||||||
for i, attr in enumerate(["GlobalId", "IFC Class", "Predefined Type", "Name", "Description"]):
|
for i, attr in enumerate(["GlobalId", "IFC Class", "Predefined Type", "Name", "Description"]):
|
||||||
if element[i + 1] is not None:
|
if element[i + 1] is not None:
|
||||||
attributes[attr] = element[i + 1]
|
attributes[attr] = element[i + 1]
|
||||||
@@ -2415,6 +2442,7 @@ class AppendInspectedLinkedElement(AppendLibraryElement):
|
|||||||
return {"CANCELLED"}
|
return {"CANCELLED"}
|
||||||
|
|
||||||
queried_obj = props.queried_obj
|
queried_obj = props.queried_obj
|
||||||
|
assert queried_obj
|
||||||
|
|
||||||
ifc_file = tool.Ifc.get()
|
ifc_file = tool.Ifc.get()
|
||||||
linked_ifc_file: ifcopenshell.file
|
linked_ifc_file: ifcopenshell.file
|
||||||
@@ -2683,10 +2711,12 @@ class CreateClippingPlane(bpy.types.Operator):
|
|||||||
self.report({"INFO"}, "Maximum of six clipping planes allowed.")
|
self.report({"INFO"}, "Maximum of six clipping planes allowed.")
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
assert context.screen
|
||||||
for area in context.screen.areas:
|
for area in context.screen.areas:
|
||||||
if area.type == "VIEW_3D":
|
if area.type == "VIEW_3D":
|
||||||
area.tag_redraw()
|
area.tag_redraw()
|
||||||
|
|
||||||
|
assert context.region and context.region_data
|
||||||
region = context.region
|
region = context.region
|
||||||
rv3d = context.region_data
|
rv3d = context.region_data
|
||||||
if rv3d: # Called from a 3D viewport
|
if rv3d: # Called from a 3D viewport
|
||||||
|
|||||||
@@ -774,6 +774,7 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
|
|||||||
bsdd_load_preview_dictionaries: bool
|
bsdd_load_preview_dictionaries: bool
|
||||||
bsdd_load_inactive_dictionaries: bool
|
bsdd_load_inactive_dictionaries: bool
|
||||||
bsdd_load_test_dictionaries: bool
|
bsdd_load_test_dictionaries: bool
|
||||||
|
bsdd_baseurl: str
|
||||||
should_disable_undo_on_save: bool
|
should_disable_undo_on_save: bool
|
||||||
should_stream: bool
|
should_stream: bool
|
||||||
should_always_cache: bool
|
should_always_cache: bool
|
||||||
@@ -789,6 +790,7 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
|
|||||||
mass_time_units_in_wizard: bool
|
mass_time_units_in_wizard: bool
|
||||||
chain_filter_with_set_operations: bool
|
chain_filter_with_set_operations: bool
|
||||||
save_metadata_blend_file: bool
|
save_metadata_blend_file: bool
|
||||||
|
metadata_blend_file_suffix: str
|
||||||
decorator_font_scale: float
|
decorator_font_scale: float
|
||||||
|
|
||||||
def draw(self, context: bpy.types.Context) -> None:
|
def draw(self, context: bpy.types.Context) -> None:
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import ifcopenshell
|
|||||||
import ifcopenshell.api.document
|
import ifcopenshell.api.document
|
||||||
import ifcopenshell.util.element
|
import ifcopenshell.util.element
|
||||||
import ifcopenshell.util.representation
|
import ifcopenshell.util.representation
|
||||||
|
import ifcopenshell.util.shape_builder
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from ifcopenshell.api.project.append_asset import APPENDABLE_ASSET_TYPES
|
from ifcopenshell.api.project.append_asset import APPENDABLE_ASSET_TYPES
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ import bonsai.tool as tool
|
|||||||
from bonsai.bim.ifc import IfcStore
|
from bonsai.bim.ifc import IfcStore
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from bonsai.bim.module.project.prop import BIMProjectProperties, MeasureToolSettings
|
from bonsai.bim.module.project.prop import BIMProjectProperties, MeasureToolSettings, Link
|
||||||
|
|
||||||
HiearchyDict = dict[ifcopenshell.entity_instance, "HiearchyDict"]
|
HiearchyDict = dict[ifcopenshell.entity_instance, "HiearchyDict"]
|
||||||
|
|
||||||
@@ -61,20 +62,20 @@ class Project(bonsai.core.tool.Project):
|
|||||||
return scene.MeasureToolSettings # pyright: ignore[reportAttributeAccessIssue]
|
return scene.MeasureToolSettings # pyright: ignore[reportAttributeAccessIssue]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_link_empty_handle(cls, link) -> bpy.types.Object | None:
|
def get_link_empty_handle(cls, link: Link) -> bpy.types.Object | None:
|
||||||
if tool.Ifc.get():
|
if tool.Ifc.get():
|
||||||
return tool.Ifc.get_object(tool.Ifc.get().by_id(link.ifc_definition_id))
|
return tool.Ifc.get_object(tool.Ifc.get().by_id(link.ifc_definition_id))
|
||||||
return link.empty_handle
|
return link.empty_handle
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def set_link_empty_handle(cls, link, empty: bpy.types.Object) -> None:
|
def set_link_empty_handle(cls, link: Link, empty: bpy.types.Object) -> None:
|
||||||
if tool.Ifc.get():
|
if tool.Ifc.get():
|
||||||
tool.Ifc.link(tool.Ifc.get().by_id(link.ifc_definition_id), empty)
|
tool.Ifc.link(tool.Ifc.get().by_id(link.ifc_definition_id), empty)
|
||||||
else:
|
else:
|
||||||
link.empty_handle = empty
|
link.empty_handle = empty
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def calculate_link_matrix(cls, link) -> None:
|
def calculate_link_matrix(cls, link: Link) -> Matrix:
|
||||||
filepath = Path(tool.Ifc.resolve_uri(link.filepath))
|
filepath = Path(tool.Ifc.resolve_uri(link.filepath))
|
||||||
with open(filepath.with_suffix(".ifc.cache.json"), "r") as f:
|
with open(filepath.with_suffix(".ifc.cache.json"), "r") as f:
|
||||||
metadata = json.load(f)
|
metadata = json.load(f)
|
||||||
@@ -99,7 +100,7 @@ class Project(bonsai.core.tool.Project):
|
|||||||
rot = ifcopenshell.util.shape_builder.np_rotation_matrix(radians(-float(gprops.model_project_north)), 4, "Z")
|
rot = ifcopenshell.util.shape_builder.np_rotation_matrix(radians(-float(gprops.model_project_north)), 4, "Z")
|
||||||
local_matrix = rot @ np.eye(4)
|
local_matrix = rot @ np.eye(4)
|
||||||
local_matrix[:, 3][:3] = [float(o) for o in gprops.model_origin_si.split(",")]
|
local_matrix[:, 3][:3] = [float(o) for o in gprops.model_origin_si.split(",")]
|
||||||
return np.linalg.inv(local_matrix) @ global_matrix
|
return Matrix(np.linalg.inv(local_matrix) @ global_matrix)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def append_all_types_from_template(cls, template: str) -> None:
|
def append_all_types_from_template(cls, template: str) -> None:
|
||||||
|
|||||||
@@ -17,21 +17,24 @@
|
|||||||
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
|
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
import logging
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import ifcopenshell.util.element
|
import ifcopenshell.util.element
|
||||||
|
|
||||||
|
import ifcpatch
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import sqlite3
|
import sqlite3
|
||||||
except:
|
except:
|
||||||
print("No SQLite support")
|
print("No SQLite support")
|
||||||
|
|
||||||
|
|
||||||
class Patcher:
|
class Patcher(ifcpatch.BasePatcher):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
file,
|
file: ifcopenshell.file,
|
||||||
logger,
|
logger: logging.Logger | None = None,
|
||||||
):
|
):
|
||||||
"""Extracts properties and relationships from a IFC-SPF model to SQLite.
|
"""Extracts properties and relationships from a IFC-SPF model to SQLite.
|
||||||
|
|
||||||
@@ -45,10 +48,11 @@ class Patcher:
|
|||||||
result = ifcpatch.execute({"input": fn, "file": model, "recipe": "ExtractPropertiesToSQLite"})
|
result = ifcpatch.execute({"input": fn, "file": model, "recipe": "ExtractPropertiesToSQLite"})
|
||||||
ifcpatch.write(result, "output.sqlite")
|
ifcpatch.write(result, "output.sqlite")
|
||||||
"""
|
"""
|
||||||
self.file = file
|
super().__init__(file, logger)
|
||||||
self.logger = logger
|
|
||||||
|
|
||||||
def patch(self):
|
def patch(self):
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
tmp = tempfile.NamedTemporaryFile(delete=False)
|
tmp = tempfile.NamedTemporaryFile(delete=False)
|
||||||
db_file = tmp.name
|
db_file = tmp.name
|
||||||
self.db = sqlite3.connect(db_file)
|
self.db = sqlite3.connect(db_file)
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ class Patcher(ifcpatch.BasePatcher):
|
|||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
super().__init__(file, logger)
|
super().__init__(file, logger)
|
||||||
self.logger = logger
|
|
||||||
self.sql_type: Literal["sqlite", "mysql"] = sql_type.lower()
|
self.sql_type: Literal["sqlite", "mysql"] = sql_type.lower()
|
||||||
self.host = host
|
self.host = host
|
||||||
self.username = username
|
self.username = username
|
||||||
|
|||||||
Reference in New Issue
Block a user