Skip to content

Commit

Permalink
[STY] use isort (#191)
Browse files Browse the repository at this point in the history
* use isort

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Remi-Gau and pre-commit-ci[bot] authored Feb 5, 2024
1 parent 0197ac7 commit ead8894
Show file tree
Hide file tree
Showing 17 changed files with 112 additions and 103 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ repos:
hooks:
- id: flynt

- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: reorder-python-imports
args: [--py37-plus, --add-import, from __future__ import annotations]
- id: isort
args: [--profile, black]

- repo: https://github.com/psf/black
rev: 24.1.1
Expand Down
15 changes: 8 additions & 7 deletions bidsmreye/bids_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
from bids import BIDSLayout # type: ignore

from bidsmreye._version import __version__
from bidsmreye.configuration import Config
from bidsmreye.configuration import config_to_dict
from bidsmreye.configuration import get_bids_filter_config
from bidsmreye.configuration import get_bidsname_config
from bidsmreye.configuration import get_pybids_config
from bidsmreye.configuration import (
Config,
config_to_dict,
get_bids_filter_config,
get_bidsname_config,
get_pybids_config,
)
from bidsmreye.logging import bidsmreye_log
from bidsmreye.methods import methods
from bidsmreye.utils import copy_license
from bidsmreye.utils import create_dir_if_absent
from bidsmreye.utils import copy_license, create_dir_if_absent

log = bidsmreye_log("bidsmreye")

Expand Down
15 changes: 8 additions & 7 deletions bidsmreye/bidsmreye.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@
import json
import sys
from pathlib import Path
from typing import Any
from typing import IO
from typing import IO, Any

import rich

from bidsmreye._version import __version__
from bidsmreye.configuration import Config
from bidsmreye.defaults import allowed_actions
from bidsmreye.defaults import available_models
from bidsmreye.defaults import default_log_level
from bidsmreye.defaults import default_model
from bidsmreye.defaults import log_levels
from bidsmreye.defaults import (
allowed_actions,
available_models,
default_log_level,
default_model,
log_levels,
)
from bidsmreye.download import download
from bidsmreye.generalize import generalize
from bidsmreye.logging import bidsmreye_log
Expand Down
5 changes: 1 addition & 4 deletions bidsmreye/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
from pathlib import Path
from typing import Any

from attrs import asdict
from attrs import converters
from attrs import define
from attrs import field
from attrs import asdict, converters, define, field
from bids import BIDSLayout # type: ignore

from bidsmreye.logging import bidsmreye_log
Expand Down
6 changes: 2 additions & 4 deletions bidsmreye/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
import sys
import warnings
from pathlib import Path
from typing import Any
from typing import IO
from typing import IO, Any

import pkg_resources
import pooch
import rich

from bidsmreye.defaults import available_models
from bidsmreye.defaults import default_model
from bidsmreye.defaults import available_models, default_model
from bidsmreye.logging import bidsmreye_log

log = bidsmreye_log(name="bidsmreye")
Expand Down
28 changes: 15 additions & 13 deletions bidsmreye/generalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,26 @@
import numpy as np
import pandas as pd
from bids import BIDSLayout # type: ignore
from deepmreye import analyse
from deepmreye import train
from deepmreye.util import data_generator
from deepmreye.util import model_opts
from deepmreye import analyse, train
from deepmreye.util import data_generator, model_opts
from rich import print

from bidsmreye.bids_utils import check_layout
from bidsmreye.bids_utils import create_bidsname
from bidsmreye.bids_utils import get_dataset_layout
from bidsmreye.bids_utils import list_subjects
from bidsmreye.bids_utils import (
check_layout,
create_bidsname,
get_dataset_layout,
list_subjects,
)
from bidsmreye.configuration import Config
from bidsmreye.logging import bidsmreye_log
from bidsmreye.quality_control import quality_control_output
from bidsmreye.utils import add_sidecar_in_root
from bidsmreye.utils import check_if_file_found
from bidsmreye.utils import create_dir_for_file
from bidsmreye.utils import move_file
from bidsmreye.utils import set_this_filter
from bidsmreye.utils import (
add_sidecar_in_root,
check_if_file_found,
create_dir_for_file,
move_file,
set_this_filter,
)

log = bidsmreye_log(name="bidsmreye")

Expand Down
3 changes: 1 addition & 2 deletions bidsmreye/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import chevron

from bidsmreye._version import __version__
from bidsmreye.defaults import available_models
from bidsmreye.defaults import default_model
from bidsmreye.defaults import available_models, default_model
from bidsmreye.utils import create_dir_for_file


Expand Down
24 changes: 14 additions & 10 deletions bidsmreye/prepare_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@
from bids import BIDSLayout # type: ignore
from deepmreye import preprocess

from bidsmreye.bids_utils import check_layout
from bidsmreye.bids_utils import create_bidsname
from bidsmreye.bids_utils import get_dataset_layout
from bidsmreye.bids_utils import init_dataset
from bidsmreye.bids_utils import list_subjects
from bidsmreye.bids_utils import save_sampling_frequency_to_json
from bidsmreye.bids_utils import (
check_layout,
create_bidsname,
get_dataset_layout,
init_dataset,
list_subjects,
save_sampling_frequency_to_json,
)
from bidsmreye.configuration import Config
from bidsmreye.logging import bidsmreye_log
from bidsmreye.utils import check_if_file_found
from bidsmreye.utils import get_deepmreye_filename
from bidsmreye.utils import move_file
from bidsmreye.utils import set_this_filter
from bidsmreye.utils import (
check_if_file_found,
get_deepmreye_filename,
move_file,
set_this_filter,
)

log = bidsmreye_log(name="bidsmreye")

Expand Down
16 changes: 8 additions & 8 deletions bidsmreye/quality_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
from bids import BIDSLayout # type: ignore
from scipy.stats.distributions import chi2

from bidsmreye.bids_utils import check_layout
from bidsmreye.bids_utils import create_bidsname
from bidsmreye.bids_utils import get_dataset_layout
from bidsmreye.bids_utils import init_dataset
from bidsmreye.bids_utils import list_subjects
from bidsmreye.bids_utils import (
check_layout,
create_bidsname,
get_dataset_layout,
init_dataset,
list_subjects,
)
from bidsmreye.configuration import Config
from bidsmreye.logging import bidsmreye_log
from bidsmreye.utils import check_if_file_found
from bidsmreye.utils import create_dir_for_file
from bidsmreye.utils import set_this_filter
from bidsmreye.utils import check_if_file_found, create_dir_for_file, set_this_filter
from bidsmreye.visualize import visualize_eye_gaze_data

log = bidsmreye_log("bidsmreye")
Expand Down
7 changes: 2 additions & 5 deletions bidsmreye/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
from plotly.subplots import make_subplots

from bidsmreye._version import __version__
from bidsmreye.bids_utils import get_dataset_layout
from bidsmreye.bids_utils import list_subjects
from bidsmreye.bids_utils import get_dataset_layout, list_subjects
from bidsmreye.configuration import Config
from bidsmreye.logging import bidsmreye_log
from bidsmreye.utils import check_if_file_found
from bidsmreye.utils import set_this_filter

from bidsmreye.utils import check_if_file_found, set_this_filter

LINE_WIDTH = 3
FONT_SIZE = dict(size=14)
Expand Down
15 changes: 9 additions & 6 deletions tests/test_bids_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@
import shutil
from pathlib import Path

from .utils import pybids_test_dataset
from bidsmreye.bids_utils import check_layout
from bidsmreye.bids_utils import create_bidsname
from bidsmreye.bids_utils import get_dataset_layout
from bidsmreye.bids_utils import init_dataset
from bidsmreye.bids_utils import list_subjects
from bidsmreye.bids_utils import (
check_layout,
create_bidsname,
get_dataset_layout,
init_dataset,
list_subjects,
)
from bidsmreye.configuration import Config
from bidsmreye.prepare_data import save_sampling_frequency_to_json
from bidsmreye.utils import set_this_filter

from .utils import pybids_test_dataset


def test_create_bidsname(tmp_path):
output_dir = tmp_path / "derivatives"
Expand Down
13 changes: 8 additions & 5 deletions tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@

import pytest

from bidsmreye.configuration import (
Config,
config_to_dict,
get_bidsname_config,
get_config,
get_pybids_config,
)

from .utils import pybids_test_dataset
from bidsmreye.configuration import Config
from bidsmreye.configuration import config_to_dict
from bidsmreye.configuration import get_bidsname_config
from bidsmreye.configuration import get_config
from bidsmreye.configuration import get_pybids_config


def test_Config():
Expand Down
3 changes: 1 addition & 2 deletions tests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

import pytest

from bidsmreye.download import download
from bidsmreye.download import download_parser
from bidsmreye.download import download, download_parser


def test_download_parser():
Expand Down
32 changes: 18 additions & 14 deletions tests/test_quality_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@
import pandas as pd
import pytest

from .utils import create_basic_data
from .utils import create_basic_json
from .utils import create_confounds_tsv
from .utils import return_bidsmreye_eyetrack_tsv
from .utils import rm_dir
from bidsmreye.bids_utils import create_bidsname
from bidsmreye.bids_utils import get_dataset_layout
from bidsmreye.bids_utils import create_bidsname, get_dataset_layout
from bidsmreye.configuration import Config
from bidsmreye.quality_control import add_qc_to_sidecar
from bidsmreye.quality_control import compute_displacement_and_outliers
from bidsmreye.quality_control import compute_robust_outliers
from bidsmreye.quality_control import get_sampling_frequency
from bidsmreye.quality_control import perform_quality_control
from bidsmreye.quality_control import quality_control_input
from bidsmreye.quality_control import quality_control_output
from bidsmreye.quality_control import (
add_qc_to_sidecar,
compute_displacement_and_outliers,
compute_robust_outliers,
get_sampling_frequency,
perform_quality_control,
quality_control_input,
quality_control_output,
)

from .utils import (
create_basic_data,
create_basic_json,
create_confounds_tsv,
return_bidsmreye_eyetrack_tsv,
rm_dir,
)


def time_series():
Expand Down
15 changes: 9 additions & 6 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
import shutil
from pathlib import Path

from .utils import pybids_test_dataset
from bidsmreye.bids_utils import get_dataset_layout
from bidsmreye.configuration import Config
from bidsmreye.utils import copy_license
from bidsmreye.utils import get_deepmreye_filename
from bidsmreye.utils import return_deepmreye_output_filename
from bidsmreye.utils import return_regex
from bidsmreye.utils import set_this_filter
from bidsmreye.utils import (
copy_license,
get_deepmreye_filename,
return_deepmreye_output_filename,
return_regex,
set_this_filter,
)

from .utils import pybids_test_dataset


def test_copy_license(tmp_path):
Expand Down
7 changes: 3 additions & 4 deletions tests/test_visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

import pandas as pd

from .utils import create_confounds_tsv
from .utils import return_bidsmreye_eyetrack_tsv
from bidsmreye.bidsmreye import bidsmreye
from bidsmreye.configuration import Config
from bidsmreye.visualize import group_report
from bidsmreye.visualize import visualize_eye_gaze_data
from bidsmreye.visualize import group_report, visualize_eye_gaze_data

from .utils import create_confounds_tsv, return_bidsmreye_eyetrack_tsv


def test_visualize_eye_gaze_data():
Expand Down
3 changes: 1 addition & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import pandas as pd
from bids.tests import get_test_data_path

from bidsmreye.quality_control import compute_displacement
from bidsmreye.quality_control import compute_robust_outliers
from bidsmreye.quality_control import compute_displacement, compute_robust_outliers


def create_basic_data():
Expand Down

0 comments on commit ead8894

Please sign in to comment.