Skip to content

Commit c066fb7

Browse files
committed
Fix: pycodestyle E128 and E122
Errors: ``` ./src/fake_bpy_module/analyzer/directives.py:125:13: E128 continuation line under-indented for visual indent ./src/fake_bpy_module/analyzer/directives.py:132:13: E128 continuation line under-indented for visual indent ./src/fake_bpy_module/analyzer/directives.py:139:13: E128 continuation line under-indented for visual indent ./src/fake_bpy_module/analyzer/directives.py:146:13: E122 continuation line missing indentation or outdented ./src/fake_bpy_module/analyzer/directives.py:147:13: E122 continuation line missing indentation or outdented ./src/fake_bpy_module/analyzer/directives.py:148:13: E122 continuation line missing indentation or outdented ```
1 parent b5226e6 commit c066fb7

File tree

1 file changed

+22
-25
lines changed

1 file changed

+22
-25
lines changed

src/fake_bpy_module/analyzer/directives.py

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -119,36 +119,33 @@ def parse_func_arg_default_value(expr: ast.expr) -> str | None:
119119
return expr.value
120120
if isinstance(expr, ast.Name):
121121
return expr.id
122-
if isinstance(expr, ast.List):
123-
return (
124-
f"""[{', '.join(str(parse_func_arg_default_value(e))
125-
for e in expr.elts)}]"""
126-
if len(expr.elts) > 0
127-
else "[]"
122+
123+
def get_items_str(expr: ast.List | ast.Tuple | ast.Set) -> str:
124+
return ", ".join(
125+
str(parse_func_arg_default_value(e)) for e in expr.elts
128126
)
127+
128+
if isinstance(expr, ast.List):
129+
if len(expr.elts) == 0:
130+
return "[]"
131+
return f"[{get_items_str(expr)}]"
129132
if isinstance(expr, ast.Tuple):
130-
return (
131-
f"""({', '.join(str(parse_func_arg_default_value(e))
132-
for e in expr.elts)})"""
133-
if len(expr.elts) > 0
134-
else "()"
135-
)
133+
if len(expr.elts) == 0:
134+
return "()"
135+
return f"({get_items_str(expr)})"
136136
if isinstance(expr, ast.Set):
137-
return (
138-
f"""{{{', '.join(str(parse_func_arg_default_value(e))
139-
for e in expr.elts)}}}"""
140-
if len(expr.elts) > 0
141-
else "set()"
142-
)
137+
if len(expr.elts) == 0:
138+
return "set()"
139+
return f"{{{get_items_str(expr)}}}"
143140
if isinstance(expr, ast.Dict):
144-
return (
145-
f"""{{{', '.join(
146-
f'{parse_func_arg_default_value(k)}'
147-
f':{parse_func_arg_default_value(v)}'
148-
for k, v in zip(expr.keys, expr.values, strict=False))}}}"""
149-
if len(expr.keys) > 0
150-
else "{}"
141+
if len(expr.keys) == 0:
142+
return "{}"
143+
items = ', '.join(
144+
f'{parse_func_arg_default_value(k)}:{parse_func_arg_default_value(v)}'
145+
for k, v in zip(expr.keys, expr.values, strict=False)
151146
)
147+
return f"{{{items}}}"
148+
152149
if isinstance(expr, ast.UnaryOp):
153150
if isinstance(expr.op, ast.USub):
154151
operand = parse_func_arg_default_value(expr.operand)

0 commit comments

Comments
 (0)