mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 06:00:51 +00:00
typing
This commit is contained in:
@@ -17,21 +17,24 @@
|
||||
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import logging
|
||||
import tempfile
|
||||
|
||||
import ifcopenshell.util.element
|
||||
|
||||
import ifcpatch
|
||||
|
||||
try:
|
||||
import sqlite3
|
||||
except:
|
||||
print("No SQLite support")
|
||||
|
||||
|
||||
class Patcher:
|
||||
class Patcher(ifcpatch.BasePatcher):
|
||||
def __init__(
|
||||
self,
|
||||
file,
|
||||
logger,
|
||||
file: ifcopenshell.file,
|
||||
logger: logging.Logger | None = None,
|
||||
):
|
||||
"""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"})
|
||||
ifcpatch.write(result, "output.sqlite")
|
||||
"""
|
||||
self.file = file
|
||||
self.logger = logger
|
||||
super().__init__(file, logger)
|
||||
|
||||
def patch(self):
|
||||
import sqlite3
|
||||
|
||||
tmp = tempfile.NamedTemporaryFile(delete=False)
|
||||
db_file = tmp.name
|
||||
self.db = sqlite3.connect(db_file)
|
||||
|
||||
@@ -125,7 +125,6 @@ class Patcher(ifcpatch.BasePatcher):
|
||||
)
|
||||
"""
|
||||
super().__init__(file, logger)
|
||||
self.logger = logger
|
||||
self.sql_type: Literal["sqlite", "mysql"] = sql_type.lower()
|
||||
self.host = host
|
||||
self.username = username
|
||||
|
||||
Reference in New Issue
Block a user