Add isort to CI and run on files

This commit is contained in:
gregorni 2023-07-09 14:26:37 +00:00 committed by James Westman
parent f526cfa4d9
commit 3730e2e726
45 changed files with 112 additions and 113 deletions

View file

@ -7,6 +7,7 @@ build:
stage: build stage: build
script: script:
- black --check --diff blueprintcompiler tests - black --check --diff blueprintcompiler tests
- isort --check --diff --profile black blueprintcompiler tests
- mypy --python-version=3.9 blueprintcompiler - mypy --python-version=3.9 blueprintcompiler
- G_DEBUG=fatal-warnings xvfb-run coverage run -m unittest - G_DEBUG=fatal-warnings xvfb-run coverage run -m unittest
- coverage report - coverage report

View file

@ -19,7 +19,8 @@
# #
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
import os, sys import os
import sys
# These variables should be set by meson. If they aren't, we're running # These variables should be set by meson. If they aren't, we're running
# uninstalled, and we might have to guess some values. # uninstalled, and we might have to guess some values.

View file

@ -17,9 +17,9 @@
# #
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
import typing as T
from collections import ChainMap, defaultdict from collections import ChainMap, defaultdict
from functools import cached_property from functools import cached_property
import typing as T
from .errors import * from .errors import *
from .lsp_utils import SemanticToken from .lsp_utils import SemanticToken

View file

@ -20,12 +20,12 @@
import typing as T import typing as T
from . import gir, language from . import gir, language
from .language.types import ClassName
from .ast_utils import AstNode from .ast_utils import AstNode
from .completions_utils import * from .completions_utils import *
from .language.types import ClassName
from .lsp_utils import Completion, CompletionItemKind from .lsp_utils import Completion, CompletionItemKind
from .parser import SKIP_TOKENS from .parser import SKIP_TOKENS
from .tokenizer import TokenType, Token from .tokenizer import Token, TokenType
Pattern = T.List[T.Tuple[TokenType, T.Optional[str]]] Pattern = T.List[T.Tuple[TokenType, T.Optional[str]]]

View file

@ -20,9 +20,8 @@
import typing as T import typing as T
from .tokenizer import Token, TokenType
from .lsp_utils import Completion from .lsp_utils import Completion
from .tokenizer import Token, TokenType
new_statement_patterns = [ new_statement_patterns = [
[(TokenType.PUNCTUATION, "{")], [(TokenType.PUNCTUATION, "{")],

View file

@ -18,14 +18,13 @@
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
import re import re
from enum import Enum
import typing as T import typing as T
from dataclasses import dataclass from dataclasses import dataclass
from enum import Enum
from .xml_reader import Element, parse, parse_string
from .gir import * from .gir import *
from .utils import Colors from .utils import Colors
from .xml_reader import Element, parse, parse_string
__all__ = ["decompile"] __all__ = ["decompile"]

View file

@ -17,9 +17,11 @@
# #
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
from dataclasses import dataclass import sys
import traceback
import typing as T import typing as T
import sys, traceback from dataclasses import dataclass
from . import utils from . import utils
from .utils import Colors from .utils import Colors

View file

@ -17,17 +17,18 @@
# #
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
from functools import cached_property import os
import sys
import typing as T import typing as T
import os, sys from functools import cached_property
import gi # type: ignore import gi # type: ignore
gi.require_version("GIRepository", "2.0") gi.require_version("GIRepository", "2.0")
from gi.repository import GIRepository # type: ignore from gi.repository import GIRepository # type: ignore
from .errors import CompileError, CompilerBugError
from . import typelib, xml_reader from . import typelib, xml_reader
from .errors import CompileError, CompilerBugError
_namespace_cache: T.Dict[str, "Namespace"] = {} _namespace_cache: T.Dict[str, "Namespace"] = {}
_xml_cache = {} _xml_cache = {}

View file

@ -18,16 +18,15 @@
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
import typing as T
import difflib import difflib
import os import os
import typing as T
from . import decompiler, tokenizer, parser from . import decompiler, parser, tokenizer
from .errors import CompilerBugError, MultipleErrors, PrintableError
from .outputs.xml import XmlOutput from .outputs.xml import XmlOutput
from .errors import MultipleErrors, PrintableError, CompilerBugError
from .utils import Colors from .utils import Colors
# A tool to interactively port projects to blueprints. # A tool to interactively port projects to blueprints.

View file

@ -1,12 +1,12 @@
from .gtk_list_item_factory import ExtListItemFactory from .adw_breakpoint import (
AdwBreakpointCondition,
AdwBreakpointSetter,
AdwBreakpointSetters,
)
from .adw_message_dialog import ExtAdwMessageDialog from .adw_message_dialog import ExtAdwMessageDialog
from .attributes import BaseAttribute from .attributes import BaseAttribute
from .adw_breakpoint import (
AdwBreakpointSetters,
AdwBreakpointSetter,
AdwBreakpointCondition,
)
from .binding import Binding from .binding import Binding
from .common import *
from .contexts import ScopeCtx, ValueTypeCtx from .contexts import ScopeCtx, ValueTypeCtx
from .expression import ( from .expression import (
CastExpr, CastExpr,
@ -23,23 +23,24 @@ from .gobject_signal import Signal
from .gtk_a11y import ExtAccessibility from .gtk_a11y import ExtAccessibility
from .gtk_combo_box_text import ExtComboBoxItems from .gtk_combo_box_text import ExtComboBoxItems
from .gtk_file_filter import ( from .gtk_file_filter import (
Filters,
ext_file_filter_mime_types, ext_file_filter_mime_types,
ext_file_filter_patterns, ext_file_filter_patterns,
ext_file_filter_suffixes, ext_file_filter_suffixes,
Filters,
) )
from .gtk_layout import ExtLayout from .gtk_layout import ExtLayout
from .gtk_menu import menu, Menu, MenuAttribute from .gtk_list_item_factory import ExtListItemFactory
from .gtk_menu import Menu, MenuAttribute, menu
from .gtk_scale import ExtScaleMarks from .gtk_scale import ExtScaleMarks
from .gtk_size_group import ExtSizeGroupWidgets from .gtk_size_group import ExtSizeGroupWidgets
from .gtk_string_list import ExtStringListStrings from .gtk_string_list import ExtStringListStrings
from .gtk_styles import ExtStyles from .gtk_styles import ExtStyles
from .gtkbuilder_child import Child, ChildType, ChildInternal, ChildExtension from .gtkbuilder_child import Child, ChildExtension, ChildInternal, ChildType
from .gtkbuilder_template import Template from .gtkbuilder_template import Template
from .imports import GtkDirective, Import from .imports import GtkDirective, Import
from .property_binding import PropertyBinding from .property_binding import PropertyBinding
from .ui import UI
from .types import ClassName from .types import ClassName
from .ui import UI
from .values import ( from .values import (
Flag, Flag,
Flags, Flags,
@ -54,8 +55,6 @@ from .values import (
Value, Value,
) )
from .common import *
OBJECT_CONTENT_HOOKS.children = [ OBJECT_CONTENT_HOOKS.children = [
Signal, Signal,
Property, Property,

View file

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

View file

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

View file

@ -18,36 +18,35 @@
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
from .. import gir
from ..ast_utils import AstNode, validate, docs, context
from ..errors import (
CompileError,
MultipleErrors,
UpgradeWarning,
CompileWarning,
CodeAction,
)
from ..completions_utils import *
from .. import decompiler as decompile from .. import decompiler as decompile
from .. import gir
from ..ast_utils import AstNode, context, docs, validate
from ..completions_utils import *
from ..decompiler import ( from ..decompiler import (
DecompileCtx, DecompileCtx,
decompile_translatable,
decompiler, decompiler,
escape_quote, escape_quote,
truthy, truthy,
decompile_translatable, )
from ..errors import (
CodeAction,
CompileError,
CompileWarning,
MultipleErrors,
UpgradeWarning,
) )
from ..gir import ( from ..gir import (
StringType,
BoolType, BoolType,
IntType,
FloatType,
GirType,
Enumeration, Enumeration,
ExternType, ExternType,
FloatType,
GirType,
IntType,
StringType,
) )
from ..lsp_utils import Completion, CompletionItemKind, SemanticToken, SemanticTokenType from ..lsp_utils import Completion, CompletionItemKind, SemanticToken, SemanticTokenType
from ..parse_tree import * from ..parse_tree import *
OBJECT_CONTENT_HOOKS = AnyOf() OBJECT_CONTENT_HOOKS = AnyOf()
LITERAL = AnyOf() LITERAL = AnyOf()

View file

@ -38,8 +38,8 @@ class ScopeCtx:
@cached_property @cached_property
def template(self): def template(self):
from .ui import UI
from .gtk_list_item_factory import ExtListItemFactory from .gtk_list_item_factory import ExtListItemFactory
from .ui import UI
if isinstance(self.node, UI): if isinstance(self.node, UI):
return self.node.template return self.node.template

View file

@ -20,9 +20,8 @@
from .common import * from .common import *
from .contexts import ScopeCtx, ValueTypeCtx from .contexts import ScopeCtx, ValueTypeCtx
from .types import TypeName
from .gtkbuilder_template import Template from .gtkbuilder_template import Template
from .types import TypeName
expr = Sequence() expr = Sequence()

View file

@ -25,7 +25,6 @@ from .common import *
from .response_id import ExtResponse from .response_id import ExtResponse
from .types import ClassName, ConcreteClassName from .types import ClassName, ConcreteClassName
RESERVED_IDS = {"this", "self", "template", "true", "false", "null", "none"} RESERVED_IDS = {"this", "self", "template", "true", "false", "null", "none"}

View file

@ -18,12 +18,12 @@
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
from .gtkbuilder_template import Template from .binding import Binding
from .values import Value, ObjectValue
from .common import * from .common import *
from .contexts import ValueTypeCtx from .contexts import ValueTypeCtx
from .gtkbuilder_template import Template
from .property_binding import PropertyBinding from .property_binding import PropertyBinding
from .binding import Binding from .values import ObjectValue, Value
class Property(AstNode): class Property(AstNode):

View file

@ -19,9 +19,9 @@
import typing as T import typing as T
from .gtkbuilder_template import Template
from .contexts import ScopeCtx
from .common import * from .common import *
from .contexts import ScopeCtx
from .gtkbuilder_template import Template
class SignalFlag(AstNode): class SignalFlag(AstNode):

View file

@ -17,12 +17,12 @@
# #
# 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 ..decompiler import escape_quote
from .attributes import BaseAttribute from .attributes import BaseAttribute
from .values import Value
from .common import * from .common import *
from .contexts import ValueTypeCtx from .contexts import ValueTypeCtx
from ..decompiler import escape_quote from .gobject_object import ObjectContent, validate_parent_type
from .values import Value
def get_property_types(gir): def get_property_types(gir):

View file

@ -18,9 +18,9 @@
# 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 .common import * from .common import *
from .contexts import ValueTypeCtx from .contexts import ValueTypeCtx
from .gobject_object import ObjectContent, validate_parent_type
from .values import StringValue from .values import StringValue

View file

@ -18,8 +18,8 @@
# 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 .common import * from .common import *
from .gobject_object import ObjectContent, validate_parent_type
class Filters(AstNode): class Filters(AstNode):

View file

@ -18,9 +18,9 @@
# 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 .common import * from .common import *
from .contexts import ValueTypeCtx from .contexts import ValueTypeCtx
from .gobject_object import ObjectContent, validate_parent_type
from .values import Value from .values import Value

View file

@ -1,9 +1,9 @@
from .gobject_object import ObjectContent, validate_parent_type
from ..parse_tree import Keyword
from ..ast_utils import AstNode, validate from ..ast_utils import AstNode, validate
from ..parse_tree import Keyword
from .common import * from .common import *
from .types import TypeName
from .contexts import ScopeCtx from .contexts import ScopeCtx
from .gobject_object import ObjectContent, validate_parent_type
from .types import TypeName
class ExtListItemFactory(AstNode): class ExtListItemFactory(AstNode):

View file

@ -17,8 +17,8 @@
# #
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
from .gobject_object import validate_parent_type, ObjectContent
from .common import * from .common import *
from .gobject_object import ObjectContent, validate_parent_type
from .values import StringValue from .values import StringValue

View file

@ -18,9 +18,9 @@
# 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 .common import * from .common import *
from .contexts import ScopeCtx from .contexts import ScopeCtx
from .gobject_object import ObjectContent, validate_parent_type
class Widget(AstNode): class Widget(AstNode):

View file

@ -18,9 +18,9 @@
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
from .common import *
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 *
class Item(AstNode): class Item(AstNode):

View file

@ -18,8 +18,8 @@
# 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 .common import * from .common import *
from .gobject_object import ObjectContent, validate_parent_type
class StyleClass(AstNode): class StyleClass(AstNode):

View file

@ -20,9 +20,9 @@
from functools import cached_property from functools import cached_property
from .common import *
from .gobject_object import Object from .gobject_object import Object
from .response_id import ExtResponse from .response_id import ExtResponse
from .common import *
ALLOWED_PARENTS: T.List[T.Tuple[str, str]] = [ ALLOWED_PARENTS: T.List[T.Tuple[str, str]] = [
("Gtk", "Buildable"), ("Gtk", "Buildable"),

View file

@ -21,9 +21,9 @@ import typing as T
from blueprintcompiler.language.common import GirType from blueprintcompiler.language.common import GirType
from .gobject_object import Object, ObjectContent
from .common import *
from ..gir import TemplateType from ..gir import TemplateType
from .common import *
from .gobject_object import Object, ObjectContent
from .types import ClassName, TemplateClassName from .types import ClassName, TemplateClassName

View file

@ -18,8 +18,8 @@
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
from .common import *
from ..gir import Class, ExternType, Interface from ..gir import Class, ExternType, Interface
from .common import *
class TypeName(AstNode): class TypeName(AstNode):

View file

@ -20,12 +20,12 @@
from functools import cached_property from functools import cached_property
from .. import gir from .. import gir
from .imports import GtkDirective, Import
from .gtkbuilder_template import Template
from .gobject_object import Object
from .gtk_menu import menu, Menu
from .common import * from .common import *
from .contexts import ScopeCtx from .contexts import ScopeCtx
from .gobject_object import Object
from .gtk_menu import Menu, menu
from .gtkbuilder_template import Template
from .imports import GtkDirective, Import
class UI(AstNode): class UI(AstNode):

View file

@ -20,9 +20,9 @@
import typing as T import typing as T
from .common import * from .common import *
from .types import TypeName
from .gobject_object import Object
from .contexts import ScopeCtx, ValueTypeCtx from .contexts import ScopeCtx, ValueTypeCtx
from .gobject_object import Object
from .types import TypeName
class Translated(AstNode): class Translated(AstNode):

View file

@ -18,14 +18,16 @@
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
import json
import sys
import traceback
import typing as T import typing as T
import json, sys, traceback
from . import decompiler, parser, tokenizer, utils, xml_reader
from .completions import complete from .completions import complete
from .errors import PrintableError, CompileError, MultipleErrors from .errors import CompileError, MultipleErrors, PrintableError
from .lsp_utils import * from .lsp_utils import *
from .outputs.xml import XmlOutput from .outputs.xml import XmlOutput
from . import tokenizer, parser, utils, xml_reader, decompiler
def printerr(*args, **kwargs): def printerr(*args, **kwargs):

View file

@ -18,9 +18,9 @@
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
from dataclasses import dataclass
import enum import enum
import typing as T import typing as T
from dataclasses import dataclass
from .errors import * from .errors import *
from .utils import * from .utils import *

View file

@ -18,15 +18,18 @@
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
import argparse
import json
import os
import sys
import typing as T import typing as T
import argparse, json, os, sys
from .errors import PrintableError, report_bug, MultipleErrors, CompilerBugError from . import decompiler, interactive_port, parser, tokenizer
from .errors import CompilerBugError, MultipleErrors, PrintableError, report_bug
from .gir import add_typelib_search_path from .gir import add_typelib_search_path
from .lsp import LanguageServer from .lsp import LanguageServer
from . import parser, tokenizer, decompiler, interactive_port
from .utils import Colors
from .outputs import XmlOutput from .outputs import XmlOutput
from .utils import Colors
VERSION = "uninstalled" VERSION = "uninstalled"
LIBDIR = None LIBDIR = None

View file

@ -1,7 +1,7 @@
import typing as T import typing as T
from .. import OutputFormat
from ...language import * from ...language import *
from .. import OutputFormat
from .xml_emitter import XmlEmitter from .xml_emitter import XmlEmitter

View file

@ -18,7 +18,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
import typing as T import typing as T
from xml.sax import saxutils from xml.sax import saxutils
from blueprintcompiler.gir import GirType from blueprintcompiler.gir import GirType

View file

@ -20,21 +20,19 @@
""" Utilities for parsing an AST from a token stream. """ """ Utilities for parsing an AST from a token stream. """
import typing as T import typing as T
from collections import defaultdict from collections import defaultdict
from enum import Enum from enum import Enum
from .ast_utils import AstNode
from .ast_utils import AstNode
from .errors import ( from .errors import (
assert_true,
CompilerBugError,
CompileError, CompileError,
CompilerBugError,
CompileWarning, CompileWarning,
UnexpectedTokenError, UnexpectedTokenError,
assert_true,
) )
from .tokenizer import Token, TokenType from .tokenizer import Token, TokenType
SKIP_TOKENS = [TokenType.COMMENT, TokenType.WHITESPACE] SKIP_TOKENS = [TokenType.COMMENT, TokenType.WHITESPACE]

View file

@ -19,9 +19,9 @@
from .errors import MultipleErrors, PrintableError from .errors import MultipleErrors, PrintableError
from .language import OBJECT_CONTENT_HOOKS, UI, Template
from .parse_tree import * from .parse_tree import *
from .tokenizer import TokenType from .tokenizer import TokenType
from .language import OBJECT_CONTENT_HOOKS, Template, UI
def parse( def parse(

View file

@ -18,8 +18,8 @@
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
import typing as T
import re import re
import typing as T
from enum import Enum from enum import Enum
from .errors import CompileError, CompilerBugError from .errors import CompileError, CompilerBugError

View file

@ -17,15 +17,15 @@
# #
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
import math
import mmap
import os
import sys import sys
import typing as T import typing as T
import math
from ctypes import * from ctypes import *
import mmap, os
from .errors import CompilerBugError from .errors import CompilerBugError
BLOB_TYPE_STRUCT = 3 BLOB_TYPE_STRUCT = 3
BLOB_TYPE_BOXED = 4 BLOB_TYPE_BOXED = 4
BLOB_TYPE_ENUM = 5 BLOB_TYPE_ENUM = 5

View file

@ -18,12 +18,11 @@
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
import typing as T
from collections import defaultdict from collections import defaultdict
from functools import cached_property from functools import cached_property
import typing as T
from xml import sax from xml import sax
# To speed up parsing, we ignore all tags except these # To speed up parsing, we ignore all tags except these
PARSE_GIR = set( PARSE_GIR = set(
[ [

View file

@ -4,7 +4,7 @@ RUN dnf install -y meson gcc g++ python3-pip gobject-introspection-devel \
python3-devel python3-gobject git diffutils xorg-x11-server-Xvfb \ python3-devel python3-gobject git diffutils xorg-x11-server-Xvfb \
appstream-devel "dnf-command(builddep)" appstream-devel "dnf-command(builddep)"
RUN dnf build-dep -y gtk4 libadwaita RUN dnf build-dep -y gtk4 libadwaita
RUN pip3 install furo mypy sphinx coverage black RUN pip3 install furo mypy sphinx coverage black isort
COPY install_deps.sh . COPY install_deps.sh .
RUN ./install_deps.sh RUN ./install_deps.sh

View file

@ -1,20 +1,21 @@
import os, sys import os
import sys
from pythonfuzz.main import PythonFuzz from pythonfuzz.main import PythonFuzz
from blueprintcompiler.outputs.xml import XmlOutput from blueprintcompiler.outputs.xml import XmlOutput
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
from blueprintcompiler import tokenizer, parser, decompiler, gir from blueprintcompiler import decompiler, gir, parser, tokenizer, utils
from blueprintcompiler.completions import complete from blueprintcompiler.completions import complete
from blueprintcompiler.errors import ( from blueprintcompiler.errors import (
PrintableError,
MultipleErrors,
CompileError, CompileError,
CompilerBugError, CompilerBugError,
MultipleErrors,
PrintableError,
) )
from blueprintcompiler.tokenizer import Token, TokenType, tokenize from blueprintcompiler.tokenizer import Token, TokenType, tokenize
from blueprintcompiler import utils
@PythonFuzz @PythonFuzz

View file

@ -19,20 +19,19 @@
import difflib # I love Python import difflib # I love Python
from pathlib import Path
import unittest import unittest
from pathlib import Path
import gi import gi
gi.require_version("Gtk", "4.0") gi.require_version("Gtk", "4.0")
from gi.repository import Gtk from gi.repository import Gtk
from blueprintcompiler import tokenizer, parser, decompiler from blueprintcompiler import decompiler, parser, tokenizer, utils
from blueprintcompiler.completions import complete from blueprintcompiler.completions import complete
from blueprintcompiler.errors import PrintableError, MultipleErrors, CompileError from blueprintcompiler.errors import CompileError, MultipleErrors, PrintableError
from blueprintcompiler.tokenizer import Token, TokenType, tokenize
from blueprintcompiler import utils
from blueprintcompiler.outputs.xml import XmlOutput from blueprintcompiler.outputs.xml import XmlOutput
from blueprintcompiler.tokenizer import Token, TokenType, tokenize
class TestSamples(unittest.TestCase): class TestSamples(unittest.TestCase):