Commit fd3f539a authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[global] Imports cleanup

Using isort this makes all files coherent
parent 33ed0736
Pipeline #39595 passed with stage
in 15 minutes and 51 seconds
......@@ -24,15 +24,17 @@
###############################################################################
import importlib
from enum import Enum
from enum import unique
import simplejson as json
import beat.core
from enum import Enum, unique
from beat.backend.python import utils
from beat.core.schema import validate
from beat.cmdline import common
from beat.core.schema import validate
@unique
......
......@@ -25,15 +25,14 @@
import os
from PyQt5.QtCore import QStringListModel
from PyQt5.QtCore import pyqtProperty
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtCore import pyqtProperty
from PyQt5.QtCore import QStringListModel
from ..utils import dataformat_basetypes
from .asset import AssetType
from .asset import Asset
from .asset import AssetType
class AssetModel(QStringListModel):
......
......@@ -23,10 +23,9 @@
# #
###############################################################################
from PyQt5.QtCore import Qt
from PyQt5.QtCore import QEvent
from PyQt5.QtCore import QObject
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QAbstractSpinBox
from PyQt5.QtWidgets import QComboBox
......
......@@ -35,7 +35,6 @@ from .asset import Asset
from .asset import AssetType
from .assetmodel import AssetModel
PARAMETER_TYPE_KEY = "parameter_type"
DEFAULT_VALUE_KEY = "default_value"
EDITED_KEY = "edited"
......@@ -80,10 +79,13 @@ class ExperimentResources:
DATASET_TABLE = "CREATE TABLE datasets(name varchar, outputs integer)"
INSERT_DATASET = "INSERT INTO datasets(name, outputs) VALUES(?, ?)"
query = QSqlQuery()
for query_str in [ALGORITHM_TABLE_CLEANUP, QUEUE_TABLE_CLEANUP, DATASET_TABLE_CLEANUP]:
for query_str in [
ALGORITHM_TABLE_CLEANUP,
QUEUE_TABLE_CLEANUP,
DATASET_TABLE_CLEANUP,
]:
if not query.exec_(query_str):
raise RuntimeError(f"Failed to drop table: {query.lastError().text()}")
......
......@@ -35,27 +35,23 @@ import click
import pkg_resources
from click_plugins import with_plugins
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QCoreApplication
from PyQt5.QtWidgets import QApplication
from beat.cmdline import environments
from beat.cmdline.click_helper import AliasedGroup
from beat.cmdline.decorators import raise_on_error
from beat.cmdline.decorators import verbosity_option
from beat.cmdline import environments
from ..utils import setup_logger
from ..utils import check_prefix_folders
from ..utils import check_prefix_dataformats
from ..widgets.mainwindow import MainWindow
from ..widgets.assetwidget import AssetWidget
from ..backend.asset import AssetType
from .. import version
from ..backend.asset import Asset
from ..backend.asset import AssetType
from ..backend.eventfilters import MouseWheelFilter
from .. import version
from ..utils import check_prefix_dataformats
from ..utils import check_prefix_folders
from ..utils import setup_logger
from ..widgets.assetwidget import AssetWidget
from ..widgets.mainwindow import MainWindow
global logger
logger = None
......
......@@ -23,18 +23,19 @@
# #
###############################################################################
import importlib
import os
import shutil
import subprocess
import sys
import tempfile
import pytest
import pkg_resources
import simplejson as json
import subprocess
import shutil
import importlib
from collections import namedtuple
import pkg_resources
import pytest
import simplejson as json
from beat.cmdline.config import Configuration
from ..backend.asset import AssetType
......
......@@ -32,20 +32,19 @@ from beat.backend.python.algorithm import Algorithm
from ..backend.asset import Asset
from ..backend.asset import AssetType
from ..backend.assetmodel import AssetModel
from ..widgets.algorithmeditor import PropertyEditor
from ..widgets.algorithmeditor import ParameterEditor
from ..widgets.algorithmeditor import ResultEditor
from ..widgets.algorithmeditor import IOWidget
from ..widgets.algorithmeditor import GroupEditor
from ..widgets.algorithmeditor import AlgorithmEditor
from ..widgets.algorithmeditor import ALGORITHM_TYPE
from ..widgets.algorithmeditor import DEFAULT_SCHEMA_VERSION
from ..widgets.algorithmeditor import DEFAULT_API_VERSION
from ..widgets.algorithmeditor import DEFAULT_SCHEMA_VERSION
from ..widgets.algorithmeditor import AlgorithmEditor
from ..widgets.algorithmeditor import GroupEditor
from ..widgets.algorithmeditor import IOWidget
from ..widgets.algorithmeditor import ParameterEditor
from ..widgets.algorithmeditor import PropertyEditor
from ..widgets.algorithmeditor import ResultEditor
from ..widgets.algorithmeditor import migrate_to_api_v2
from ..widgets.algorithmeditor import update_code
from .conftest import sync_prefix
from .conftest import prefix
from .conftest import sync_prefix
def get_algorithm_declaration(prefix_path, algorithm_name):
......
......@@ -24,11 +24,12 @@
###############################################################################
import os
import pytest
import shutil
import simplejson as json
import tempfile
import pytest
import simplejson as json
from ..backend.asset import Asset
from ..backend.asset import AssetType
......
......@@ -25,8 +25,8 @@
from PyQt5.QtCore import Qt
from ..backend.asset import AssetType
from ..backend.asset import Asset
from ..backend.asset import AssetType
from ..widgets.assetbrowser import AssetBrowser
......
......@@ -24,10 +24,11 @@
###############################################################################
import os
import pytest
from ..backend.assetmodel import AssetModel
from ..backend.asset import AssetType
from ..backend.assetmodel import AssetModel
from ..utils import dataformat_basetypes
......
......@@ -24,32 +24,29 @@
###############################################################################
import os
import pytest
import random
from PyQt5 import QtCore
import pytest
from PyQt5 import QtCore
from PyQt5.QtWidgets import QMessageBox
from ..backend.asset import Asset
from ..backend.asset import AssetType
from ..backend.assetmodel import AssetModel
from ..widgets.algorithmeditor import AlgorithmEditor
from ..widgets.assetwidget import AssetWidget
from ..widgets.assetwidget import widget_for_asset_type
from ..widgets.dialogs import AssetCreationDialog
from ..widgets.editor import PlaceholderEditor
from ..widgets.algorithmeditor import AlgorithmEditor
from ..widgets.databaseeditor import DatabaseEditor
from ..widgets.dataformateditor import DataformatEditor
from ..widgets.dialogs import AssetCreationDialog
from ..widgets.editor import PlaceholderEditor
from ..widgets.experimenteditor import ExperimentEditor
from ..widgets.libraryeditor import LibraryEditor
from ..widgets.plottereditor import PlotterEditor
from ..widgets.plotterparameterseditor import PlotterParametersEditor
from ..widgets.protocoltemplateeditor import ProtocolTemplateEditor
from ..widgets.toolchaineditor import ToolchainEditor
from ..backend.asset import AssetType
from ..backend.asset import Asset
from ..backend.assetmodel import AssetModel
from .conftest import sync_prefix
......
......@@ -24,22 +24,22 @@
###############################################################################
import copy
import pytest
from PyQt5 import QtCore
from PyQt5.QtWidgets import QComboBox
from PyQt5.QtWidgets import QInputDialog
from ..backend.asset import AssetType
from ..backend.asset import Asset
from ..backend.asset import AssetType
from ..widgets.databaseeditor import DatabaseEditor
from ..widgets.databaseeditor import ViewEditor
from ..widgets.databaseeditor import ViewsEditor
from ..widgets.databaseeditor import ProtocolEditor
from ..widgets.databaseeditor import DatabaseWidget
from ..widgets.databaseeditor import ParameterTypeDelegate
from ..widgets.databaseeditor import ProtocolDialog
from ..widgets.databaseeditor import ProtocolEditor
from ..widgets.databaseeditor import ViewEditor
from ..widgets.databaseeditor import ViewsEditor
@pytest.yield_fixture(params=[i for i in range(1, 3)])
......
......@@ -23,20 +23,19 @@
# #
###############################################################################
import pytest
import random
from PyQt5 import QtCore
import pytest
from PyQt5 import QtCore
from PyQt5.QtWidgets import QInputDialog
from ..backend.assetmodel import AssetModel
from ..backend.asset import AssetType
from ..widgets.dataformateditor import DataformatWidget
from ..widgets.dataformateditor import DataformatObjectWidget
from ..backend.assetmodel import AssetModel
from ..widgets.dataformateditor import DataformatArrayWidget
from ..widgets.dataformateditor import DataformatEditor
from ..widgets.dataformateditor import DataformatObjectWidget
from ..widgets.dataformateditor import DataformatWidget
from ..widgets.dataformateditor import default_dataformat
from ..widgets.dataformateditor import default_object_dataformat
......
......@@ -26,15 +26,13 @@
import pytest
from PyQt5.QtCore import QStringListModel
from PyQt5.QtGui import QStandardItemModel
from PyQt5.QtGui import QStandardItem
from PyQt5.QtWidgets import QListView
from PyQt5.QtGui import QStandardItemModel
from PyQt5.QtWidgets import QComboBox
from PyQt5.QtWidgets import QListView
from ..backend.delegates import AssetItemDelegate
from ..backend.assetmodel import AssetModel
from ..backend.delegates import AssetItemDelegate
class TestAssetItemDelegate:
......
......@@ -26,14 +26,13 @@
import pytest
from PyQt5 import QtCore
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtCore import QStringListModel
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QPushButton
from ..backend.asset import AssetType
from ..widgets.editor import AbstractAssetEditor
from ..widgets.field import FieldWidget
from ..backend.asset import AssetType
class MockAssetEditor(AbstractAssetEditor):
......
......@@ -24,49 +24,42 @@
###############################################################################
import copy
import pytest
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QComboBox
from PyQt5.QtSql import QSqlQuery
from PyQt5.QtSql import QSqlTableModel
from PyQt5.QtWidgets import QCheckBox
from PyQt5.QtWidgets import QComboBox
from PyQt5.QtWidgets import QPushButton
from PyQt5.QtSql import QSqlTableModel
from PyQt5.QtSql import QSqlQuery
from beat.core.experiment import PROCESSOR_PREFIX
from beat.core.experiment import EVALUATOR_PREFIX
from beat.backend.python.algorithm import Algorithm
from beat.core.experiment import EVALUATOR_PREFIX
from beat.core.experiment import PROCESSOR_PREFIX
from ..backend.asset import Asset
from ..backend.asset import AssetType
from ..backend.assetmodel import AssetModel
from ..widgets.spinboxes import NumpySpinBox
from ..widgets.experimenteditor import IOMapperDialog
from ..widgets.experimenteditor import DatasetEditor
from ..widgets.experimenteditor import DatasetModel
from ..backend.resourcemodels import AlgorithmResourceModel
from ..backend.resourcemodels import ExperimentResources
from ..backend.resourcemodels import QueueResourceModel
from ..widgets.experimenteditor import AlgorithmParametersEditor
from ..widgets.experimenteditor import ExecutionPropertiesEditor
from ..widgets.experimenteditor import BlockEditor
from ..widgets.experimenteditor import AnalyzerBlockEditor
from ..widgets.experimenteditor import LoopBlockEditor
from ..widgets.experimenteditor import GlobalParametersEditor
from ..widgets.experimenteditor import BlockEditor
from ..widgets.experimenteditor import DatasetEditor
from ..widgets.experimenteditor import DatasetModel
from ..widgets.experimenteditor import EnvironmentModel
from ..widgets.experimenteditor import ExecutionPropertiesEditor
from ..widgets.experimenteditor import ExperimentEditor
from ..widgets.experimenteditor import GlobalParametersEditor
from ..widgets.experimenteditor import IOMapperDialog
from ..widgets.experimenteditor import LoopBlockEditor
from ..widgets.experimenteditor import typed_user_property
from ..backend.resourcemodels import ExperimentResources
from ..backend.resourcemodels import AlgorithmResourceModel
from ..backend.resourcemodels import QueueResourceModel
from ..widgets.spinboxes import NumpySpinBox
from .conftest import prefix
from .conftest import sync_prefix
# ------------------------------------------------------------------------------
# Constants
......
......@@ -28,11 +28,9 @@ import pytest
from ..backend.asset import Asset
from ..backend.asset import AssetType
from ..backend.assetmodel import AssetModel
from ..widgets.libraryeditor import LibraryEditor
from .conftest import sync_prefix
from .conftest import prefix
from .conftest import sync_prefix
def get_library_declaration(prefix_path, library_name):
......
......@@ -23,27 +23,24 @@
# #
###############################################################################
import pytest
import numpy as np
import pytest
from PyQt5 import QtCore
from PyQt5.QtWidgets import QDialogButtonBox
from PyQt5.QtWidgets import QInputDialog
from ..backend.asset import Asset
from ..backend.asset import AssetType
from ..widgets.parameterwidget import BoolSetupWidget
from ..widgets.parameterwidget import StringSetupWidget
from ..widgets.parameterwidget import NumericalSetupWidget
from ..widgets.parameterwidget import ParameterWidget
from ..widgets.parameterwidget import InputType
from ..widgets.parameterwidget import NumericalChoiceDialog
from ..widgets.parameterwidget import NumericalSetupWidget
from ..widgets.parameterwidget import ParameterWidget
from ..widgets.parameterwidget import StringSetupWidget
from .conftest import prefix
from .conftest import sync_prefix
# ------------------------------------------------------------------------------
# Constants
......
......@@ -24,12 +24,10 @@
###############################################################################
import pytest
import simplejson as json
from ..backend.asset import AssetType
from ..backend.asset import Asset
from ..backend.asset import AssetType
from ..backend.assetmodel import AssetModel
from ..widgets.plottereditor import ParameterViewer
from ..widgets.plottereditor import PlotterEditor
......@@ -91,7 +89,9 @@ class TestPlotterEditor:
assert editor.dump_json() == json_data
def test_change_dataformat(self, qtbot, dataformat_model, test_prefix, beat_context):
def test_change_dataformat(
self, qtbot, dataformat_model, test_prefix, beat_context
):
asset_name = "user/scatter/1"
asset = Asset(test_prefix, AssetType.PLOTTER, asset_name)
json_data = asset.declaration
......
......@@ -26,21 +26,18 @@
import pytest
from PyQt5 import QtCore
from PyQt5.QtWidgets import QDialogButtonBox
from PyQt5.QtWidgets import QMessageBox
from ..backend.asset import AssetType
from ..backend.asset import Asset
from ..backend.asset import AssetType
from ..backend.assetmodel import AssetModel
from ..widgets.plotterparameterseditor import ParameterChoiceDialog
from ..widgets.plotterparameterseditor import PlotterParametersEditor
from ..widgets.plotterparameterseditor import PlotterParameterViewer
from ..widgets.plotterparameterseditor import RestrictedParameterWidget
from ..widgets.plotterparameterseditor import ParameterChoiceDialog
from .conftest import sync_prefix
from .conftest import prefix
from .conftest import sync_prefix
@pytest.fixture()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment