mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Remove unused imports and code
This commit is contained in:
parent
10806bce1e
commit
a9f6bf8d89
15 changed files with 12 additions and 35 deletions
|
@ -126,7 +126,7 @@ def property_completer(ast_node, match_variables):
|
||||||
|
|
||||||
|
|
||||||
@completer(
|
@completer(
|
||||||
applies_in=[language.Property, language.BaseTypedAttribute],
|
applies_in=[language.Property, language.BaseAttribute],
|
||||||
matches=[[(TokenType.IDENT, None), (TokenType.OP, ":")]],
|
matches=[[(TokenType.IDENT, None), (TokenType.OP, ":")]],
|
||||||
)
|
)
|
||||||
def prop_value_completer(ast_node, match_variables):
|
def prop_value_completer(ast_node, match_variables):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from .gtk_list_item_factory import ExtListItemFactory
|
from .gtk_list_item_factory import ExtListItemFactory
|
||||||
from .adw_message_dialog import ExtAdwMessageDialog
|
from .adw_message_dialog import ExtAdwMessageDialog
|
||||||
from .attributes import BaseAttribute, BaseTypedAttribute
|
from .attributes import BaseAttribute
|
||||||
from .binding import Binding
|
from .binding import Binding
|
||||||
from .contexts import ValueTypeCtx
|
from .contexts import ValueTypeCtx
|
||||||
from .expression import (
|
from .expression import (
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
|
|
||||||
from .values import Value, Translated
|
|
||||||
from .common import *
|
from .common import *
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,8 +30,3 @@ class BaseAttribute(AstNode):
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
return self.tokens["name"]
|
return self.tokens["name"]
|
||||||
|
|
||||||
|
|
||||||
class BaseTypedAttribute(BaseAttribute):
|
|
||||||
"""A BaseAttribute whose parent has a value_type property that can assist
|
|
||||||
in validation."""
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ from dataclasses import dataclass
|
||||||
|
|
||||||
from .common import *
|
from .common import *
|
||||||
from .expression import Expression, LookupOp, LiteralExpr
|
from .expression import Expression, LookupOp, LiteralExpr
|
||||||
from .contexts import ValueTypeCtx
|
|
||||||
|
|
||||||
|
|
||||||
class Binding(AstNode):
|
class Binding(AstNode):
|
||||||
|
|
|
@ -17,10 +17,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
from dataclasses import dataclass
|
|
||||||
|
|
||||||
from .expression import Expression
|
|
||||||
from .gobject_object import Object
|
|
||||||
from .gtkbuilder_template import Template
|
from .gtkbuilder_template import Template
|
||||||
from .values import Value, ObjectValue
|
from .values import Value, ObjectValue
|
||||||
from .common import *
|
from .common import *
|
||||||
|
|
|
@ -18,10 +18,11 @@
|
||||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
from .gobject_object import ObjectContent, validate_parent_type
|
from .gobject_object import ObjectContent, validate_parent_type
|
||||||
from .attributes import BaseTypedAttribute
|
from .attributes import BaseAttribute
|
||||||
from .values import Value
|
from .values import Value
|
||||||
from .common import *
|
from .common import *
|
||||||
from .contexts import ValueTypeCtx
|
from .contexts import ValueTypeCtx
|
||||||
|
from ..decompiler import escape_quote
|
||||||
|
|
||||||
|
|
||||||
def get_property_types(gir):
|
def get_property_types(gir):
|
||||||
|
@ -105,7 +106,7 @@ def _get_docs(gir, name):
|
||||||
return gir_type.doc
|
return gir_type.doc
|
||||||
|
|
||||||
|
|
||||||
class A11yProperty(BaseTypedAttribute):
|
class A11yProperty(BaseAttribute):
|
||||||
grammar = Statement(
|
grammar = Statement(
|
||||||
UseIdent("name"),
|
UseIdent("name"),
|
||||||
":",
|
":",
|
||||||
|
@ -208,7 +209,7 @@ def decompile_relation(ctx, gir, name, cdata):
|
||||||
@decompiler("state", cdata=True)
|
@decompiler("state", cdata=True)
|
||||||
def decompile_state(ctx, gir, name, cdata, translatable="false"):
|
def decompile_state(ctx, gir, name, cdata, translatable="false"):
|
||||||
if decompile.truthy(translatable):
|
if decompile.truthy(translatable):
|
||||||
ctx.print(f'{name}: _("{_escape_quote(cdata)}");')
|
ctx.print(f'{name}: _("{escape_quote(cdata)}");')
|
||||||
else:
|
else:
|
||||||
ctx.print_attribute(name, cdata, get_types(ctx.gir).get(name))
|
ctx.print_attribute(name, cdata, get_types(ctx.gir).get(name))
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
|
|
||||||
from .attributes import BaseTypedAttribute
|
|
||||||
from .gobject_object import ObjectContent, validate_parent_type
|
from .gobject_object import ObjectContent, validate_parent_type
|
||||||
from .common import *
|
from .common import *
|
||||||
from .contexts import ValueTypeCtx
|
from .contexts import ValueTypeCtx
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
|
|
||||||
from .attributes import BaseAttribute
|
|
||||||
from .gobject_object import ObjectContent, validate_parent_type
|
from .gobject_object import ObjectContent, validate_parent_type
|
||||||
from .common import *
|
from .common import *
|
||||||
from .contexts import ValueTypeCtx
|
from .contexts import ValueTypeCtx
|
||||||
|
|
|
@ -21,10 +21,7 @@ import typing as T
|
||||||
|
|
||||||
from blueprintcompiler.language.values import StringValue
|
from blueprintcompiler.language.values import StringValue
|
||||||
|
|
||||||
from .attributes import BaseAttribute
|
|
||||||
from .gobject_object import Object, ObjectContent
|
|
||||||
from .common import *
|
from .common import *
|
||||||
from .values import Translated, QuotedLiteral
|
|
||||||
from .contexts import ValueTypeCtx
|
from .contexts import ValueTypeCtx
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,14 +48,6 @@ class Menu(AstNode):
|
||||||
raise CompileError("Menu requires an ID")
|
raise CompileError("Menu requires an ID")
|
||||||
|
|
||||||
|
|
||||||
class MenuValue(AstNode):
|
|
||||||
grammar = AnyOf(QuotedLiteral, Translated)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def child(self) -> T.Union[QuotedLiteral, Translated]:
|
|
||||||
return self.children[0]
|
|
||||||
|
|
||||||
|
|
||||||
class MenuAttribute(AstNode):
|
class MenuAttribute(AstNode):
|
||||||
tag_name = "attribute"
|
tag_name = "attribute"
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
|
|
||||||
from .attributes import BaseTypedAttribute
|
|
||||||
from .gobject_object import ObjectContent, validate_parent_type
|
from .gobject_object import ObjectContent, validate_parent_type
|
||||||
from .values import StringValue
|
from .values import StringValue
|
||||||
from .common import *
|
from .common import *
|
||||||
|
|
|
@ -25,6 +25,10 @@ from .common import *
|
||||||
class StyleClass(AstNode):
|
class StyleClass(AstNode):
|
||||||
grammar = UseQuoted("name")
|
grammar = UseQuoted("name")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self) -> str:
|
||||||
|
return self.tokens["name"]
|
||||||
|
|
||||||
|
|
||||||
class ExtStyles(AstNode):
|
class ExtStyles(AstNode):
|
||||||
grammar = [
|
grammar = [
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
from .common import *
|
from .common import *
|
||||||
from .contexts import ScopeCtx
|
from .contexts import ScopeCtx
|
||||||
from .gobject_object import Object
|
from .gobject_object import Object
|
||||||
from .gtkbuilder_template import Template
|
|
||||||
|
|
||||||
|
|
||||||
class PropertyBindingFlag(AstNode):
|
class PropertyBindingFlag(AstNode):
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
|
|
||||||
import typing as T
|
|
||||||
from .common import *
|
from .common import *
|
||||||
from ..gir import Class, ExternType, Interface
|
from ..gir import Class, ExternType, Interface
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,6 @@ import typing as T
|
||||||
|
|
||||||
from .common import *
|
from .common import *
|
||||||
from .types import TypeName
|
from .types import TypeName
|
||||||
from .property_binding import PropertyBinding
|
|
||||||
from .binding import Binding
|
|
||||||
from .gobject_object import Object
|
from .gobject_object import Object
|
||||||
from .contexts import ScopeCtx, ValueTypeCtx
|
from .contexts import ScopeCtx, ValueTypeCtx
|
||||||
|
|
||||||
|
|
|
@ -335,8 +335,8 @@ class XmlOutput(OutputFormat):
|
||||||
|
|
||||||
elif isinstance(extension, ExtStyles):
|
elif isinstance(extension, ExtStyles):
|
||||||
xml.start_tag("style")
|
xml.start_tag("style")
|
||||||
for prop in extension.children:
|
for style in extension.children:
|
||||||
xml.put_self_closing("class", name=prop.tokens["name"])
|
xml.put_self_closing("class", name=style.name)
|
||||||
xml.end_tag()
|
xml.end_tag()
|
||||||
|
|
||||||
elif isinstance(extension, ExtSizeGroupWidgets):
|
elif isinstance(extension, ExtSizeGroupWidgets):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue