mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 13:52:23 +00:00
typing - fix annoying module symbol getting into ifcopenshell.open retun types
This commit is contained in:
@@ -85,7 +85,12 @@ try:
|
|||||||
except Exception:
|
except Exception:
|
||||||
raise ImportError("IfcOpenShell not built for '%s'" % python_distribution)
|
raise ImportError("IfcOpenShell not built for '%s'" % python_distribution)
|
||||||
|
|
||||||
from .file import rocksdb_lazy_instance, file
|
# `_file`, `_stream` is used only for annotations inside this file,
|
||||||
|
# see https://github.com/microsoft/pyright/discussions/9065.
|
||||||
|
from .file import file as _file
|
||||||
|
from .file import file
|
||||||
|
|
||||||
|
from .file import rocksdb_lazy_instance
|
||||||
from . import guid
|
from . import guid
|
||||||
from .entity_instance import entity_instance, register_schema_attributes
|
from .entity_instance import entity_instance, register_schema_attributes
|
||||||
from .sql import sqlite, sqlite_entity
|
from .sql import sqlite, sqlite_entity
|
||||||
@@ -104,7 +109,8 @@ __all__ = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from .stream import stream, stream_entity
|
from .stream import stream as _stream, stream_entity
|
||||||
|
from .stream import stream
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -124,16 +130,16 @@ 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: Optional[str] = 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: Optional[str] = None, *, should_stream: Literal[True]) -> _stream: ...
|
||||||
@overload
|
@overload
|
||||||
def open(
|
def open(
|
||||||
path: Union[os.PathLike, str], format: Optional[str] = None, *, should_stream: bool
|
path: Union[os.PathLike, str], format: Optional[str] = None, *, should_stream: bool
|
||||||
) -> Union[file, sqlite, stream]: ...
|
) -> Union[_file, sqlite, _stream]: ...
|
||||||
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: Optional[str] = None, should_stream: bool = False, readonly: bool = False
|
||||||
) -> Union[file, sqlite, stream]:
|
) -> Union[_file, sqlite, _stream]:
|
||||||
"""Loads an IFC dataset from a filepath
|
"""Loads an IFC dataset from a filepath
|
||||||
|
|
||||||
:param should_stream: Whether to open the file in streaming mode. Could be useful
|
:param should_stream: Whether to open the file in streaming mode. Could be useful
|
||||||
|
|||||||
Reference in New Issue
Block a user