@@ -74,7 +74,6 @@ def _inner_classes_list(cls: Any) -> List:
74
74
75
75
76
76
def _imports (extra_imports : Sequence [str ]) -> str :
77
-
78
77
linter_exceptions = [
79
78
"too-many-lines" ,
80
79
"protected-access" ,
@@ -98,13 +97,11 @@ def _imports(extra_imports: Sequence[str]) -> str:
98
97
99
98
100
99
def _create_init_special_member_function (node_data : NodeData , base_type : str ) -> str :
101
-
102
100
full_dot_path = _get_dot_path (base_type , node_data .path )
103
101
signature_vars = ""
104
102
member_variable_set = ""
105
103
106
104
for container in node_data .member_containers :
107
-
108
105
if container .container_info is None :
109
106
raise RuntimeError (f"Unexpected lack of container info: { container } " )
110
107
@@ -129,7 +126,6 @@ def _create_init_special_member_function(node_data: NodeData, base_type: str) ->
129
126
)
130
127
131
128
for member in node_data .member_variables :
132
-
133
129
if member .member_info is None :
134
130
raise RuntimeError (f"Unexpected lack of member info: { member } " )
135
131
@@ -142,7 +138,6 @@ def _create_init_special_member_function(node_data: NodeData, base_type: str) ->
142
138
signature_vars += f"{ member .snake_case } ={ full_dot_path } .{ member .name } ().value,"
143
139
144
140
if member .is_enum :
145
-
146
141
member_variable_set += dedent (
147
142
f"""
148
143
if isinstance({ member .snake_case } ,{ full_dot_path } .{ member .name } .enum) { is_none_check } :
@@ -168,7 +163,6 @@ def _create_init_special_member_function(node_data: NodeData, base_type: str) ->
168
163
)
169
164
170
165
for child_class in node_data .children :
171
-
172
166
if child_class .is_uninstantiated_node :
173
167
continue
174
168
signature_vars += f"{ child_class .snake_case } =None,"
@@ -224,7 +218,6 @@ def __eq__(self, other):
224
218
225
219
226
220
def _create_str_special_member_function (node_data : NodeData , base_type : str ) -> str :
227
-
228
221
full_underscore_path = _get_underscore_name (base_type , node_data .path )
229
222
str_content = f"str(_to_internal_{ full_underscore_path } (self))"
230
223
@@ -237,12 +230,10 @@ def __str__(self):
237
230
238
231
239
232
def _create_properties (node_data : NodeData , base_type : str ) -> str :
240
-
241
233
get_properties = "\n "
242
234
set_properties = "\n "
243
235
244
236
for node in node_data .member_containers :
245
-
246
237
if node .container_info is None :
247
238
raise RuntimeError (f"Unexpected lack of container info: { node } " )
248
239
@@ -270,7 +261,6 @@ def {node.snake_case}(self,value):
270
261
)
271
262
272
263
for member in node_data .member_variables :
273
-
274
264
if member .member_info is None :
275
265
raise RuntimeError (f"Unexpected lack of member info: { member } " )
276
266
@@ -400,7 +390,6 @@ def save(self, file_name):
400
390
401
391
402
392
def _create_enum_class (member : NodeData , base_type : str ) -> str :
403
-
404
393
full_dot_path = _get_dot_path (base_type , member .path )
405
394
406
395
static_members = ["\n " ]
@@ -493,7 +482,6 @@ def _parse_internal_datamodel(current_class: Any) -> NodeData:
493
482
member_containers = []
494
483
to_be_removed = []
495
484
for child in child_classes :
496
-
497
485
if child .underlying_zivid_class .node_type .name == "leaf_data_model_list" :
498
486
child .container_info = ContainerInfo (
499
487
contained_type = child .underlying_zivid_class .contained_type ,
@@ -546,7 +534,6 @@ def _parse_internal_datamodel(current_class: Any) -> NodeData:
546
534
547
535
548
536
def _create_to_frontend_converter (node_data : NodeData , base_type : str ) -> str :
549
-
550
537
base_typename = base_type .split ("." )[- 1 ]
551
538
temp_internal_name = f"internal_{ node_data .snake_case } "
552
539
nested_converters = [
@@ -599,7 +586,6 @@ def _to_{underscored_path}(internal_{node_data.snake_case}):
599
586
600
587
601
588
def _create_to_internal_converter (node_data : NodeData , base_type : str ) -> str :
602
-
603
589
temp_internal_name = f"internal_{ node_data .snake_case } "
604
590
nested_converters = [
605
591
_create_to_internal_converter (element , base_type = base_type )
@@ -702,7 +688,6 @@ def _generate_datamodel_frontend(
702
688
703
689
# Format source code and save to destination path
704
690
with tempfile .NamedTemporaryFile (suffix = ".py" ) as temp_file :
705
-
706
691
temp_file_path = Path (temp_file .name )
707
692
temp_file_path .write_text (raw_text , encoding = "utf-8" )
708
693
if verbose :
@@ -717,7 +702,6 @@ def _generate_datamodel_frontend(
717
702
718
703
719
704
def generate_all_datamodels (dest_dir : Path ) -> None :
720
-
721
705
for internal_class , filename , extra_imports in [
722
706
(_zivid .Settings , "settings.py" , ["datetime" , "collections.abc" ]),
723
707
(_zivid .Settings2D , "settings_2d.py" , ["datetime" , "collections.abc" ]),
0 commit comments