Skip to content

Commit f8f36cf

Browse files
committed
typing
1 parent 2a2bfea commit f8f36cf

5 files changed

Lines changed: 17 additions & 6 deletions

File tree

src/bonsai/bonsai/tool/cad.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import mathutils.geometry
3737
from mathutils import Vector, Matrix, geometry
3838
import itertools
39-
from typing import TYPE_CHECKING
39+
from typing import TYPE_CHECKING, Union
4040

4141
if TYPE_CHECKING:
4242
from bonsai.bim.module.cad.prop import BIMCadProperties
@@ -170,7 +170,9 @@ def intersect_edge_plane(cls, v1, v2, plane_co, plane_no):
170170
return geometry.intersect_line_plane(v1, v2, plane_co, plane_no)
171171

172172
@classmethod
173-
def intersect_edges(cls, edge1, edge2):
173+
def intersect_edges(
174+
cls, edge1: tuple[Vector, Vector], edge2: tuple[Vector, Vector]
175+
) -> Union[tuple[Vector, Vector], None]:
174176
"""
175177
> takes 2 tuples, each tuple contains 2 vectors
176178
- prepares input for sending to intersect_line_line

src/ifcsverchok/helper.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,24 @@
1717
# along with IfcSverchok. If not, see <http://www.gnu.org/licenses/>.
1818

1919
import bpy
20+
import ifcopenshell
2021
from sverchok.data_structure import zip_long_repeat
22+
from typing import Any
2123

22-
ifc_files = {}
24+
ifc_files: dict[str, ifcopenshell.file] = {}
2325

2426

2527
class SvIfcCore:
26-
def process(self):
28+
sv_input_names: list[str]
29+
30+
def process(self) -> None:
2731
sv_inputs_nested = []
2832
for name in self.sv_input_names:
2933
sv_inputs_nested.append(self.inputs[name].sv_get())
3034
for sv_input_nested in zip_long_repeat(*sv_inputs_nested):
3135
for sv_input in zip_long_repeat(*sv_input_nested):
3236
sv_input = list(sv_input)
3337
self.process_ifc(*sv_input)
38+
39+
def process_ifc(self, *args: Any, **kwargs: Any) -> None:
40+
raise NotImplementedError

src/ifcsverchok/nodes/ifc/create_entity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import bpy
2020
from mathutils import Matrix
2121
import ifcopenshell
22+
import ifcopenshell.api
2223
import ifcsverchok.helper
2324
from ifcsverchok.ifcstore import SvIfcStore
2425

src/ifcsverchok/nodes/ifc/create_file.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class SvIfcCreateFileRefresh(bpy.types.Operator):
3434
has_baked: bpy.props.BoolProperty(name="Has Baked", default=False)
3535

3636
def execute(self, context):
37+
node: SvIfcCreateFile
3738
node = bpy.data.node_groups[self.tree_name].nodes[self.node_name]
3839
node.process()
3940
return {"FINISHED"}
@@ -55,7 +56,7 @@ def process(self):
5556
self.sv_input_names = ["schema"]
5657
super().process()
5758

58-
def process_ifc(self, schema):
59+
def process_ifc(self, schema: str) -> None:
5960
guid = ifcopenshell.guid.new()
6061
ifcsverchok.helper.ifc_files[guid] = ifcopenshell.file(schema=schema)
6162
self.outputs["file"].sv_set([[ifcsverchok.helper.ifc_files[guid]]])

src/ifcsverchok/nodes/ifc/create_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def process(self):
5252
project_name = self.inputs["project_name"].sv_get()[0][0]
5353
self.process_ifc(file, project_name)
5454

55-
def process_ifc(self, file, project_name):
55+
def process_ifc(self, file: ifcopenshell.file, project_name: str) -> None:
5656
# create project
5757
project = ifcopenshell.api.run("root.create_entity", file, ifc_class="IfcProject", name=str(project_name))
5858
lengthunit = ifcopenshell.api.run("unit.add_si_unit", file, unit_type="LENGTHUNIT")

0 commit comments

Comments
 (0)