Skip to content

Commit

Permalink
Fix Python black (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbampton authored Jan 7, 2025
1 parent b814f14 commit 86bd109
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
10 changes: 6 additions & 4 deletions config/module/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def command_layout_type(item: Dict[str, Any], prefix: str, value: str) -> str:
)


def command_layout_style_type(item: Dict[str, Any], prefix: str, value: str, extra: str = 'none') -> str:
def command_layout_style_type(
item: Dict[str, Any], prefix: str, value: str, extra: str = "none"
) -> str:
"""
Generates a formatted command string based on the item and value provided.
:param item: Dictionary containing item data.
Expand All @@ -75,7 +77,7 @@ def command_layout_style_type(item: Dict[str, Any], prefix: str, value: str, ext
else "NULL"
)

if extra == 'none':
if extra == "none":
return (
f"({itemid}, "
f'"{idtext}", '
Expand All @@ -84,7 +86,7 @@ def command_layout_style_type(item: Dict[str, Any], prefix: str, value: str, ext
f'"{generate_name}", '
f"{type}, {reserved_values}, NULL)"
)
elif extra == '':
elif extra == "":
return (
f"({itemid}, "
f'"{idtext}", '
Expand All @@ -93,7 +95,7 @@ def command_layout_style_type(item: Dict[str, Any], prefix: str, value: str, ext
f'"{generate_name}", '
f"{type}, {reserved_values}, NULL, value_handler_simple)"
)
else:
else:
return (
f"({itemid}, "
f'"{idtext}", '
Expand Down
31 changes: 24 additions & 7 deletions config/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def prettify_layout_attribute_type(item: Dict[str, Any], group: Dict[str, Any])
else:
return (
key_normal
+ command_layout_style_type(item, "AST_LAYOUT_ATTRIBUTE_TYPE_", values, value_handler)
+ command_layout_style_type(
item, "AST_LAYOUT_ATTRIBUTE_TYPE_", values, value_handler
)
+ "\n"
)

Expand Down Expand Up @@ -168,15 +170,21 @@ def prettify_layout_attribute_style_type(
result += (
key_hide
+ command_layout_style_type(
item, "AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_", value, value_handler
item,
"AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_",
value,
value_handler,
)
+ "\n"
)
else:
result += (
key_repeat
+ command_layout_style_type(
item, "AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_", value, value_handler
item,
"AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_",
value,
value_handler,
)
+ "\n"
)
Expand All @@ -197,15 +205,21 @@ def prettify_layout_attribute_style_type(
result += (
key_main
+ command_layout_style_type(
item, "AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_", value, value_handler
item,
"AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_",
value,
value_handler,
)
+ "\n"
)
else:
result += (
key_repeat
+ command_layout_style_type(
item, "AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_", value, value_handler
item,
"AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_",
value,
value_handler,
)
+ "\n"
)
Expand Down Expand Up @@ -399,7 +413,7 @@ def prettify_layout_type_attributes_all(
return "{" + f" {itemid}, {var_attrs}, {var_attrs_length}" + " },\n"
else:
return ""


def prettify_layout_type_attributes_values_extern(
item: Dict[str, Any], group: Dict[str, Any]
Expand Down Expand Up @@ -458,7 +472,10 @@ def prettify_layout_type_attributes_values(
result += "};\n"
result += f"const size_t {var_attrs_length} = sizeof({var_attrs}) / sizeof({var_attrs}[0]);\n"
else:
result += f"ast_layout_attribute_type_t {var_attrs}[] = " + "{ AST_LAYOUT_ATTRIBUTE_TYPE_ERROR };\n"
result += (
f"ast_layout_attribute_type_t {var_attrs}[] = "
+ "{ AST_LAYOUT_ATTRIBUTE_TYPE_ERROR };\n"
)
result += f"const size_t {var_attrs_length} = 0;\n"

return result
Expand Down

0 comments on commit 86bd109

Please sign in to comment.