mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-05 16:09:07 -04:00
cleanup: Format using black
This commit is contained in:
parent
4b42016837
commit
af03c2ac0f
36 changed files with 928 additions and 616 deletions
|
@ -24,8 +24,12 @@ from .common import *
|
|||
|
||||
class GtkDirective(AstNode):
|
||||
grammar = Statement(
|
||||
Match("using").err("File must start with a \"using Gtk\" directive (e.g. `using Gtk 4.0;`)"),
|
||||
Match("Gtk").err("File must start with a \"using Gtk\" directive (e.g. `using Gtk 4.0;`)"),
|
||||
Match("using").err(
|
||||
'File must start with a "using Gtk" directive (e.g. `using Gtk 4.0;`)'
|
||||
),
|
||||
Match("Gtk").err(
|
||||
'File must start with a "using Gtk" directive (e.g. `using Gtk 4.0;`)'
|
||||
),
|
||||
UseNumberText("version").expected("a version number for GTK"),
|
||||
)
|
||||
|
||||
|
@ -34,17 +38,17 @@ class GtkDirective(AstNode):
|
|||
if self.tokens["version"] not in ["4.0"]:
|
||||
err = CompileError("Only GTK 4 is supported")
|
||||
if self.tokens["version"].startswith("4"):
|
||||
err.hint("Expected the GIR version, not an exact version number. Use `using Gtk 4.0;`.")
|
||||
err.hint(
|
||||
"Expected the GIR version, not an exact version number. Use `using Gtk 4.0;`."
|
||||
)
|
||||
else:
|
||||
err.hint("Expected `using Gtk 4.0;`")
|
||||
raise err
|
||||
|
||||
|
||||
@property
|
||||
def gir_namespace(self):
|
||||
return gir.get_namespace("Gtk", self.tokens["version"])
|
||||
|
||||
|
||||
def emit_xml(self, xml: XmlEmitter):
|
||||
xml.put_self_closing("requires", lib="gtk", version=self.tokens["version"])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue