Skip to content

Commit

Permalink
Merge pull request #66 from Remi-Gau/isort
Browse files Browse the repository at this point in the history
[STY] use isort instead of sort python import
  • Loading branch information
Remi-Gau authored Feb 5, 2024
2 parents 2e708a6 + 1f4aeea commit 55c8ae6
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 38 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ repos:
- id: pyupgrade
args: [--py38-plus]

- 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: [--py38-plus, --add-import, from __future__ import annotations]
- id: isort
args: [--profile, black, --settings-path, pyproject.toml]

- repo: https://github.com/psf/black
rev: 24.1.1
Expand Down
8 changes: 2 additions & 6 deletions bids/ext/reports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

from __future__ import annotations

from . import _version
from . import parameters
from . import parsing
from . import report
from .due import Doi
from .due import due
from . import _version, parameters, parsing, report
from .due import Doi, due
from .report import BIDSReport

__all__ = ["BIDSReport", "parameters", "parsing", "report"]
Expand Down
8 changes: 4 additions & 4 deletions bids/ext/reports/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
import argparse
import sys
from pathlib import Path
from typing import IO
from typing import Sequence
from typing import IO, Sequence

import rich
from bids.layout import BIDSLayout

from bids.ext.reports import BIDSReport

from ._version import __version__
from .logger import pybids_reports_logger
from bids.ext.reports import BIDSReport
from bids.layout import BIDSLayout

# from bids.reports import BIDSReport
LOGGER = pybids_reports_logger()
Expand Down
7 changes: 2 additions & 5 deletions bids/ext/reports/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
from typing import Any

import numpy as np
from bids.layout import BIDSFile, BIDSLayout
from nibabel import Nifti1Image
from num2words import num2words

from .logger import pybids_reports_logger
from .utils import list_to_str
from .utils import num_to_str
from .utils import remove_duplicates
from bids.layout import BIDSFile
from bids.layout import BIDSLayout
from .utils import list_to_str, num_to_str, remove_duplicates

"""Functions for building strings for individual parameters."""
LOGGER = pybids_reports_logger()
Expand Down
6 changes: 2 additions & 4 deletions bids/ext/reports/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
from typing import Any

import nibabel as nib
from bids.layout import BIDSFile, BIDSLayout
from nibabel.filebasedimages import ImageFileError

from . import parameters
from . import templates
from . import parameters, templates
from .logger import pybids_reports_logger
from .utils import collect_associated_files
from bids.layout import BIDSFile
from bids.layout import BIDSLayout

LOGGER = pybids_reports_logger()

Expand Down
6 changes: 2 additions & 4 deletions bids/ext/reports/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
from collections import Counter
from typing import Any

from bids.layout import BIDSFile, BIDSLayout
from rich import print

from . import parsing
from . import utils
from . import parsing, utils
from .logger import pybids_reports_logger
from bids.layout import BIDSFile
from bids.layout import BIDSLayout

LOGGER = pybids_reports_logger()

Expand Down
5 changes: 2 additions & 3 deletions bids/ext/reports/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
from __future__ import annotations

import json
from os.path import abspath
from os.path import join
from os.path import abspath, join

import nibabel as nib
import pytest
from bids.tests import get_test_data_path

from bids import BIDSLayout
from bids.tests import get_test_data_path


@pytest.fixture
Expand Down
3 changes: 2 additions & 1 deletion bids/ext/reports/tests/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

from pathlib import Path

from bids.tests import get_test_data_path

from bids import BIDSLayout
from bids.ext.reports import parsing
from bids.tests import get_test_data_path


def test_anat_info_smoke(testlayout, testconfig):
Expand Down
6 changes: 3 additions & 3 deletions bids/ext/reports/tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

import json
from collections import Counter
from os.path import abspath
from os.path import join
from os.path import abspath, join

from bids.ext.reports import BIDSReport
from bids.tests import get_test_data_path

from bids.ext.reports import BIDSReport


def test_report_init(testlayout):
"""Report initialization should return a BIDSReport object."""
Expand Down
3 changes: 1 addition & 2 deletions bids/ext/reports/tests/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import json
from pathlib import Path

from bids.ext.reports import parsing
from bids.ext.reports import templates
from bids.ext.reports import parsing, templates


def test_pet():
Expand Down
4 changes: 2 additions & 2 deletions bids/ext/reports/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

from typing import Any

from bids.layout import BIDSFile, BIDSLayout

from .logger import pybids_reports_logger
from bids.layout import BIDSFile
from bids.layout import BIDSLayout

LOGGER = pybids_reports_logger()

Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,10 @@ source = [

[tool.coverage.report]
include_namespace_packages = true


[tool.isort]
combine_as_imports = true
line_length = 99
profile = "black"
skip_gitignore = true

0 comments on commit 55c8ae6

Please sign in to comment.