mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 22:43:41 +00:00
typing
This commit is contained in:
@@ -1102,7 +1102,7 @@ class LoadProject(bpy.types.Operator, IFCFileSelector, ImportHelper):
|
|||||||
else:
|
else:
|
||||||
return self.finish_loading_project(context)
|
return self.finish_loading_project(context)
|
||||||
|
|
||||||
def finish_loading_project(self, context):
|
def finish_loading_project(self, context: bpy.types.Context) -> set["rna_enums.OperatorReturnItems"]:
|
||||||
try:
|
try:
|
||||||
filepath = self.get_filepath()
|
filepath = self.get_filepath()
|
||||||
if not self.is_existing_ifc_file():
|
if not self.is_existing_ifc_file():
|
||||||
|
|||||||
@@ -131,17 +131,17 @@ class SchemaError(Error):
|
|||||||
|
|
||||||
@overload
|
@overload
|
||||||
def open(
|
def open(
|
||||||
path: Union[os.PathLike, str], format: Optional[str] = None, *, should_stream: Literal[False] = False
|
path: Union[os.PathLike, str], format: SupportedFormat = None, *, should_stream: Literal[False] = False
|
||||||
) -> Union[_file, sqlite]: ...
|
) -> Union[_file, sqlite]: ...
|
||||||
@overload
|
@overload
|
||||||
def open(path: Union[os.PathLike, str], format: Optional[str] = None, *, should_stream: Literal[True]) -> _stream: ...
|
def open(path: Union[os.PathLike, str], format: SupportedFormat = None, *, should_stream: Literal[True]) -> _stream: ...
|
||||||
@overload
|
@overload
|
||||||
def open(
|
def open(
|
||||||
path: Union[os.PathLike, str], format: Optional[str] = None, *, should_stream: bool = False, readonly: bool = False
|
path: Union[os.PathLike, str], format: SupportedFormat = None, *, should_stream: bool = False, readonly: bool = False
|
||||||
) -> Union[_file, sqlite, _stream]: ...
|
) -> Union[_file, sqlite, _stream]: ...
|
||||||
def open(
|
def open(
|
||||||
path: Union[os.PathLike, str],
|
path: Union[os.PathLike, str],
|
||||||
format: Optional[str] = None,
|
format: SupportedFormat = None,
|
||||||
should_stream: bool = False,
|
should_stream: bool = False,
|
||||||
readonly: bool = False,
|
readonly: bool = False,
|
||||||
mmap: bool = False,
|
mmap: bool = False,
|
||||||
@@ -153,8 +153,7 @@ def open(
|
|||||||
for reading large files.
|
for reading large files.
|
||||||
|
|
||||||
You can specify a file format. If no format is given, it is guessed from
|
You can specify a file format. If no format is given, it is guessed from
|
||||||
its extension. Currently supported specified format: .ifc | .ifcZIP |
|
its extension.
|
||||||
.ifcXML.
|
|
||||||
|
|
||||||
You can then filter by element ID, class, etc, and subscript by id or guid.
|
You can then filter by element ID, class, etc, and subscript by id or guid.
|
||||||
|
|
||||||
@@ -200,12 +199,12 @@ def open(
|
|||||||
f.bypass_type(ty)
|
f.bypass_type(ty)
|
||||||
if mmap:
|
if mmap:
|
||||||
# mmap parameter is only available for builds with USE_MMAP, not used in our main builds
|
# mmap parameter is only available for builds with USE_MMAP, not used in our main builds
|
||||||
f.initialize(str(path.absolute()), mmap=mmap) # type: ignore[unknown-argument]
|
f.initialize(str(path.absolute()), mmap=mmap) # ty: ignore[unknown-argument]
|
||||||
else:
|
else:
|
||||||
f.initialize(str(path.absolute()))
|
f.initialize(str(path.absolute()))
|
||||||
elif mmap:
|
elif mmap:
|
||||||
# mmap parameter is only available for builds with USE_MMAP, not used in our main builds
|
# mmap parameter is only available for builds with USE_MMAP, not used in our main builds
|
||||||
f = ifcopenshell_wrapper.open(str(path.absolute()), mmap=mmap) # type: ignore[unknown-argument]
|
f = ifcopenshell_wrapper.open(str(path.absolute()), mmap=mmap) # ty: ignore[unknown-argument]
|
||||||
else:
|
else:
|
||||||
f = ifcopenshell_wrapper.open(str(path.absolute()))
|
f = ifcopenshell_wrapper.open(str(path.absolute()))
|
||||||
return file(f)
|
return file(f)
|
||||||
@@ -288,7 +287,10 @@ def schema_by_name(
|
|||||||
return ifcopenshell_wrapper.schema_by_name(schema)
|
return ifcopenshell_wrapper.schema_by_name(schema)
|
||||||
|
|
||||||
|
|
||||||
def guess_format(path: Path) -> Literal[".ifc", ".ifcZIP", ".ifcXML", ".ifcJSON", ".ifcSQLite", None]:
|
SupportedFormat = Literal[".ifc", ".ifcZIP", ".ifcXML", ".ifcJSON", ".ifcSQLite", "rocksdb", None]
|
||||||
|
|
||||||
|
|
||||||
|
def guess_format(path: Path) -> SupportedFormat:
|
||||||
"""Guesses the IFC format using file extension
|
"""Guesses the IFC format using file extension
|
||||||
|
|
||||||
IFCs may be serialised as different formats. The most common is a ``.ifc``
|
IFCs may be serialised as different formats. The most common is a ``.ifc``
|
||||||
|
|||||||
@@ -434,10 +434,10 @@ class RocksDBPrefixIterator:
|
|||||||
|
|
||||||
class RocksDbSerializer:
|
class RocksDbSerializer:
|
||||||
def __init__(self, *args): ...
|
def __init__(self, *args): ...
|
||||||
def finalize(self): ...
|
def finalize(self) -> None: ...
|
||||||
def ready(self): ...
|
def ready(self) -> bool: ...
|
||||||
def setFile(self, arg2): ...
|
def setFile(self, arg2) -> None: ...
|
||||||
def writeHeader(self): ...
|
def writeHeader(self) -> None: ...
|
||||||
|
|
||||||
class Serialization(Representation):
|
class Serialization(Representation):
|
||||||
def __init__(self, brep): ...
|
def __init__(self, brep): ...
|
||||||
@@ -1008,7 +1008,7 @@ class file:
|
|||||||
def by_id(self, id: int) -> entity_instance: ...
|
def by_id(self, id: int) -> entity_instance: ...
|
||||||
def by_type(self, *args): ...
|
def by_type(self, *args): ...
|
||||||
def by_type_excl_subtypes(self, *args): ...
|
def by_type_excl_subtypes(self, *args): ...
|
||||||
def bypass_type(self, type_name): ...
|
def bypass_type(self, type_name: str) -> None: ...
|
||||||
calculate_unit_factors: bool
|
calculate_unit_factors: bool
|
||||||
check_existance_before_adding: bool
|
check_existance_before_adding: bool
|
||||||
def create(self, decl): ...
|
def create(self, decl): ...
|
||||||
@@ -1717,7 +1717,7 @@ def line_segments_to_polygons(s, eps, segments): ...
|
|||||||
def map_shape(settings, instance): ...
|
def map_shape(settings, instance): ...
|
||||||
def nary_union(sequence): ...
|
def nary_union(sequence): ...
|
||||||
def new_IfcBaseClass(schema_identifier: str, name: str) -> entity_instance: ...
|
def new_IfcBaseClass(schema_identifier: str, name: str) -> entity_instance: ...
|
||||||
def open(fn, readonly=False): ...
|
def open(fn: str, readonly: bool = False) -> file: ...
|
||||||
def parse_ifcxml(filename): ...
|
def parse_ifcxml(filename): ...
|
||||||
def polygons_to_svg(*args): ...
|
def polygons_to_svg(*args): ...
|
||||||
def read(data): ...
|
def read(data): ...
|
||||||
|
|||||||
Reference in New Issue
Block a user