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):
|
class Property(AstNode):
|
||||||
grammar = Statement(
|
grammar = Statement(
|
||||||
UseIdent("name"), ":", AnyOf(Binding, VariantValue, ObjectValue, Value, ArrayValue)
|
UseIdent("name"),
|
||||||
|
":",
|
||||||
|
AnyOf(Binding, VariantValue, ObjectValue, Value, ArrayValue),
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -371,16 +371,9 @@ class IdentLiteral(AstNode):
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class VariantValue(AstNode):
|
class VariantValue(AstNode):
|
||||||
grammar = [
|
grammar = ["variant", "<", UseQuoted("type"), ">", "(", UseQuoted("value"), ")"]
|
||||||
"variant",
|
|
||||||
"<",
|
|
||||||
UseQuoted("type"),
|
|
||||||
">",
|
|
||||||
"(",
|
|
||||||
UseQuoted("value"),
|
|
||||||
")"
|
|
||||||
]
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def var_type(self) -> str:
|
def var_type(self) -> str:
|
||||||
|
@ -404,12 +397,16 @@ class VariantValue(AstNode):
|
||||||
raise CompileError(f"Cannot convert variant to number")
|
raise CompileError(f"Cannot convert variant to number")
|
||||||
elif isinstance(expected_type, gir.StringType):
|
elif isinstance(expected_type, gir.StringType):
|
||||||
raise CompileError("Cannot convert variant to string")
|
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
|
pass
|
||||||
else:
|
else:
|
||||||
raise CompileError(f"Cannot convert variant into {expected_type.full_name}")
|
raise CompileError(f"Cannot convert variant into {expected_type.full_name}")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Literal(AstNode):
|
class Literal(AstNode):
|
||||||
grammar = AnyOf(
|
grammar = AnyOf(
|
||||||
TypeLiteral,
|
TypeLiteral,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue