From d24e5df7c1b22007ea951ced1eac2f6a791c0312 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 8 Apr 2024 15:05:37 +0500 Subject: [PATCH] typing --- src/blenderbim/blenderbim/tool/root.py | 3 +++ src/ifcopenshell-python/ifcopenshell/api/__init__.py | 9 +++++++-- src/ifcopenshell-python/ifcopenshell/file.py | 11 ++++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/blenderbim/blenderbim/tool/root.py b/src/blenderbim/blenderbim/tool/root.py index 3097ce2797..8a9273eb10 100644 --- a/src/blenderbim/blenderbim/tool/root.py +++ b/src/blenderbim/blenderbim/tool/root.py @@ -18,8 +18,11 @@ import bpy import ifcopenshell +import ifcopenshell.api import ifcopenshell.util.representation +import ifcopenshell.util.element import blenderbim.core.tool +import blenderbim.core.aggregate import blenderbim.core.geometry import blenderbim.core.material import blenderbim.core.style diff --git a/src/ifcopenshell-python/ifcopenshell/api/__init__.py b/src/ifcopenshell-python/ifcopenshell/api/__init__.py index 3e072a6876..1b2af5b09f 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/__init__.py +++ b/src/ifcopenshell-python/ifcopenshell/api/__init__.py @@ -23,14 +23,19 @@ import numpy import importlib import ifcopenshell import ifcopenshell.api -from typing import Callable, Any +from typing import Callable, Any, Optional pre_listeners = {} post_listeners = {} -def run(usecase_path: str, ifc_file: ifcopenshell.file = None, should_run_listeners=True, **settings) -> Any: +def run( + usecase_path: str, + ifc_file: Optional[ifcopenshell.file] = None, + should_run_listeners=True, + **settings: Any, +) -> Any: if should_run_listeners: for listener in pre_listeners.get(usecase_path, {}).values(): listener(usecase_path, ifc_file, settings) diff --git a/src/ifcopenshell-python/ifcopenshell/file.py b/src/ifcopenshell-python/ifcopenshell/file.py index f879d4eeea..d18f0b6688 100644 --- a/src/ifcopenshell-python/ifcopenshell/file.py +++ b/src/ifcopenshell-python/ifcopenshell/file.py @@ -28,7 +28,7 @@ import numbers import zipfile import functools from pathlib import Path -from typing import Tuple, List +from typing import List, Optional import ifcopenshell.util.element import ifcopenshell.util.file @@ -199,7 +199,12 @@ class file(object): wrapped_data: ifcopenshell_wrapper.file - def __init__(self, f: ifcopenshell_wrapper.file = None, schema: str = None, schema_version: Tuple[int] = None): + def __init__( + self, + f: Optional[ifcopenshell_wrapper.file] = None, + schema: Optional[str] = None, + schema_version: Optional[tuple[int, int, int, int]] = None, + ): """Create a new blank IFC model This IFC model does not have any entities in it yet. See the @@ -223,7 +228,7 @@ class file(object): ADD2 TC1, which is the official version approved by ISO when people refer to "IFC4". Generally you should not use this argument unless you are testing non-ISO IFC releases. - :type schema_version: tuple[int] + :type schema_version: tuple[int, int, int, int] Example: