format with black

This commit is contained in:
jgcodes2020 2024-12-23 20:58:45 -05:00
parent 3efb2f9f4e
commit bc10ccee0c
2 changed files with 10 additions and 11 deletions

View file

@ -27,7 +27,9 @@ from .values import ArrayValue, ObjectValue, Value, VariantValue
class Property(AstNode):
grammar = Statement(
UseIdent("name"), ":", AnyOf(Binding, VariantValue, ObjectValue, Value, ArrayValue)
UseIdent("name"),
":",
AnyOf(Binding, VariantValue, ObjectValue, Value, ArrayValue),
)
@property

View file

@ -371,16 +371,9 @@ class IdentLiteral(AstNode):
else:
return None
class VariantValue(AstNode):
grammar = [
"variant",
"<",
UseQuoted("type"),
">",
"(",
UseQuoted("value"),
")"
]
grammar = ["variant", "<", UseQuoted("type"), ">", "(", UseQuoted("value"), ")"]
@property
def var_type(self) -> str:
@ -404,12 +397,16 @@ class VariantValue(AstNode):
raise CompileError(f"Cannot convert variant to number")
elif isinstance(expected_type, gir.StringType):
raise CompileError("Cannot convert variant to string")
elif isinstance(expected_type, gir.Boxed) and expected_type.full_name == "GLib.Variant":
elif (
isinstance(expected_type, gir.Boxed)
and expected_type.full_name == "GLib.Variant"
):
pass
else:
raise CompileError(f"Cannot convert variant into {expected_type.full_name}")
pass
class Literal(AstNode):
grammar = AnyOf(
TypeLiteral,