mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-29 00:03:17 +00:00
Update .py guess_format()
This commit is contained in:
@@ -158,8 +158,8 @@ def open(
|
|||||||
print(products[0] == model[122] == model["2XQ$n5SLP5MBLyL442paFx"]) # True
|
print(products[0] == model[122] == model["2XQ$n5SLP5MBLyL442paFx"]) # True
|
||||||
"""
|
"""
|
||||||
path = Path(path)
|
path = Path(path)
|
||||||
if not path.is_file():
|
if not path.exists():
|
||||||
raise FileNotFoundError(f"File does not exist: '{path}'.")
|
raise FileNotFoundError(f"Path does not exist: '{path}'.")
|
||||||
if format is None:
|
if format is None:
|
||||||
format = guess_format(path)
|
format = guess_format(path)
|
||||||
if format == ".ifcXML":
|
if format == ".ifcXML":
|
||||||
@@ -273,7 +273,9 @@ def guess_format(path: Path) -> Union[str, None]:
|
|||||||
:return: Either .ifc, .ifcZIP, .ifcXML, .ifcJSON, .ifcSQLite, or None.
|
:return: Either .ifc, .ifcZIP, .ifcXML, .ifcJSON, .ifcSQLite, or None.
|
||||||
"""
|
"""
|
||||||
suffix = path.suffix.lower()
|
suffix = path.suffix.lower()
|
||||||
if suffix == ".ifc":
|
if path.is_dir():
|
||||||
|
return "rocksdb"
|
||||||
|
elif suffix == ".ifc":
|
||||||
return ".ifc"
|
return ".ifc"
|
||||||
elif suffix in (".ifczip", ".zip"):
|
elif suffix in (".ifczip", ".zip"):
|
||||||
return ".ifcZIP"
|
return ".ifcZIP"
|
||||||
|
|||||||
Reference in New Issue
Block a user