Skip to content

Commit b40a5ea

Browse files
committed
WIP
1 parent 6b4107c commit b40a5ea

1 file changed

Lines changed: 28 additions & 15 deletions

File tree

src/gen_modfile/gen_node_inputs_outputs_for_node_class.py

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#
2727
##############################################################################
2828

29-
# ruff: noqa: UP006, UP032, UP035, PTH103, PTH113, PTH118, PTH120,
30-
# ruff: noqa: PTH123, SIM115
29+
# ruff: noqa: UP006, UP032, UP035, PTH103, PTH118, PTH120,
30+
# ruff: noqa: PTH123
3131

3232
import argparse
3333
import json
@@ -57,7 +57,8 @@ def analyze() -> Dict:
5757
nodetree_class_name = "{}Tree".format(node_baseclass_name)
5858

5959
try:
60-
node_group = bpy.data.node_groups.new(nodetree_class_name, nodetree_class_name)
60+
node_group = bpy.data.node_groups.new(
61+
nodetree_class_name, nodetree_class_name)
6162
except TypeError:
6263
continue
6364

@@ -106,15 +107,19 @@ def analyze() -> Dict:
106107
new_func_def["parameter_details"].append({
107108
"name": "key",
108109
"description": None,
109-
"data_type": 'typing.Literal[{}] | typing.Literal["{}"]'
110-
.format(i, node_input.name),
110+
"data_type": (
111+
'typing.Literal[{}] | typing.Literal["{}"]'
112+
.format(i, node_input.name)
113+
),
111114
"mod_option": "skip-refine",
112115
})
113116
new_func_def["return"] = {
114117
"type": "return",
115118
"description": None,
116-
"data_type": ":class:`bpy.types.{}`"
117-
.format(node_input.__class__.__name__),
119+
"data_type": (
120+
":class:`bpy.types.{}`"
121+
.format(node_input.__class__.__name__)
122+
),
118123
}
119124
new_class_def["methods"].append(new_func_def)
120125

@@ -127,8 +132,10 @@ def analyze() -> Dict:
127132
"description": None,
128133
"class": node_class_name,
129134
"module": "bpy.types",
130-
"data_type": ":class:`bpy.types.{}`"
131-
.format(fake_class_name),
135+
"data_type": (
136+
":class:`bpy.types.{}`"
137+
.format(fake_class_name)
138+
),
132139
"mod_option": "skip-refine",
133140
}
134141
append_class_def["attributes"].append(new_attribute)
@@ -160,15 +167,19 @@ def analyze() -> Dict:
160167
new_func_def["parameter_details"].append({
161168
"name": "key",
162169
"description": None,
163-
"data_type": 'typing.Literal[{}] | typing.Literal["{}"]'
164-
.format(i, node_output.name),
170+
"data_type": (
171+
'typing.Literal[{}] | typing.Literal["{}"]'
172+
.format(i, node_output.name)
173+
),
165174
"mod_option": "skip-refine",
166175
})
167176
new_func_def["return"] = {
168177
"type": "return",
169178
"description": None,
170-
"data_type": ":class:`bpy.types.{}`"
179+
"data_type": (
180+
":class:`bpy.types.{}`"
171181
.format(node_output.__class__.__name__)
182+
),
172183
}
173184
new_class_def["methods"].append(new_func_def)
174185

@@ -181,8 +192,10 @@ def analyze() -> Dict:
181192
"description": None,
182193
"class": node_class_name,
183194
"module": "bpy.types",
184-
"data_type": ":class:`bpy.types.{}`"
185-
.format(fake_class_name),
195+
"data_type": (
196+
":class:`bpy.types.{}`"
197+
.format(fake_class_name)
198+
),
186199
}
187200
append_class_def["attributes"].append(new_attribute_def)
188201
results["append"].append(append_class_def)
@@ -207,7 +220,7 @@ def write_class_info(f: TextIO, mod_kind: str, class_info: Dict) -> None:
207220
", ".join(func_info["parameters"])))
208221
if "overload" in func_info["options"]:
209222
f.write(" :option function: overload\n")
210-
for param_info in func_info["parameter_details"]: # noqa: FURB122
223+
for param_info in func_info["parameter_details"]:
211224
f.write(" :type {}: {}\n"
212225
.format(param_info["name"], param_info["data_type"]))
213226
f.write(" :mod-option arg {}: {}\n"

0 commit comments

Comments
 (0)