Skip to content

Commit

Permalink
chore: isort
Browse files Browse the repository at this point in the history
  • Loading branch information
msto committed Mar 12, 2024
1 parent 7a9729c commit 0c1dc5e
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 30 deletions.
3 changes: 3 additions & 0 deletions ci/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,18 @@ parent=$(cd $(dirname $0) && pwd -P)

# If the script is invoked with --check only have black check, otherwise have it fix!
black_extra_args=""
isort_extra_args=""
if [[ "$1" == "--check" ]]; then
black_extra_args="--check"
isort_extra_args="--check"
fi

banner "Executing in conda environment ${CONDA_DEFAULT_ENV} in directory ${root}"
run "Unit Tests" "python -m pytest -vv -r sx pybedlite"
run "Style Checking" "black --line-length 99 $black_extra_args pybedlite"
run "Linting" "flake8 --config=$parent/flake8.cfg pybedlite"
run "Type Checking" "mypy -p pybedlite --config $parent/mypy.ini"
run "Import sorting" "isort --force-single-line-imports --profile black ${isort_extra_args} pybedlite"

if [ -z "$failures" ]; then
banner "Checks Passed"
Expand Down
6 changes: 3 additions & 3 deletions pybedlite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@

from typing import Optional

from pybedlite.bed_writer import BedWriter
from pybedlite.bed_source import BedSource
from pybedlite.bed_source import BedPath
from pybedlite.bed_record import BedRecord
from pybedlite.bed_record import BedStrand
from pybedlite.bed_source import BedPath
from pybedlite.bed_source import BedSource
from pybedlite.bed_writer import BedWriter


def reader(path: BedPath) -> "BedSource":
Expand Down
9 changes: 5 additions & 4 deletions pybedlite/bed_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@

from __future__ import annotations

import attr
import enum
from typing import TYPE_CHECKING
from typing import ClassVar
from typing import List
from typing import Optional
from typing import Tuple
from typing import List
from typing import ClassVar
from typing import Type
from typing import TYPE_CHECKING

import attr

if TYPE_CHECKING:
from pybedlite.overlap_detector import Interval
Expand Down
20 changes: 10 additions & 10 deletions pybedlite/bed_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@
"""

import io
from typing import IO
from typing import Optional
from typing import TypeVar
from typing import Union
from typing import Type
from typing import Tuple
from typing import List
from pathlib import Path
from types import TracebackType
from typing import IO
from typing import Any
from typing import Callable
from typing import ContextManager
from typing import Dict
from typing import Iterable
from typing import Iterator
from typing import Dict
from typing import Any
from typing import List
from typing import Optional
from typing import Tuple
from typing import Type
from typing import TypeVar
from typing import Union

from pybedlite.bed_record import BedStrand
from pybedlite.bed_record import BedRecord
from pybedlite.bed_record import BedStrand

"""The classes that should be treated as file-like classes"""
_IOClasses = (io.TextIOBase, io.BufferedIOBase, io.RawIOBase, io.IOBase)
Expand Down
7 changes: 3 additions & 4 deletions pybedlite/bed_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,18 @@
- :class:`~pybedtools.bed_source.BedWriter` -- Writer class for writing BED files
"""

from typing import IO
from typing import Optional
from typing import Type
from pathlib import Path
from types import TracebackType
from typing import IO
from typing import ContextManager
from typing import Iterable
from typing import Optional
from typing import Type

from pybedlite.bed_record import BedRecord
from pybedlite.bed_source import BedPath
from pybedlite.bed_source import _IOClasses


"""Maximum BED fields that can be present in a well formed BED file written to specification"""
MAX_BED_FIELDS: int = 12

Expand Down
4 changes: 2 additions & 2 deletions pybedlite/overlap_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
from typing import Type

import attr
import cgranges as cr

import cgranges as cr
from pybedlite.bed_record import BedRecord
from pybedlite.bed_record import BedStrand
from pybedlite.bed_source import BedSource
from pybedlite.bed_record import BedRecord


@attr.s(frozen=True, auto_attribs=True)
Expand Down
4 changes: 3 additions & 1 deletion pybedlite/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import pytest
from typing import List

import pytest

from pybedlite.bed_record import BedRecord
from pybedlite.bed_record import BedStrand

Expand Down
4 changes: 2 additions & 2 deletions pybedlite/tests/test_overlap_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from typing import List

from pybedlite.bed_record import BedRecord
from pybedlite.bed_record import BedStrand
from pybedlite.overlap_detector import Interval
from pybedlite.overlap_detector import OverlapDetector
from pybedlite.bed_record import BedStrand
from pybedlite.bed_record import BedRecord


def run_test(targets: List[Interval], query: Interval, results: List[Interval]) -> None:
Expand Down
9 changes: 5 additions & 4 deletions pybedlite/tests/test_pybedlite.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
"""Tests for :py:mod:`~pybedlite.__init__.py`"""

import pytest
from pathlib import Path
from typing import List

import pytest

import pybedlite as pybed
from pybedlite.bed_record import BedRecord
from pybedlite.bed_source import BedSource
from pybedlite.bed_writer import MAX_BED_FIELDS
from pybedlite.bed_writer import BedWriter
from pybedlite.bed_source import BedSource
from pybedlite.bed_record import BedRecord


SNIPPET_BED = """\
# Test header, with a line with whitespace below it.
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pytest = "^7.0.0"
mypy = "^1.5.0"
flake8 = "^5.0.0"
black = "^23.0.0"
isort = "^5.0.0"
pytest-cov = "^4.0.0"

[tool.poetry.extras]
Expand Down

0 comments on commit 0c1dc5e

Please sign in to comment.