Remove unused imports and code

This commit is contained in:
James Westman 2023-04-11 21:26:37 -05:00
parent 10806bce1e
commit a9f6bf8d89
15 changed files with 12 additions and 35 deletions

View file

@ -126,7 +126,7 @@ def property_completer(ast_node, match_variables):
@completer(
applies_in=[language.Property, language.BaseTypedAttribute],
applies_in=[language.Property, language.BaseAttribute],
matches=[[(TokenType.IDENT, None), (TokenType.OP, ":")]],
)
def prop_value_completer(ast_node, match_variables):

View file

@ -1,6 +1,6 @@
from .gtk_list_item_factory import ExtListItemFactory
from .adw_message_dialog import ExtAdwMessageDialog
from .attributes import BaseAttribute, BaseTypedAttribute
from .attributes import BaseAttribute
from .binding import Binding
from .contexts import ValueTypeCtx
from .expression import (

View file

@ -18,7 +18,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
from .values import Value, Translated
from .common import *
@ -31,8 +30,3 @@ class BaseAttribute(AstNode):
@property
def name(self):
return self.tokens["name"]
class BaseTypedAttribute(BaseAttribute):
"""A BaseAttribute whose parent has a value_type property that can assist
in validation."""

View file

@ -21,7 +21,6 @@ from dataclasses import dataclass
from .common import *
from .expression import Expression, LookupOp, LiteralExpr
from .contexts import ValueTypeCtx
class Binding(AstNode):

View file

@ -17,10 +17,7 @@
#
# 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 .values import Value, ObjectValue
from .common import *

View file

@ -18,10 +18,11 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
from .gobject_object import ObjectContent, validate_parent_type
from .attributes import BaseTypedAttribute
from .attributes import BaseAttribute
from .values import Value
from .common import *
from .contexts import ValueTypeCtx
from ..decompiler import escape_quote
def get_property_types(gir):
@ -105,7 +106,7 @@ def _get_docs(gir, name):
return gir_type.doc
class A11yProperty(BaseTypedAttribute):
class A11yProperty(BaseAttribute):
grammar = Statement(
UseIdent("name"),
":",
@ -208,7 +209,7 @@ def decompile_relation(ctx, gir, name, cdata):
@decompiler("state", cdata=True)
def decompile_state(ctx, gir, name, cdata, translatable="false"):
if decompile.truthy(translatable):
ctx.print(f'{name}: _("{_escape_quote(cdata)}");')
ctx.print(f'{name}: _("{escape_quote(cdata)}");')
else:
ctx.print_attribute(name, cdata, get_types(ctx.gir).get(name))

View file

@ -18,7 +18,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
from .attributes import BaseTypedAttribute
from .gobject_object import ObjectContent, validate_parent_type
from .common import *
from .contexts import ValueTypeCtx

View file

@ -18,7 +18,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
from .attributes import BaseAttribute
from .gobject_object import ObjectContent, validate_parent_type
from .common import *
from .contexts import ValueTypeCtx

View file

@ -21,10 +21,7 @@ import typing as T
from blueprintcompiler.language.values import StringValue
from .attributes import BaseAttribute
from .gobject_object import Object, ObjectContent
from .common import *
from .values import Translated, QuotedLiteral
from .contexts import ValueTypeCtx
@ -51,14 +48,6 @@ class Menu(AstNode):
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):
tag_name = "attribute"

View file

@ -18,7 +18,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
from .attributes import BaseTypedAttribute
from .gobject_object import ObjectContent, validate_parent_type
from .values import StringValue
from .common import *

View file

@ -25,6 +25,10 @@ from .common import *
class StyleClass(AstNode):
grammar = UseQuoted("name")
@property
def name(self) -> str:
return self.tokens["name"]
class ExtStyles(AstNode):
grammar = [

View file

@ -20,7 +20,6 @@
from .common import *
from .contexts import ScopeCtx
from .gobject_object import Object
from .gtkbuilder_template import Template
class PropertyBindingFlag(AstNode):

View file

@ -18,7 +18,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
import typing as T
from .common import *
from ..gir import Class, ExternType, Interface

View file

@ -21,8 +21,6 @@ import typing as T
from .common import *
from .types import TypeName
from .property_binding import PropertyBinding
from .binding import Binding
from .gobject_object import Object
from .contexts import ScopeCtx, ValueTypeCtx

View file

@ -335,8 +335,8 @@ class XmlOutput(OutputFormat):
elif isinstance(extension, ExtStyles):
xml.start_tag("style")
for prop in extension.children:
xml.put_self_closing("class", name=prop.tokens["name"])
for style in extension.children:
xml.put_self_closing("class", name=style.name)
xml.end_tag()
elif isinstance(extension, ExtSizeGroupWidgets):