Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/apply isort linting checks #389

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
#
import os
import sys
import dunamai
from datetime import date

import dunamai

sys.path.insert(0, os.path.abspath(".."))

# Ignore rules regarding import order which is required for sphinx build process
Expand Down
5 changes: 3 additions & 2 deletions pycytominer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pycytominer import __about__

from .aggregate import aggregate
from .annotate import annotate
from .consensus import consensus
from .feature_select import feature_select
from .normalize import normalize
from .consensus import consensus
from pycytominer import __about__
3 changes: 2 additions & 1 deletion pycytominer/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

import numpy as np
import pandas as pd

from pycytominer.cyto_utils import (
output,
check_aggregate_operation,
infer_cp_features,
output,
)


Expand Down
8 changes: 5 additions & 3 deletions pycytominer/annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
"""

import os

import pandas as pd

from pycytominer.cyto_utils import (
output,
annotate_cmap,
cp_clean,
infer_cp_features,
load_platemap,
load_profiles,
annotate_cmap,
cp_clean,
output,
)


Expand Down
6 changes: 3 additions & 3 deletions pycytominer/consensus.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

from pycytominer import aggregate
from pycytominer.cyto_utils import (
output,
modz,
load_profiles,
check_consensus_operation,
load_profiles,
modz,
output,
)


Expand Down
16 changes: 8 additions & 8 deletions pycytominer/feature_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
Select features to use in downstream analysis based on specified selection method
"""

from pycytominer.cyto_utils import (
drop_outlier_features,
get_blocklist_features,
infer_cp_features,
load_profiles,
output,
)
from pycytominer.operations import (
correlation_threshold,
variance_threshold,
get_na_columns,
noise_removal,
)
from pycytominer.cyto_utils import (
load_profiles,
output,
get_blocklist_features,
infer_cp_features,
drop_outlier_features,
variance_threshold,
)


Expand Down
6 changes: 3 additions & 3 deletions pycytominer/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"""

import pandas as pd
from sklearn.preprocessing import StandardScaler, RobustScaler
from sklearn.preprocessing import RobustScaler, StandardScaler

from pycytominer.cyto_utils import output, infer_cp_features, load_profiles
from pycytominer.operations import Spherize, RobustMAD
from pycytominer.cyto_utils import infer_cp_features, load_profiles, output
from pycytominer.operations import RobustMAD, Spherize


def normalize(
Expand Down
4 changes: 2 additions & 2 deletions pycytominer/operations/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .correlation_threshold import correlation_threshold
from .variance_threshold import variance_threshold, calculate_frequency
from .get_na_columns import get_na_columns
from .transform import Spherize, RobustMAD
from .noise_removal import noise_removal
from .transform import RobustMAD, Spherize
from .variance_threshold import calculate_frequency, variance_threshold
4 changes: 2 additions & 2 deletions pycytominer/operations/correlation_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"""

from pycytominer.cyto_utils import (
infer_cp_features,
get_pairwise_correlation,
check_correlation_method,
get_pairwise_correlation,
infer_cp_features,
)


Expand Down
1 change: 1 addition & 0 deletions pycytominer/operations/variance_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import numpy as np

from pycytominer.cyto_utils import infer_cp_features


Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ select = [
# flake8-bugbear
# "B",
# isort
# "I",
"I",
# mccabe
# "C90",
# tryceratops
Expand All @@ -163,6 +163,7 @@ ignore = [
# Ignore `E402` and `F401` (unusued imports) in all `__init__.py` files
"__init__.py" = ["E402", "F401"]
"tests/*" = ["S101"] # Ignore assert statements in tests
"pycytominer/cyto_utils/*" = ["I"] # Ignore isort in cyto_utils due to circular imports

[tool.ruff.format]
preview = true
Expand Down
4 changes: 3 additions & 1 deletion tests/test_aggregate.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import os
import tempfile
import pytest

import numpy as np
import pandas as pd
import pytest

from pycytominer import aggregate
from pycytominer.cyto_utils import infer_cp_features

Expand Down
1 change: 1 addition & 0 deletions tests/test_annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import tempfile

import pandas as pd

from pycytominer.annotate import annotate

random.seed(123)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_consensus.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import os
import random
import tempfile

import numpy as np
import pandas as pd

from pycytominer import consensus

random.seed(123)
Expand Down
4 changes: 3 additions & 1 deletion tests/test_cyto_utils/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
"""

import os
import pandas as pd
import pathlib

import pandas as pd
import pytest
import sqlalchemy

from pycytominer.cyto_utils.cell_locations import CellLocation


Expand Down
14 changes: 7 additions & 7 deletions tests/test_cyto_utils/test_DeepProfiler_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
"""

import os
import random
import pytest
import pandas as pd
import pathlib
import numpy.testing as npt
import random

import numpy.testing as npt
import pandas as pd
import pytest

from pycytominer import normalize
from pycytominer.cyto_utils import infer_cp_features
from pycytominer.cyto_utils.DeepProfiler_processing import (
DeepProfilerData,
AggregateDeepProfiler,
DeepProfilerData,
SingleCellDeepProfiler,
)
from pycytominer import normalize
from pycytominer.cyto_utils import infer_cp_features

ROOT_DIR = pathlib.Path(__file__).parents[2]
random.seed(42)
Expand Down
6 changes: 4 additions & 2 deletions tests/test_cyto_utils/test_annotate_custom.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import os
import tempfile
import random
import pytest
import tempfile

import pandas as pd
import pytest

from pycytominer import annotate

random.seed(123)
Expand Down
6 changes: 4 additions & 2 deletions tests/test_cyto_utils/test_cell_locations.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""This tests the output from CellLocation class"""

from typing import List, Type

import pandas as pd
import pytest
from typing import Type, List
from pycytominer.cyto_utils.cell_locations import CellLocation
from _pytest.fixtures import FixtureRequest

from pycytominer.cyto_utils.cell_locations import CellLocation


def get_metadata_input_dataframe(cell_loc: CellLocation) -> pd.DataFrame:
"""
Expand Down
5 changes: 3 additions & 2 deletions tests/test_cyto_utils/test_cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
import numpy as np
import pandas as pd
import pytest
from sqlalchemy import create_engine
from sqlalchemy.exc import OperationalError

from pycytominer import aggregate, annotate, normalize
from pycytominer.cyto_utils import (
get_default_compartments,
get_default_linking_cols,
infer_cp_features,
)
from pycytominer.cyto_utils.cells import SingleCells, _sqlite_strata_conditions
from sqlalchemy import create_engine
from sqlalchemy.exc import OperationalError

random.seed(123)

Expand Down
3 changes: 2 additions & 1 deletion tests/test_cyto_utils/test_collate.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os
import pathlib
import pytest

import pandas as pd
import pytest

from pycytominer.cyto_utils.collate import collate

# Set constants
Expand Down
1 change: 1 addition & 0 deletions tests/test_cyto_utils/test_cp_image_features.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

from pycytominer.cyto_utils import (
aggregate_fields_count,
aggregate_image_features,
Expand Down
2 changes: 2 additions & 0 deletions tests/test_cyto_utils/test_feature_blocklist.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import pathlib

import pandas as pd

from pycytominer.cyto_utils.features import get_blocklist_features

ROOT_DIR = pathlib.Path(__file__).parents[2]
Expand Down
1 change: 1 addition & 0 deletions tests/test_cyto_utils/test_feature_drop_outlier.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

from pycytominer.cyto_utils.features import drop_outlier_features

# Build data to use in tests
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cyto_utils/test_feature_infer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import pandas as pd
from pycytominer.cyto_utils.features import infer_cp_features
import pytest

from pycytominer.cyto_utils.features import infer_cp_features

data_df = pd.DataFrame({
"Cells_Something_Something": [1, 3, 8, 5, 2, 2],
Expand Down
1 change: 1 addition & 0 deletions tests/test_cyto_utils/test_features_count_na.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
import pandas as pd

from pycytominer.cyto_utils import count_na_features

data_df = pd.DataFrame({
Expand Down
10 changes: 6 additions & 4 deletions tests/test_cyto_utils/test_load.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import os
import random
import pytest
import pathlib
import random
import tempfile

import numpy as np
import pandas as pd
import pytest

from pycytominer.cyto_utils import (
load_profiles,
load_platemap,
load_npz_features,
load_npz_locations,
load_platemap,
load_profiles,
)
from pycytominer.cyto_utils.load import infer_delim, is_path_a_parquet_file

Expand Down
1 change: 1 addition & 0 deletions tests/test_cyto_utils/test_modz.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

from pycytominer.cyto_utils import modz
from pycytominer.cyto_utils.modz import modz_base

Expand Down
1 change: 1 addition & 0 deletions tests/test_cyto_utils/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import pandas as pd
import pytest

from pycytominer.cyto_utils.output import (
check_compression_method,
output,
Expand Down
5 changes: 3 additions & 2 deletions tests/test_cyto_utils/test_single_cell_ingest_utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import pytest

from pycytominer.cyto_utils import (
get_default_linking_cols,
get_default_compartments,
assert_linking_cols_complete,
get_default_compartments,
get_default_linking_cols,
provide_linking_cols_feature_name_update,
)

Expand Down
Loading
Loading