From f462b74cfbd128ac6a37015d0047d73f4f0db4c1 Mon Sep 17 00:00:00 2001 From: Sigurd Borge Date: Tue, 24 Sep 2024 15:05:35 +0200 Subject: [PATCH] Cleaned up imports to match the new linting rule --- src/antares/model/area.py | 6 ++-- src/antares/model/binding_constraint.py | 4 +-- src/antares/model/hydro.py | 2 +- src/antares/model/link.py | 2 +- src/antares/model/study.py | 4 +-- src/antares/service/api_services/area_api.py | 28 +++++++++---------- .../api_services/binding_constraint_api.py | 8 +++--- src/antares/service/api_services/link_api.py | 2 +- .../service/api_services/renewable_api.py | 2 +- .../service/api_services/st_storage_api.py | 6 ++-- src/antares/service/api_services/study_api.py | 10 +++---- .../service/api_services/thermal_api.py | 4 +-- src/antares/service/base_services.py | 18 ++++++------ .../service/local_services/area_local.py | 16 +++++------ .../binding_constraint_local.py | 6 ++-- .../service/local_services/link_local.py | 6 ++-- .../service/local_services/study_local.py | 2 +- src/antares/service/service_factory.py | 6 ++-- src/antares/tools/all_optional_meta.py | 1 + src/antares/tools/ini_tool.py | 2 +- src/antares/tools/prepro_folder.py | 4 +-- tests/antares/delete/test_delete_api.py | 7 ++--- .../services/api_services/test_area_api.py | 25 ++++++++--------- .../test_binding_constraint_api.py | 10 +++---- .../services/api_services/test_link_api.py | 5 ++-- .../api_services/test_renewable_api.py | 10 +++---- .../api_services/test_st_storage_api.py | 8 ++---- .../services/api_services/test_study_api.py | 19 ++++++------- .../services/api_services/test_thermal_api.py | 10 +++---- .../services/local_services/conftest.py | 11 ++++---- .../services/local_services/test_area.py | 17 ++++++----- .../services/local_services/test_study.py | 11 ++++---- tests/integration/test_web_client.py | 27 +++++++++--------- 33 files changed, 142 insertions(+), 157 deletions(-) diff --git a/src/antares/model/area.py b/src/antares/model/area.py index 047ff1e2..9037e83c 100644 --- a/src/antares/model/area.py +++ b/src/antares/model/area.py @@ -17,14 +17,14 @@ """ from types import MappingProxyType -from typing import Optional, Dict, List, Any, Mapping, Set +from typing import Any, Dict, List, Mapping, Optional, Set import pandas as pd from pydantic import BaseModel, computed_field from pydantic.alias_generators import to_camel from antares.model.commons import FilterOption, sort_filter_values -from antares.model.hydro import HydroProperties, HydroMatrixName, Hydro +from antares.model.hydro import Hydro, HydroMatrixName, HydroProperties from antares.model.load import Load from antares.model.misc_gen import MiscGen from antares.model.renewable import RenewableCluster, RenewableClusterProperties @@ -34,7 +34,7 @@ from antares.model.thermal import ThermalCluster, ThermalClusterProperties from antares.model.wind import Wind from antares.tools.all_optional_meta import all_optional_model -from antares.tools.contents_tool import transform_name_to_id, EnumIgnoreCase +from antares.tools.contents_tool import EnumIgnoreCase, transform_name_to_id class AdequacyPatchMode(EnumIgnoreCase): diff --git a/src/antares/model/binding_constraint.py b/src/antares/model/binding_constraint.py index ea1aa852..dbcd724c 100644 --- a/src/antares/model/binding_constraint.py +++ b/src/antares/model/binding_constraint.py @@ -11,10 +11,10 @@ # This file is part of the Antares project. from enum import Enum -from typing import Optional, Union, List, Any, Dict +from typing import Any, Dict, List, Optional, Union import pandas as pd -from pydantic import BaseModel, Field, model_validator, computed_field +from pydantic import BaseModel, Field, computed_field, model_validator from pydantic.alias_generators import to_camel from antares.tools.all_optional_meta import all_optional_model diff --git a/src/antares/model/hydro.py b/src/antares/model/hydro.py index 2a98add8..8f2daf2d 100644 --- a/src/antares/model/hydro.py +++ b/src/antares/model/hydro.py @@ -11,7 +11,7 @@ # This file is part of the Antares project. from enum import Enum -from typing import Optional, Dict +from typing import Dict, Optional import pandas as pd from pydantic import BaseModel, computed_field diff --git a/src/antares/model/link.py b/src/antares/model/link.py index 43ad2938..abecb88d 100644 --- a/src/antares/model/link.py +++ b/src/antares/model/link.py @@ -11,7 +11,7 @@ # This file is part of the Antares project. from enum import Enum -from typing import Optional, Set, Mapping +from typing import Mapping, Optional, Set from pydantic import BaseModel, computed_field diff --git a/src/antares/model/study.py b/src/antares/model/study.py index 6604031f..2c4b1bd0 100644 --- a/src/antares/model/study.py +++ b/src/antares/model/study.py @@ -15,7 +15,7 @@ import time from pathlib import Path from types import MappingProxyType -from typing import Optional, Dict, List, Any +from typing import Any, Dict, List, Optional import pandas as pd @@ -25,7 +25,7 @@ from antares.exceptions.exceptions import APIError, StudyCreationError from antares.model.area import Area, AreaProperties, AreaUi from antares.model.binding_constraint import BindingConstraint, BindingConstraintProperties, ConstraintTerm -from antares.model.link import Link, LinkUi, LinkProperties +from antares.model.link import Link, LinkProperties, LinkUi from antares.model.settings import StudySettings from antares.service.api_services.study_api import _returns_study_settings from antares.service.base_services import BaseStudyService diff --git a/src/antares/service/api_services/area_api.py b/src/antares/service/api_services/area_api.py index 19debb12..6d0fb382 100644 --- a/src/antares/service/api_services/area_api.py +++ b/src/antares/service/api_services/area_api.py @@ -11,7 +11,7 @@ # This file is part of the Antares project. from pathlib import PurePosixPath -from typing import Optional, Dict, Union, List +from typing import Dict, List, Optional, Union import pandas as pd @@ -20,35 +20,35 @@ from antares.exceptions.exceptions import ( APIError, AreaCreationError, - AreaPropertiesUpdateError, AreaDeletionError, + AreaPropertiesUpdateError, AreaUiUpdateError, - MatrixUploadError, HydroCreationError, - ThermalCreationError, + LoadMatrixDownloadError, + LoadMatrixUploadError, + MatrixUploadError, RenewableCreationError, - STStorageCreationError, - ThermalDeletionError, RenewableDeletionError, + STStorageCreationError, STStorageDeletionError, - LoadMatrixUploadError, - LoadMatrixDownloadError, + ThermalCreationError, + ThermalDeletionError, ) -from antares.model.area import AreaProperties, AreaUi, Area -from antares.model.hydro import HydroProperties, HydroMatrixName, Hydro +from antares.model.area import Area, AreaProperties, AreaUi +from antares.model.hydro import Hydro, HydroMatrixName, HydroProperties from antares.model.load import Load from antares.model.misc_gen import MiscGen -from antares.model.renewable import RenewableClusterProperties, RenewableCluster +from antares.model.renewable import RenewableCluster, RenewableClusterProperties from antares.model.reserves import Reserves from antares.model.solar import Solar -from antares.model.st_storage import STStorageProperties, STStorage -from antares.model.thermal import ThermalClusterProperties, ThermalCluster +from antares.model.st_storage import STStorage, STStorageProperties +from antares.model.thermal import ThermalCluster, ThermalClusterProperties from antares.model.wind import Wind from antares.service.base_services import ( BaseAreaService, + BaseRenewableService, BaseShortTermStorageService, BaseThermalService, - BaseRenewableService, ) from antares.tools.contents_tool import AreaUiResponse from antares.tools.matrix_tool import prepare_args_replace_matrix diff --git a/src/antares/service/api_services/binding_constraint_api.py b/src/antares/service/api_services/binding_constraint_api.py index 6d1c4243..0d79e9d8 100644 --- a/src/antares/service/api_services/binding_constraint_api.py +++ b/src/antares/service/api_services/binding_constraint_api.py @@ -11,7 +11,7 @@ # This file is part of the Antares project. from pathlib import PurePosixPath -from typing import Optional, List +from typing import List, Optional import pandas as pd @@ -20,17 +20,17 @@ from antares.exceptions.exceptions import ( APIError, BindingConstraintCreationError, - ConstraintTermDeletionError, - ConstraintPropertiesUpdateError, ConstraintMatrixDownloadError, ConstraintMatrixUpdateError, + ConstraintPropertiesUpdateError, ConstraintTermAdditionError, + ConstraintTermDeletionError, ) from antares.model.binding_constraint import ( BindingConstraint, BindingConstraintProperties, - ConstraintTerm, ConstraintMatrixName, + ConstraintTerm, ) from antares.service.api_services.utils import get_matrix from antares.service.base_services import BaseBindingConstraintService diff --git a/src/antares/service/api_services/link_api.py b/src/antares/service/api_services/link_api.py index 5f28787f..2e5346ff 100644 --- a/src/antares/service/api_services/link_api.py +++ b/src/antares/service/api_services/link_api.py @@ -23,7 +23,7 @@ LinkUiUpdateError, ) from antares.model.area import Area -from antares.model.link import LinkProperties, LinkUi, Link +from antares.model.link import Link, LinkProperties, LinkUi from antares.service.base_services import BaseLinkService diff --git a/src/antares/service/api_services/renewable_api.py b/src/antares/service/api_services/renewable_api.py index 03875c2e..199aba5c 100644 --- a/src/antares/service/api_services/renewable_api.py +++ b/src/antares/service/api_services/renewable_api.py @@ -16,7 +16,7 @@ from antares.api_conf.api_conf import APIconf from antares.api_conf.request_wrapper import RequestWrapper -from antares.exceptions.exceptions import APIError, RenewablePropertiesUpdateError, RenewableMatrixDownloadError +from antares.exceptions.exceptions import APIError, RenewableMatrixDownloadError, RenewablePropertiesUpdateError from antares.model.renewable import RenewableCluster, RenewableClusterProperties from antares.service.api_services.utils import get_matrix from antares.service.base_services import BaseRenewableService diff --git a/src/antares/service/api_services/st_storage_api.py b/src/antares/service/api_services/st_storage_api.py index 3860c531..0879daf6 100644 --- a/src/antares/service/api_services/st_storage_api.py +++ b/src/antares/service/api_services/st_storage_api.py @@ -16,11 +16,11 @@ from antares.api_conf.request_wrapper import RequestWrapper from antares.exceptions.exceptions import ( APIError, - STStoragePropertiesUpdateError, - STStorageMatrixUploadError, STStorageMatrixDownloadError, + STStorageMatrixUploadError, + STStoragePropertiesUpdateError, ) -from antares.model.st_storage import STStorage, STStorageProperties, STStorageMatrixName +from antares.model.st_storage import STStorage, STStorageMatrixName, STStorageProperties from antares.service.base_services import BaseShortTermStorageService diff --git a/src/antares/service/api_services/study_api.py b/src/antares/service/api_services/study_api.py index 027e92c8..8f3ec019 100644 --- a/src/antares/service/api_services/study_api.py +++ b/src/antares/service/api_services/study_api.py @@ -16,19 +16,19 @@ from antares.api_conf.request_wrapper import RequestWrapper from antares.exceptions.exceptions import ( APIError, - StudySettingsUpdateError, BindingConstraintDeletionError, StudyDeletionError, + StudySettingsUpdateError, ) from antares.model.binding_constraint import BindingConstraint from antares.model.settings import ( - StudySettings, - GeneralProperties, - ThematicTrimming, - TimeSeriesProperties, AdequacyPatchProperties, AdvancedProperties, + GeneralProperties, OptimizationProperties, + StudySettings, + ThematicTrimming, + TimeSeriesProperties, ) from antares.service.base_services import BaseStudyService diff --git a/src/antares/service/api_services/thermal_api.py b/src/antares/service/api_services/thermal_api.py index 013e86e6..674e791a 100644 --- a/src/antares/service/api_services/thermal_api.py +++ b/src/antares/service/api_services/thermal_api.py @@ -16,8 +16,8 @@ from antares.api_conf.api_conf import APIconf from antares.api_conf.request_wrapper import RequestWrapper -from antares.exceptions.exceptions import APIError, ThermalPropertiesUpdateError, ThermalMatrixDownloadError -from antares.model.thermal import ThermalCluster, ThermalClusterProperties, ThermalClusterMatrixName +from antares.exceptions.exceptions import APIError, ThermalMatrixDownloadError, ThermalPropertiesUpdateError +from antares.model.thermal import ThermalCluster, ThermalClusterMatrixName, ThermalClusterProperties from antares.service.api_services.utils import get_matrix from antares.service.base_services import BaseThermalService diff --git a/src/antares/service/base_services.py b/src/antares/service/base_services.py index 291908de..8c056f19 100644 --- a/src/antares/service/base_services.py +++ b/src/antares/service/base_services.py @@ -12,28 +12,28 @@ from abc import ABC, abstractmethod from types import MappingProxyType -from typing import Optional, Dict, List +from typing import Dict, List, Optional import pandas as pd from antares.config.base_configuration import BaseConfiguration -from antares.model.area import AreaProperties, Area, AreaUi +from antares.model.area import Area, AreaProperties, AreaUi from antares.model.binding_constraint import ( - BindingConstraintProperties, - ConstraintTerm, BindingConstraint, + BindingConstraintProperties, ConstraintMatrixName, + ConstraintTerm, ) -from antares.model.hydro import HydroProperties, HydroMatrixName, Hydro -from antares.model.link import LinkProperties, LinkUi, Link +from antares.model.hydro import Hydro, HydroMatrixName, HydroProperties +from antares.model.link import Link, LinkProperties, LinkUi from antares.model.load import Load from antares.model.misc_gen import MiscGen -from antares.model.renewable import RenewableClusterProperties, RenewableCluster +from antares.model.renewable import RenewableCluster, RenewableClusterProperties from antares.model.reserves import Reserves from antares.model.settings import StudySettings from antares.model.solar import Solar -from antares.model.st_storage import STStorageProperties, STStorage -from antares.model.thermal import ThermalClusterProperties, ThermalCluster, ThermalClusterMatrixName +from antares.model.st_storage import STStorage, STStorageProperties +from antares.model.thermal import ThermalCluster, ThermalClusterMatrixName, ThermalClusterProperties from antares.model.wind import Wind diff --git a/src/antares/service/local_services/area_local.py b/src/antares/service/local_services/area_local.py index f711a757..71ececb2 100644 --- a/src/antares/service/local_services/area_local.py +++ b/src/antares/service/local_services/area_local.py @@ -13,29 +13,29 @@ import logging import os from configparser import ConfigParser -from typing import Optional, Dict, List, Any +from typing import Any, Dict, List, Optional import pandas as pd from antares.config.local_configuration import LocalConfiguration from antares.exceptions.exceptions import CustomError -from antares.model.area import AreaProperties, AreaUi, Area, AreaPropertiesLocal, AreaUiLocal -from antares.model.hydro import HydroProperties, HydroMatrixName, Hydro, HydroPropertiesLocal +from antares.model.area import Area, AreaProperties, AreaPropertiesLocal, AreaUi, AreaUiLocal +from antares.model.hydro import Hydro, HydroMatrixName, HydroProperties, HydroPropertiesLocal from antares.model.load import Load from antares.model.misc_gen import MiscGen -from antares.model.renewable import RenewableClusterProperties, RenewableCluster, RenewableClusterPropertiesLocal +from antares.model.renewable import RenewableCluster, RenewableClusterProperties, RenewableClusterPropertiesLocal from antares.model.reserves import Reserves from antares.model.solar import Solar -from antares.model.st_storage import STStorageProperties, STStorage, STStoragePropertiesLocal -from antares.model.thermal import ThermalClusterProperties, ThermalCluster, ThermalClusterPropertiesLocal +from antares.model.st_storage import STStorage, STStorageProperties, STStoragePropertiesLocal +from antares.model.thermal import ThermalCluster, ThermalClusterProperties, ThermalClusterPropertiesLocal from antares.model.wind import Wind from antares.service.base_services import ( BaseAreaService, + BaseRenewableService, BaseShortTermStorageService, BaseThermalService, - BaseRenewableService, ) -from antares.tools.ini_tool import IniFileTypes, IniFile +from antares.tools.ini_tool import IniFile, IniFileTypes from antares.tools.time_series_tool import TimeSeriesFile, TimeSeriesFileType diff --git a/src/antares/service/local_services/binding_constraint_local.py b/src/antares/service/local_services/binding_constraint_local.py index c5e1ad5b..b6f521ad 100644 --- a/src/antares/service/local_services/binding_constraint_local.py +++ b/src/antares/service/local_services/binding_constraint_local.py @@ -10,16 +10,16 @@ # # This file is part of the Antares project. -from typing import Optional, Any +from typing import Any, Optional import pandas as pd from antares.config.local_configuration import LocalConfiguration from antares.model.binding_constraint import ( - BindingConstraintProperties, - ConstraintTerm, BindingConstraint, + BindingConstraintProperties, ConstraintMatrixName, + ConstraintTerm, ) from antares.service.base_services import BaseBindingConstraintService from antares.tools.ini_tool import IniFile, IniFileTypes diff --git a/src/antares/service/local_services/link_local.py b/src/antares/service/local_services/link_local.py index b0f03601..c3d70ee9 100644 --- a/src/antares/service/local_services/link_local.py +++ b/src/antares/service/local_services/link_local.py @@ -13,12 +13,12 @@ import configparser import os from types import MappingProxyType -from typing import Optional, Any, Dict +from typing import Any, Dict, Optional from antares.config.local_configuration import LocalConfiguration -from antares.exceptions.exceptions import LinkCreationError, CustomError +from antares.exceptions.exceptions import CustomError, LinkCreationError from antares.model.area import Area -from antares.model.link import LinkProperties, LinkUi, Link, LinkPropertiesLocal, LinkUiLocal +from antares.model.link import Link, LinkProperties, LinkPropertiesLocal, LinkUi, LinkUiLocal from antares.service.base_services import BaseLinkService from antares.tools.contents_tool import sort_ini_sections diff --git a/src/antares/service/local_services/study_local.py b/src/antares/service/local_services/study_local.py index faa338d1..244aa9cc 100644 --- a/src/antares/service/local_services/study_local.py +++ b/src/antares/service/local_services/study_local.py @@ -10,7 +10,7 @@ # # This file is part of the Antares project. -from typing import Optional, Any +from typing import Any, Optional from antares.config.local_configuration import LocalConfiguration from antares.model.binding_constraint import BindingConstraint diff --git a/src/antares/service/service_factory.py b/src/antares/service/service_factory.py index a5416b86..e8de5b3b 100644 --- a/src/antares/service/service_factory.py +++ b/src/antares/service/service_factory.py @@ -22,12 +22,12 @@ from antares.service.api_services.thermal_api import ThermalApiService from antares.service.base_services import ( BaseAreaService, - BaseLinkService, - BaseThermalService, BaseBindingConstraintService, - BaseStudyService, + BaseLinkService, BaseRenewableService, BaseShortTermStorageService, + BaseStudyService, + BaseThermalService, ) from antares.service.local_services.area_local import AreaLocalService from antares.service.local_services.binding_constraint_local import BindingConstraintLocalService diff --git a/src/antares/tools/all_optional_meta.py b/src/antares/tools/all_optional_meta.py index 6901566b..9aa394e3 100644 --- a/src/antares/tools/all_optional_meta.py +++ b/src/antares/tools/all_optional_meta.py @@ -12,6 +12,7 @@ import copy import typing as t + from pydantic import BaseModel, create_model ModelClass = t.TypeVar("ModelClass", bound=BaseModel) diff --git a/src/antares/tools/ini_tool.py b/src/antares/tools/ini_tool.py index eac41b1f..42f233aa 100644 --- a/src/antares/tools/ini_tool.py +++ b/src/antares/tools/ini_tool.py @@ -13,7 +13,7 @@ from configparser import ConfigParser from enum import Enum from pathlib import Path -from typing import Optional, Any, overload, Union +from typing import Any, Optional, Union, overload class IniFileTypes(Enum): diff --git a/src/antares/tools/prepro_folder.py b/src/antares/tools/prepro_folder.py index 742390b2..8e0d2698 100644 --- a/src/antares/tools/prepro_folder.py +++ b/src/antares/tools/prepro_folder.py @@ -15,8 +15,8 @@ import numpy as np import pandas as pd -from antares.tools.ini_tool import IniFileTypes, IniFile -from antares.tools.time_series_tool import TimeSeriesFileType, TimeSeries, TimeSeriesFile +from antares.tools.ini_tool import IniFile, IniFileTypes +from antares.tools.time_series_tool import TimeSeries, TimeSeriesFile, TimeSeriesFileType class PreproFolder: diff --git a/tests/antares/delete/test_delete_api.py b/tests/antares/delete/test_delete_api.py index 954372a4..dbbab9d5 100644 --- a/tests/antares/delete/test_delete_api.py +++ b/tests/antares/delete/test_delete_api.py @@ -12,16 +12,15 @@ import pytest import requests_mock - from antares.api_conf.api_conf import APIconf from antares.exceptions.exceptions import ( AreaDeletionError, + BindingConstraintDeletionError, + ConstraintTermDeletionError, LinkDeletionError, - ThermalDeletionError, RenewableDeletionError, STStorageDeletionError, - BindingConstraintDeletionError, - ConstraintTermDeletionError, + ThermalDeletionError, ) from antares.model.area import Area from antares.model.binding_constraint import BindingConstraint diff --git a/tests/antares/services/api_services/test_area_api.py b/tests/antares/services/api_services/test_area_api.py index d87a2dc0..b0182aef 100644 --- a/tests/antares/services/api_services/test_area_api.py +++ b/tests/antares/services/api_services/test_area_api.py @@ -11,28 +11,27 @@ # This file is part of the Antares project. +import numpy as np +import pandas as pd +import pytest +import requests_mock from antares.api_conf.api_conf import APIconf from antares.exceptions.exceptions import ( - ThermalCreationError, - RenewableCreationError, - STStorageCreationError, AreaPropertiesUpdateError, AreaUiUpdateError, LoadMatrixDownloadError, LoadMatrixUploadError, MatrixUploadError, + RenewableCreationError, + STStorageCreationError, + ThermalCreationError, ) -from antares.model.area import Area, AreaUi, AreaProperties -from antares.model.hydro import HydroMatrixName, HydroProperties, Hydro -from antares.model.renewable import RenewableClusterProperties, RenewableCluster -from antares.model.st_storage import STStorageProperties, STStorage -from antares.model.thermal import ThermalClusterProperties, ThermalCluster +from antares.model.area import Area, AreaProperties, AreaUi +from antares.model.hydro import Hydro, HydroMatrixName, HydroProperties +from antares.model.renewable import RenewableCluster, RenewableClusterProperties +from antares.model.st_storage import STStorage, STStorageProperties +from antares.model.thermal import ThermalCluster, ThermalClusterProperties from antares.service.service_factory import ServiceFactory -import requests_mock - -import pytest -import pandas as pd -import numpy as np class TestCreateAPI: diff --git a/tests/antares/services/api_services/test_binding_constraint_api.py b/tests/antares/services/api_services/test_binding_constraint_api.py index 4fcbb5da..bca60da1 100644 --- a/tests/antares/services/api_services/test_binding_constraint_api.py +++ b/tests/antares/services/api_services/test_binding_constraint_api.py @@ -11,16 +11,14 @@ # This file is part of the Antares project. import pandas as pd - +import pytest +import requests_mock from antares.api_conf.api_conf import APIconf -from antares.exceptions.exceptions import ConstraintPropertiesUpdateError, ConstraintMatrixDownloadError +from antares.exceptions.exceptions import ConstraintMatrixDownloadError, ConstraintPropertiesUpdateError from antares.model.area import Area -from antares.model.binding_constraint import BindingConstraintProperties, BindingConstraint, ConstraintMatrixName +from antares.model.binding_constraint import BindingConstraint, BindingConstraintProperties, ConstraintMatrixName from antares.model.study import Study from antares.service.service_factory import ServiceFactory -import requests_mock - -import pytest @pytest.fixture diff --git a/tests/antares/services/api_services/test_link_api.py b/tests/antares/services/api_services/test_link_api.py index ddc5bed8..0df8a9d9 100644 --- a/tests/antares/services/api_services/test_link_api.py +++ b/tests/antares/services/api_services/test_link_api.py @@ -13,12 +13,11 @@ import pytest import requests_mock - from antares.api_conf.api_conf import APIconf -from antares.exceptions.exceptions import LinkUiUpdateError, LinkPropertiesUpdateError +from antares.exceptions.exceptions import LinkPropertiesUpdateError, LinkUiUpdateError from antares.model.area import Area from antares.model.commons import FilterOption -from antares.model.link import LinkProperties, LinkUi, Link +from antares.model.link import Link, LinkProperties, LinkUi from antares.model.study import Study from antares.service.service_factory import ServiceFactory diff --git a/tests/antares/services/api_services/test_renewable_api.py b/tests/antares/services/api_services/test_renewable_api.py index 80e7f3c8..047972e2 100644 --- a/tests/antares/services/api_services/test_renewable_api.py +++ b/tests/antares/services/api_services/test_renewable_api.py @@ -11,15 +11,13 @@ # This file is part of the Antares project. import pandas as pd - +import pytest +import requests_mock from antares.api_conf.api_conf import APIconf -from antares.exceptions.exceptions import RenewablePropertiesUpdateError, RenewableMatrixDownloadError +from antares.exceptions.exceptions import RenewableMatrixDownloadError, RenewablePropertiesUpdateError from antares.model.area import Area -from antares.model.renewable import RenewableClusterProperties, RenewableCluster +from antares.model.renewable import RenewableCluster, RenewableClusterProperties from antares.service.service_factory import ServiceFactory -import requests_mock - -import pytest class TestCreateAPI: diff --git a/tests/antares/services/api_services/test_st_storage_api.py b/tests/antares/services/api_services/test_st_storage_api.py index e9ae2d5f..94826654 100644 --- a/tests/antares/services/api_services/test_st_storage_api.py +++ b/tests/antares/services/api_services/test_st_storage_api.py @@ -11,19 +11,17 @@ # This file is part of the Antares project. import pandas as pd - +import pytest +import requests_mock from antares.api_conf.api_conf import APIconf from antares.exceptions.exceptions import ( - STStoragePropertiesUpdateError, STStorageMatrixDownloadError, STStorageMatrixUploadError, + STStoragePropertiesUpdateError, ) from antares.model.area import Area from antares.model.st_storage import STStorage, STStorageProperties from antares.service.service_factory import ServiceFactory -import requests_mock - -import pytest class TestCreateAPI: diff --git a/tests/antares/services/api_services/test_study_api.py b/tests/antares/services/api_services/test_study_api.py index a2b46ae4..00f29f3d 100644 --- a/tests/antares/services/api_services/test_study_api.py +++ b/tests/antares/services/api_services/test_study_api.py @@ -11,24 +11,23 @@ # This file is part of the Antares project. -from antares.api_conf.api_conf import APIconf -import requests_mock import re import pytest - +import requests_mock +from antares.api_conf.api_conf import APIconf from antares.exceptions.exceptions import ( - StudyCreationError, - BindingConstraintCreationError, AreaCreationError, + BindingConstraintCreationError, LinkCreationError, + StudyCreationError, StudySettingsUpdateError, ) -from antares.model.area import AreaUi, AreaProperties, Area -from antares.model.binding_constraint import BindingConstraintProperties, BindingConstraint -from antares.model.link import LinkProperties, LinkUi, Link -from antares.model.settings import StudySettings, GeneralProperties -from antares.model.study import create_study_api, Study +from antares.model.area import Area, AreaProperties, AreaUi +from antares.model.binding_constraint import BindingConstraint, BindingConstraintProperties +from antares.model.link import Link, LinkProperties, LinkUi +from antares.model.settings import GeneralProperties, StudySettings +from antares.model.study import Study, create_study_api from antares.service.service_factory import ServiceFactory diff --git a/tests/antares/services/api_services/test_thermal_api.py b/tests/antares/services/api_services/test_thermal_api.py index f3654150..f2eece40 100644 --- a/tests/antares/services/api_services/test_thermal_api.py +++ b/tests/antares/services/api_services/test_thermal_api.py @@ -11,16 +11,14 @@ # This file is part of the Antares project. import pandas as pd - +import pytest +import requests_mock from antares.api_conf.api_conf import APIconf -from antares.exceptions.exceptions import ThermalPropertiesUpdateError, ThermalMatrixDownloadError +from antares.exceptions.exceptions import ThermalMatrixDownloadError, ThermalPropertiesUpdateError from antares.model.area import Area from antares.model.study import Study -from antares.model.thermal import ThermalCluster, ThermalClusterProperties, ThermalClusterMatrixName +from antares.model.thermal import ThermalCluster, ThermalClusterMatrixName, ThermalClusterProperties from antares.service.service_factory import ServiceFactory -import requests_mock - -import pytest @pytest.fixture diff --git a/tests/antares/services/local_services/conftest.py b/tests/antares/services/local_services/conftest.py index 1570e33f..90fc9853 100644 --- a/tests/antares/services/local_services/conftest.py +++ b/tests/antares/services/local_services/conftest.py @@ -11,26 +11,25 @@ # This file is part of the Antares project. import pytest - from antares.config.local_configuration import LocalConfiguration from antares.model.area import Area from antares.model.binding_constraint import ( BindingConstraint, - BindingConstraintProperties, BindingConstraintFrequency, BindingConstraintOperator, + BindingConstraintProperties, ) from antares.model.hydro import HydroProperties from antares.model.load import Load -from antares.model.renewable import RenewableClusterProperties, TimeSeriesInterpretation, RenewableClusterGroup +from antares.model.renewable import RenewableClusterGroup, RenewableClusterProperties, TimeSeriesInterpretation from antares.model.solar import Solar -from antares.model.st_storage import STStorageProperties, STStorageGroup +from antares.model.st_storage import STStorageGroup, STStorageProperties from antares.model.study import Study, create_study_local from antares.model.thermal import ( - ThermalClusterProperties, + LawOption, LocalTSGenerationBehavior, ThermalClusterGroup, - LawOption, + ThermalClusterProperties, ThermalCostGeneration, ) from antares.model.wind import Wind diff --git a/tests/antares/services/local_services/test_area.py b/tests/antares/services/local_services/test_area.py index 38f93680..d19c2e3f 100644 --- a/tests/antares/services/local_services/test_area.py +++ b/tests/antares/services/local_services/test_area.py @@ -15,26 +15,25 @@ import numpy as np import pandas as pd - from antares.model.hydro import Hydro from antares.model.renewable import ( - RenewableClusterProperties, RenewableCluster, RenewableClusterGroup, - TimeSeriesInterpretation, + RenewableClusterProperties, RenewableClusterPropertiesLocal, + TimeSeriesInterpretation, ) -from antares.model.st_storage import STStorage, STStoragePropertiesLocal, STStorageProperties, STStorageGroup +from antares.model.st_storage import STStorage, STStorageGroup, STStorageProperties, STStoragePropertiesLocal from antares.model.thermal import ( + LawOption, + LocalTSGenerationBehavior, ThermalCluster, - ThermalClusterProperties, ThermalClusterGroup, - LocalTSGenerationBehavior, - LawOption, - ThermalCostGeneration, + ThermalClusterProperties, ThermalClusterPropertiesLocal, + ThermalCostGeneration, ) -from antares.tools.ini_tool import IniFileTypes, IniFile +from antares.tools.ini_tool import IniFile, IniFileTypes from antares.tools.time_series_tool import TimeSeriesFileType diff --git a/tests/antares/services/local_services/test_study.py b/tests/antares/services/local_services/test_study.py index 9862bdf5..53ef7885 100644 --- a/tests/antares/services/local_services/test_study.py +++ b/tests/antares/services/local_services/test_study.py @@ -17,28 +17,27 @@ from pathlib import Path import pytest - from antares.config.local_configuration import LocalConfiguration from antares.exceptions.exceptions import CustomError, LinkCreationError -from antares.model.area import AreaProperties, AreaUi, AreaUiLocal, AreaPropertiesLocal, Area +from antares.model.area import Area, AreaProperties, AreaPropertiesLocal, AreaUi, AreaUiLocal from antares.model.binding_constraint import ( BindingConstraint, - BindingConstraintProperties, BindingConstraintFrequency, BindingConstraintOperator, + BindingConstraintProperties, ConstraintTerm, ) from antares.model.commons import FilterOption from antares.model.hydro import Hydro from antares.model.link import ( + AssetType, Link, LinkProperties, LinkPropertiesLocal, - TransmissionCapacities, - LinkUi, - AssetType, LinkStyle, + LinkUi, LinkUiLocal, + TransmissionCapacities, ) from antares.model.study import create_study_local from antares.service.local_services.area_local import AreaLocalService diff --git a/tests/integration/test_web_client.py b/tests/integration/test_web_client.py index 424900dc..64fb4ad2 100644 --- a/tests/integration/test_web_client.py +++ b/tests/integration/test_web_client.py @@ -12,27 +12,26 @@ import numpy as np import pandas as pd import pytest - from antares.api_conf.api_conf import APIconf from antares.exceptions.exceptions import ( - LoadMatrixUploadError, - STStorageMatrixUploadError, + AreaDeletionError, BindingConstraintCreationError, ConstraintMatrixUpdateError, - AreaDeletionError, + LoadMatrixUploadError, + STStorageMatrixUploadError, ) -from antares.model.settings.advanced_parameters import UnitCommitmentMode, AdvancedProperties -from antares.model.study import create_study_api -from antares.model.binding_constraint import BindingConstraintProperties, LinkData, ClusterData, ConstraintTerm -from antares.model.link import LinkUi, LinkProperties, LinkStyle -from antares.model.renewable import RenewableClusterProperties, RenewableClusterGroup, TimeSeriesInterpretation -from antares.model.settings import StudySettings, GeneralProperties, PlaylistData +from antares.model.area import AdequacyPatchMode, AreaProperties, AreaUi, FilterOption +from antares.model.binding_constraint import BindingConstraintProperties, ClusterData, ConstraintTerm, LinkData +from antares.model.link import LinkProperties, LinkStyle, LinkUi +from antares.model.renewable import RenewableClusterGroup, RenewableClusterProperties, TimeSeriesInterpretation +from antares.model.settings import GeneralProperties, PlaylistData, StudySettings +from antares.model.settings.advanced_parameters import AdvancedProperties, UnitCommitmentMode from antares.model.settings.general import Mode -from antares.model.st_storage import STStorageProperties, STStorageGroup, STStorageMatrixName -from antares.model.thermal import ThermalClusterProperties, ThermalClusterGroup +from antares.model.st_storage import STStorageGroup, STStorageMatrixName, STStorageProperties +from antares.model.study import create_study_api +from antares.model.thermal import ThermalClusterGroup, ThermalClusterProperties -from antares.model.area import AreaUi, AreaProperties, AdequacyPatchMode, FilterOption -from tests.integration.antares_web_desktop import AntaresWebDesktop +from integration.antares_web_desktop import AntaresWebDesktop # todo add integration tests for matrices