mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Format using black
This commit is contained in:
parent
6a36d92380
commit
8fee46ec68
40 changed files with 975 additions and 610 deletions
|
@ -27,16 +27,19 @@ from .common import *
|
|||
|
||||
|
||||
class UI(AstNode):
|
||||
""" The AST node for the entire file """
|
||||
"""The AST node for the entire file"""
|
||||
|
||||
grammar = [
|
||||
GtkDirective,
|
||||
ZeroOrMore(Import),
|
||||
Until(AnyOf(
|
||||
Template,
|
||||
menu,
|
||||
Object,
|
||||
), Eof()),
|
||||
Until(
|
||||
AnyOf(
|
||||
Template,
|
||||
menu,
|
||||
Object,
|
||||
),
|
||||
Eof(),
|
||||
),
|
||||
]
|
||||
|
||||
@property
|
||||
|
@ -61,11 +64,13 @@ class UI(AstNode):
|
|||
|
||||
return gir_ctx
|
||||
|
||||
|
||||
@property
|
||||
def objects_by_id(self):
|
||||
return { obj.tokens["id"]: obj for obj in self.iterate_children_recursive() if obj.tokens["id"] is not None }
|
||||
|
||||
return {
|
||||
obj.tokens["id"]: obj
|
||||
for obj in self.iterate_children_recursive()
|
||||
if obj.tokens["id"] is not None
|
||||
}
|
||||
|
||||
@validate()
|
||||
def gir_errors(self):
|
||||
|
@ -74,7 +79,6 @@ class UI(AstNode):
|
|||
if len(self._gir_errors):
|
||||
raise MultipleErrors(self._gir_errors)
|
||||
|
||||
|
||||
@validate()
|
||||
def unique_ids(self):
|
||||
passed = {}
|
||||
|
@ -84,5 +88,7 @@ class UI(AstNode):
|
|||
|
||||
if obj.tokens["id"] in passed:
|
||||
token = obj.group.tokens["id"]
|
||||
raise CompileError(f"Duplicate object ID '{obj.tokens['id']}'", token.start, token.end)
|
||||
raise CompileError(
|
||||
f"Duplicate object ID '{obj.tokens['id']}'", token.start, token.end
|
||||
)
|
||||
passed[obj.tokens["id"]] = obj
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue