mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
format with black
This commit is contained in:
parent
3efb2f9f4e
commit
bc10ccee0c
2 changed files with 10 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue