Remove unused imports throughout the code base

Thanks to autoflake.
This commit is contained in:
Arjan Molenaar 2019-10-13 14:59:38 +02:00
parent c0b225e529
commit e54f1192ba
53 changed files with 29 additions and 74 deletions

View File

@ -14,8 +14,8 @@ from gaphor.UML.properties import umlproperty
from gaphor.UML.elementdispatcher import EventWatcher
if TYPE_CHECKING:
from gaphor.UML.elementfactory import ElementFactory
from gaphor.UML.presentation import Presentation
from gaphor.UML.elementfactory import ElementFactory # noqa
from gaphor.UML.presentation import Presentation # noqa
class UnlinkEvent:

View File

@ -12,7 +12,7 @@ from gaphor.UML.event import ElementCreated, ElementDeleted, ModelFlushed, Model
from gaphor.abc import Service
if TYPE_CHECKING:
from gaphor.services.eventmanager import EventManager
from gaphor.services.eventmanager import EventManager # noqa
T = TypeVar("T", bound=Element)

View File

@ -7,7 +7,7 @@ from gaphor.UML.properties import umlproperty, association
from gaphor.UML.element import Element
if TYPE_CHECKING:
from gaphas.canvas import Canvas
from gaphas.canvas import Canvas # noqa
S = TypeVar("S", bound=Element)

View File

@ -4,7 +4,6 @@ Formatting of UML model elements into text tests.
import pytest
from gaphor.application import Application
from gaphor.services.eventmanager import EventManager
from gaphor.UML.elementfactory import ElementFactory
from gaphor.UML.umlfmt import format

View File

@ -3,10 +3,8 @@ Parsing of UML model elements from string tests.
"""
import pytest
from gaphor.application import Application
from gaphor.services.eventmanager import EventManager
from gaphor.UML.elementfactory import ElementFactory
from gaphor.UML.umllex import parse
from gaphor.UML.umllex import attribute_pat, operation_pat, parameter_pat
from gaphor import UML

View File

@ -5,8 +5,6 @@
from typing import Optional, Sequence, get_type_hints
import platform
from gaphor.application import Application
_primary = "" if platform.system() == "Darwin" else "Ctrl"

View File

@ -15,7 +15,7 @@ from gaphor import UML
from gaphor.UML.modelfactory import stereotypes_str
from gaphor.diagram.presentation import ElementPresentation, Named
from gaphor.diagram.support import represents
from gaphor.diagram.shapes import Box, IconBox, EditableText, Text, draw_border
from gaphor.diagram.shapes import Box, EditableText, IconBox, Text
DEFAULT_JOIN_SPEC = "and"

View File

@ -8,7 +8,6 @@ Contains also implementation to split flows using activity edge connectors.
from gaphor import UML
from gaphor.UML.modelfactory import stereotypes_str
from gaphor.diagram.presentation import LinePresentation
from gaphor.diagram.text import TextAlign, VerticalAlign
from gaphor.diagram.support import represents
from gaphor.diagram.shapes import Box, Text, EditableText, draw_arrow_tail

View File

@ -2,7 +2,6 @@
Object node item.
"""
import itertools
import ast
from gaphas.state import observed, reversible_property

View File

@ -14,7 +14,7 @@ from gaphor.UML.modelfactory import stereotypes_str
from gaphor.diagram.presentation import ElementPresentation, Named
from gaphor.diagram.support import represents
from gaphor.diagram.text import VerticalAlign
from gaphor.diagram.shapes import Box, EditableText, Text, draw_highlight
from gaphor.diagram.shapes import Box, Text, draw_highlight
@represents(UML.ActivityPartition)

View File

@ -2,7 +2,6 @@
from gi.repository import Gtk
from gaphor import UML
from gaphor.core import _, transactional
from gaphor.diagram.propertypages import PropertyPages, NamedItemPropertyPage

View File

@ -10,7 +10,6 @@ from gaphor.diagram.presentation import Named, Classified
from gaphor.diagram.classes.dependency import DependencyItem
from gaphor.diagram.classes.implementation import ImplementationItem
from gaphor.diagram.classes.generalization import GeneralizationItem
from gaphor.diagram.classes.interface import InterfaceItem
from gaphor.diagram.classes.association import AssociationItem

View File

@ -20,7 +20,7 @@ import ast
from gaphor import UML
from gaphor.UML.modelfactory import stereotypes_str
from gaphor.diagram.presentation import LinePresentation
from gaphor.diagram.shapes import Box, Text
from gaphor.diagram.shapes import Text
from gaphor.diagram.support import represents
from gaphor.diagram.classes.interface import InterfacePort

View File

@ -2,7 +2,6 @@
Generalization --
"""
from gi.repository import GObject
from gaphor import UML
from gaphor.UML.modelfactory import stereotypes_str

View File

@ -5,7 +5,7 @@ Implementation of interface.
from gaphor import UML
from gaphor.UML.modelfactory import stereotypes_str
from gaphor.diagram.presentation import LinePresentation
from gaphor.diagram.shapes import Box, Text
from gaphor.diagram.shapes import Text
from gaphor.diagram.support import represents
from gaphor.diagram.classes.interface import InterfacePort

View File

@ -6,7 +6,6 @@ to folded interface, see `gaphor.diagram.classes.interface` documentation
for details.
"""
from gaphor import UML
from gaphor.diagram.connectors import IConnect
from gaphor.diagram.classes.classconnect import DependencyConnect, ImplementationConnect

View File

@ -4,10 +4,7 @@ Unnit tests for AssociationItem.
from gaphor.tests import TestCase
from gaphor import UML
from gaphor.diagram.usecases.usecase import UseCaseItem
from gaphor.diagram.usecases.actor import ActorItem
from gaphor.diagram.classes.klass import ClassItem
from gaphor.diagram.classes.interface import InterfaceItem
from gaphor.diagram.classes.association import AssociationItem

View File

@ -2,7 +2,7 @@ from gi.repository import Gtk
from gaphor.tests import TestCase
from gaphor import UML
from gaphor.diagram.classes import ClassItem, AssociationItem
from gaphor.diagram.classes import ClassItem
from gaphor.diagram.classes.classespropertypages import ClassAttributes

View File

@ -1,6 +1,5 @@
from gi.repository import Gtk
from gaphor import UML
from gaphor.core import _, transactional
from gaphor.diagram.propertypages import PropertyPages, NamedItemPropertyPage
from gaphor.diagram.components import ComponentItem

View File

@ -6,7 +6,6 @@ from functools import singledispatch
from gaphor import UML
from gaphor.diagram.presentation import Named, Classified
from gaphor.misc.rattr import rgetattr, rsetattr
@singledispatch

View File

@ -2,13 +2,12 @@
CommentItem diagram item
"""
from gaphas.item import NW
from gaphor import UML
from gaphor.diagram.presentation import ElementPresentation
from gaphor.diagram.shapes import Box, Text
from gaphor.diagram.text import TextAlign, VerticalAlign, text_size
from gaphor.diagram.text import TextAlign, VerticalAlign
from gaphor.diagram.support import represents

View File

@ -1,8 +1,7 @@
"""Unit tests for simple items."""
from gaphor.tests import TestCase
from gaphor import UML
from gaphor.diagram.general.simpleitem import Line, Box, Ellipse
from gaphor.diagram.general.simpleitem import Ellipse, Line
from gaphas import View

View File

@ -20,7 +20,6 @@ from __future__ import annotations
from typing import Type
import abc
from gaphor import UML
from gaphor.misc.generic.multidispatch import multidispatch, FunctionDispatcher

View File

@ -23,7 +23,7 @@ lifeline.
from gaphas.item import SW, SE
from gaphas.connector import Handle, LinePort
from gaphas.solver import STRONG
from gaphas.geometry import distance_line_point, Rectangle
from gaphas.geometry import distance_line_point
from gaphas.constraint import (
LessThanConstraint,
EqualsConstraint,

View File

@ -48,7 +48,6 @@ See also ``lifeline`` module documentation.
from typing import List
from math import pi, atan2
from gaphas.util import path_ellipse
from gaphor import UML
from gaphor.UML.modelfactory import stereotypes_str

View File

@ -2,7 +2,7 @@
Stereotype property page.
"""
from gi.repository import GObject, Gtk
from gi.repository import Gtk
from gaphor import UML
from gaphor.core import _, transactional

View File

@ -1,6 +1,5 @@
from gaphor.tests import TestCase
from gaphor.diagram.profiles.metaclasspropertypage import MetaclassNamePropertyPage
from gaphor.diagram.classes import ClassItem
from gaphor import UML
from gi.repository import Gtk

View File

@ -8,7 +8,6 @@ from gaphas.util import path_ellipse
from gaphor.diagram.states.state import VertexItem
from gaphor.diagram.presentation import ElementPresentation
from gaphor.diagram.shapes import Box, IconBox, EditableText, Text
from gaphor.diagram.text import TextAlign, VerticalAlign
from gaphor.diagram.support import represents

View File

@ -10,7 +10,6 @@ from gaphas.util import path_ellipse
from gaphor.diagram.states.state import VertexItem
from gaphor.diagram.presentation import ElementPresentation
from gaphor.diagram.shapes import Box, IconBox, EditableText, Text
from gaphor.diagram.text import TextAlign, VerticalAlign
from gaphor.diagram.support import represents

View File

@ -3,7 +3,6 @@ import pytest
import cairo
from gaphor.diagram.shapes import Box, IconBox, Text
from gaphas.canvas import Context
from gaphas.geometry import Rectangle

View File

@ -1,8 +1,6 @@
import pytest
import cairo
from gaphas.canvas import instant_cairo_context
import gaphor.diagram.text
from gaphor.diagram.text import (
text_size,
text_point_at_line,

View File

@ -8,7 +8,6 @@ from enum import Enum
import cairo
from gi.repository import GLib, Pango, PangoCairo
from gaphas.geometry import Rectangle
from gaphas.freehand import FreeHandCairoContext
from gaphas.painter import CairoBoundingBoxContext

View File

@ -5,7 +5,7 @@ Gaphor is using color values from 0 to 1 (cairo standard), so that required some
on the color widget. The standard format is `(red, green, blue, alpha)`.
"""
from gi.repository import GObject, Gdk, Gtk
from gi.repository import Gdk, Gtk
class ColorButton(Gtk.ColorButton):

View File

@ -10,7 +10,6 @@ from gaphas.view import Context, View
from gaphor.core import _, action
from gaphor.abc import Service, ActionProvider
from gaphor.ui.abc import UIComponent
from gaphor.ui.filedialog import FileDialog
from gaphor.ui.questiondialog import QuestionDialog

View File

@ -7,7 +7,7 @@ from gi.repository import Gtk
from gaphor import __version__
from gaphor.core import _, action
from gaphor.core import action
from gaphor.abc import Service, ActionProvider

View File

@ -2,7 +2,6 @@ from gaphor import UML
from gaphor.diagram.general import CommentItem
from gaphor.diagram.classes import AssociationItem, ClassItem
from gaphor.services.copyservice import CopyService
from gaphor.application import Application
from gaphor.tests.testcase import TestCase
from gaphor.storage.verify import orphan_references

View File

@ -18,9 +18,8 @@ import io
import gaphas
from gaphor import UML
from gaphor import diagram
from gaphor.UML.collection import collection
from gaphor.application import Application, NotInitializedError
from gaphor.application import Application
from gaphor.i18n import _
from gaphor.storage import parser, diagramitems

View File

@ -1,5 +1,3 @@
import pytest
from gaphor.action import action

View File

@ -2,8 +2,8 @@
from unittest import TestCase
from gaphor.core import Application, event_handler
from gaphor.transaction import Transaction, transactional, TransactionError
from gaphor.core import event_handler
from gaphor.transaction import Transaction, TransactionError
from gaphor.event import TransactionBegin, TransactionCommit, TransactionRollback
from gaphor.services.eventmanager import EventManager

View File

@ -18,7 +18,7 @@ from gaphor.diagram.connectors import IConnect
from gaphor.diagram.grouping import Group
# For DiagramItemConnector aspect:
import gaphor.ui.diagramtools
import gaphor.ui.diagramtools # noqa
T = TypeVar("T")

View File

@ -1,9 +1,7 @@
#!/usr/bin/python
import gaphor
from gaphor.storage import storage
import gaphor.UML as UML
from gaphor.services.eventmanager import EventManager
from gaphor.application import Application
from gaphas.painter import Context, ItemPainter

View File

@ -2,7 +2,6 @@ from typing import NamedTuple
from gi.repository import GLib, Gio, Gtk
from gaphor.abc import ActionProvider
from gaphor.action import action
class ActionGroup(NamedTuple):

View File

@ -7,8 +7,6 @@ from xml.etree.ElementTree import fromstring
from gi.repository import Gtk
from gaphor.core import _
widget_factory: Dict[str, Callable] = {}

View File

@ -10,9 +10,9 @@ from pathlib import Path
import importlib.resources
from gi.repository import Gio, Gdk, Gtk, GLib
from gaphor import UML, Application
from gaphor import UML
from gaphor.UML.event import ModelReady
from gaphor.core import _, event_handler, action, transactional
from gaphor.core import _, event_handler
from gaphor.abc import Service, ActionProvider
from gaphor.event import ActionEnabled
from gaphor.UML.event import AttributeUpdated, ModelFlushed
@ -29,8 +29,6 @@ from gaphor.ui.event import (
WindowClosed,
)
from gaphor.ui.layout import deserialize
from gaphor.ui.namespace import Namespace
from gaphor.ui.toolbox import Toolbox
log = logging.getLogger(__name__)

View File

@ -1,5 +1,5 @@
import importlib
from gi.repository import GLib, Gio, Gtk
from gi.repository import Gtk
from gaphor.abc import Service, ActionProvider
from gaphor.core import action

View File

@ -2,7 +2,7 @@ import pytest
from gaphor.services.eventmanager import EventManager
from gaphor.UML.elementfactory import ElementFactory
from gaphor.ui.mainwindow import MainWindow, Diagrams
from gaphor.ui.mainwindow import Diagrams
from gaphor.ui.elementeditor import ElementEditor

View File

@ -1,5 +1,3 @@
import pytest
from gaphor.core import action
from gaphor.ui.menufragment import MenuFragment

View File

@ -1,5 +1,3 @@
import pytest
from gi.repository import Gtk
from gaphor.ui.preferences import Preferences

View File

@ -5,9 +5,9 @@ Toolbox.
import logging
from gi.repository import GLib, GObject, Gdk, Gtk
from gi.repository import GLib, Gdk, Gtk
from gaphor.core import _, event_handler
from gaphor.core import _
from gaphor.abc import ActionProvider
from gaphor.ui.abc import UIComponent
from gaphor.ui.diagramtoolbox import TOOLBOX_ACTIONS

View File

@ -68,8 +68,8 @@ gaphorconvert = 'gaphor.tools.gaphorconvert:main'
"copy" = "gaphor.services.copyservice:CopyService"
"sanitizer" = "gaphor.services.sanitizerservice:SanitizerService"
"help" = "gaphor.services.helpservice:HelpService"
"namespace" = "gaphor.ui.mainwindow:Namespace"
"toolbox" = "gaphor.ui.mainwindow:Toolbox"
"namespace" = "gaphor.ui.namespace:Namespace"
"toolbox" = "gaphor.ui.toolbox:Toolbox"
"diagrams" = "gaphor.ui.mainwindow:Diagrams"
"consolewindow" = "gaphor.ui.consolewindow:ConsoleWindow"
"elementeditor" = "gaphor.ui.elementeditor:ElementEditor"

View File

@ -117,8 +117,8 @@ setup(
"copy = gaphor.services.copyservice:CopyService",
"sanitizer = gaphor.services.sanitizerservice:SanitizerService",
"help = gaphor.services.helpservice:HelpService",
"namespace = gaphor.ui.mainwindow:Namespace",
"toolbox = gaphor.ui.mainwindow:Toolbox",
"namespace = gaphor.ui.namespace:Namespace",
"toolbox = gaphor.ui.toolbox:Toolbox",
"diagrams = gaphor.ui.mainwindow:Diagrams",
"consolewindow = gaphor.ui.consolewindow:ConsoleWindow",
"elementeditor = gaphor.ui.elementeditor:ElementEditor",

View File

@ -1,7 +1,6 @@
from gaphor.tests import TestCase
from gaphor import UML
from gaphor.diagram.classes import AssociationItem, ClassItem
from gaphas.aspect import ConnectionSink
class GaphasTest(TestCase):

View File

@ -337,7 +337,6 @@ def getFilesForName(name):
""" Get a list of module files for a filename, a module or package name,
or a directory.
"""
import imp
if not os.path.exists(name):
# check for glob chars