Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
IIaKyJIuH committed Aug 30, 2023
1 parent aeac3c3 commit 4b17129
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 34 deletions.
6 changes: 2 additions & 4 deletions fedot/api/api_utils/input_analyser.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
from functools import partial
from inspect import signature
from typing import Dict, Tuple, Any, Union
from typing import Any, Dict, Tuple, Union

import numpy as np
from golem.core.log import default_log

from fedot.core.composer.meta_rules import get_cv_folds_number, get_recommended_preset, \
get_early_stopping_generations
from fedot.core.composer.meta_rules import get_cv_folds_number, get_early_stopping_generations, get_recommended_preset
from fedot.core.data.data import InputData
from fedot.core.data.data_preprocessing import find_categorical_columns
from fedot.core.data.multi_modal import MultiModalData
from fedot.core.repository.dataset_types import DataTypesEnum


meta_rules = [get_cv_folds_number,
get_recommended_preset,
get_early_stopping_generations]
Expand Down
2 changes: 0 additions & 2 deletions fedot/core/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

import glob
import os

from copy import copy, deepcopy
from dataclasses import dataclass, field
from typing import Any, Iterable, List, Optional, Tuple, Union

import numpy as np
import pandas as pd

from golem.core.log import default_log
from golem.utilities.requirements_notificator import warn_requirement

Expand Down
4 changes: 2 additions & 2 deletions fedot/core/data/data_preprocessing.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Tuple, Optional
from typing import Optional, Tuple

import numpy as np
import pandas as pd

from fedot.core.data.data import InputData, data_type_is_table, data_type_is_ts, data_type_is_multi_ts
from fedot.core.data.data import InputData, data_type_is_multi_ts, data_type_is_table, data_type_is_ts
from fedot.core.repository.dataset_types import DataTypesEnum
from fedot.preprocessing.data_types import TYPE_TO_ID

Expand Down
2 changes: 1 addition & 1 deletion fedot/core/data/merge/supplementary_data_merger.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Dict
from typing import Dict, List

import numpy as np
from golem.core.log import default_log
Expand Down
2 changes: 1 addition & 1 deletion fedot/core/data/supplementary_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import dataclass
from typing import Optional, Dict
from typing import Dict, Optional

import numpy as np

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import List, Optional

import numpy as np

from sklearn.preprocessing import LabelEncoder, OneHotEncoder

from fedot.core.data.data import InputData, OutputData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sklearn.linear_model import LinearRegression, LogisticRegression
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor

from fedot.core.data.data import OutputData, InputData
from fedot.core.data.data import InputData, OutputData
from fedot.core.operations.evaluation.operation_implementations.implementation_interfaces import \
DataOperationImplementation
from fedot.core.operations.operation_parameters import OperationParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

import numpy as np
import pandas as pd
from sklearn.decomposition import KernelPCA, PCA, FastICA
from sklearn.decomposition import FastICA, KernelPCA, PCA
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import MinMaxScaler, PolynomialFeatures, StandardScaler

from fedot.core.data.data import InputData, data_type_is_table, OutputData
from fedot.core.data.data_preprocessing import replace_inf_with_nans, convert_into_column, \
divide_data_categorical_numerical, find_categorical_columns, data_has_categorical_features
from fedot.core.data.data import InputData, OutputData, data_type_is_table
from fedot.core.data.data_preprocessing import convert_into_column, data_has_categorical_features, \
divide_data_categorical_numerical, find_categorical_columns, replace_inf_with_nans
from fedot.core.operations.evaluation.operation_implementations. \
implementation_interfaces import DataOperationImplementation, EncodedInvariantImplementation
from fedot.core.operations.operation_parameters import OperationParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
from golem.core.log import default_log

from fedot.core.data.data import OutputData, InputData
from fedot.core.data.data import InputData, OutputData
from fedot.core.operations.operation_parameters import OperationParameters
from fedot.core.repository.dataset_types import DataTypesEnum

Expand Down
3 changes: 1 addition & 2 deletions fedot/core/operations/operation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from abc import abstractmethod
from typing import Optional, Union, Dict, Any
from typing import Any, Dict, Optional, Union

from golem.core.log import default_log
from golem.serializers.serializer import register_serializable
Expand Down Expand Up @@ -120,7 +120,6 @@ def predict_for_fit(self, fitted_operation, data: InputData, params: Optional[Op
def _predict(self, fitted_operation, data: InputData, params: Optional[OperationParameters] = None,
output_mode: str = 'default', is_fit_stage: bool = False):


is_main_target = data.supplementary_data.is_main_target
data_flow_length = data.supplementary_data.data_flow_length
self._init(data.task, output_mode=output_mode, params=params, n_samples_data=data.features.shape[0])
Expand Down
2 changes: 1 addition & 1 deletion fedot/core/repository/json_evaluation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from importlib import import_module
from typing import Union, TYPE_CHECKING, List
from typing import List, TYPE_CHECKING, Union

# imports are required beneath in the function
from fedot.core.repository.dataset_types import DataTypesEnum
Expand Down
4 changes: 2 additions & 2 deletions fedot/core/repository/operation_types_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import os
from collections import defaultdict
from dataclasses import dataclass
from typing import Dict, List, Optional, Union, TYPE_CHECKING
from typing import Dict, List, Optional, TYPE_CHECKING, Union

import numpy as np
from golem.core.log import default_log
from golem.core.utilities.data_structures import ensure_wrapped_in_sequence

from fedot.core.constants import BEST_QUALITY_PRESET_NAME, AUTO_PRESET_NAME
from fedot.core.constants import AUTO_PRESET_NAME, BEST_QUALITY_PRESET_NAME
from fedot.core.repository.dataset_types import DataTypesEnum
from fedot.core.repository.json_evaluation import import_enums_from_str, import_strategy_from_str, read_field
from fedot.core.repository.tasks import Task, TaskTypesEnum
Expand Down
2 changes: 1 addition & 1 deletion fedot/preprocessing/base_preprocessing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from abc import ABC, abstractmethod
from typing import Dict, Union, TYPE_CHECKING
from typing import Dict, TYPE_CHECKING, Union

import numpy as np
from sklearn.preprocessing import LabelEncoder
Expand Down
2 changes: 1 addition & 1 deletion fedot/preprocessing/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from fedot.core.data.data import InputData
from fedot.core.data.data_preprocessing import find_categorical_columns
from fedot.preprocessing.data_types import TYPE_TO_ID, FEDOT_STR_NAN
from fedot.preprocessing.data_types import FEDOT_STR_NAN, TYPE_TO_ID


class BinaryCategoricalPreprocessor:
Expand Down
3 changes: 2 additions & 1 deletion fedot/preprocessing/data_types.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from __future__ import annotations

from collections.abc import Sequence
from typing import TYPE_CHECKING, Tuple, Optional, List, Dict
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple

import numpy as np
import pandas as pd

from golem.core.log import LoggerAdapter, default_log

from fedot.core.repository.tasks import Task, TaskTypesEnum
Expand Down
2 changes: 1 addition & 1 deletion fedot/preprocessing/dummy_preprocessing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Union, TYPE_CHECKING
from typing import TYPE_CHECKING, Union

import numpy as np
from golem.core.log import default_log
Expand Down
6 changes: 3 additions & 3 deletions fedot/preprocessing/preprocessing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from copy import copy
from typing import Union, Optional
from typing import Optional, Union

import numpy as np
import pandas as pd
Expand All @@ -8,7 +8,7 @@
from sklearn.preprocessing import LabelEncoder

from fedot.core.data.data import InputData, np_datetime_to_numeric
from fedot.core.data.data import OutputData, data_type_is_table, data_type_is_ts, data_type_is_text
from fedot.core.data.data import OutputData, data_type_is_table, data_type_is_text, data_type_is_ts
from fedot.core.data.data_preprocessing import (
data_has_categorical_features,
data_has_missing_values,
Expand All @@ -28,7 +28,7 @@
from fedot.core.repository.tasks import TaskTypesEnum
from fedot.preprocessing.base_preprocessing import BasePreprocessor
from fedot.preprocessing.categorical import BinaryCategoricalPreprocessor
from fedot.preprocessing.data_type_check import exclude_ts, exclude_multi_ts, exclude_image
from fedot.preprocessing.data_type_check import exclude_image, exclude_multi_ts, exclude_ts
from fedot.preprocessing.data_types import TYPE_TO_ID, TableTypesCorrector
from fedot.preprocessing.structure import DEFAULT_SOURCE_NAME, PipelineStructureExplorer

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base framework
thegolem @ git+https://github.com/aimclub/GOLEM.git@stable#egg=thegolem
thegolem@ git+https://github.com/aimclub/GOLEM.git@stable#egg=thegolem

# Data
numpy>=1.16.0, !=1.24.0
Expand Down
2 changes: 1 addition & 1 deletion test/integration/models/test_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from fedot.core.repository.operation_types_repository import (OperationTypesRepository,
get_operation_type_from_id)
from fedot.core.repository.pipeline_operation_repository import PipelineOperationRepository
from fedot.core.repository.tasks import TaskTypesEnum, Task
from fedot.core.repository.tasks import Task, TaskTypesEnum


def mocked_path():
Expand Down
6 changes: 3 additions & 3 deletions test/unit/preprocessing/test_preprocessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
from fedot.core.pipelines.node import PipelineNode
from fedot.core.pipelines.pipeline import Pipeline
from fedot.core.repository.dataset_types import DataTypesEnum
from fedot.core.repository.tasks import TaskTypesEnum, Task
from fedot.core.repository.tasks import Task, TaskTypesEnum
from fedot.core.utils import fedot_project_root
from fedot.preprocessing.data_types import TYPE_TO_ID
from fedot.preprocessing.data_types import TableTypesCorrector, apply_type_transformation
from fedot.preprocessing.structure import DEFAULT_SOURCE_NAME
from test.unit.preprocessing.test_pipeline_preprocessing import data_with_mixed_types_in_each_column, \
correct_preprocessing_params
from test.unit.preprocessing.test_pipeline_preprocessing import correct_preprocessing_params, \
data_with_mixed_types_in_each_column


def get_mixed_data_with_str_and_float_values(idx: int = None):
Expand Down

0 comments on commit 4b17129

Please sign in to comment.