Skip to content

Commit

Permalink
lint: Add isort
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfehler committed Nov 10, 2024
1 parent adac8fd commit dd8a7e2
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[settings]
multi_line_output=3
3 changes: 1 addition & 2 deletions encyclopaedia/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@

from encyclopaedia.achentry_ren import AchievementEncEntry
from encyclopaedia.encentry_ren import EncEntry
from encyclopaedia.encyclopaedia_ren import Encyclopaedia
from encyclopaedia.encentry_template_ren import EncEntryTemplate
from encyclopaedia.encyclopaedia_ren import Encyclopaedia
from encyclopaedia.text_block_ren import text_block
from encyclopaedia.version import __version__ # noqa: F401


__all__ = [
'AchievementEncEntry',
'Encyclopaedia',
Expand Down
6 changes: 3 additions & 3 deletions encyclopaedia/actions_ren.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import TYPE_CHECKING

from .constants_ren import SortMode
from .types_ren import ENTRY_TYPE

import renpy.exports as renpy
from renpy.store import DictEquality
from renpy.ui import Action

from .constants_ren import SortMode
from .types_ren import ENTRY_TYPE

if TYPE_CHECKING: # pragma: no cover
from .encyclopaedia_ren import Encyclopaedia

Expand Down
1 change: 0 additions & 1 deletion encyclopaedia/book/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@

from encyclopaedia.book.book_ren import Book


__all__ = ['Book']
7 changes: 2 additions & 5 deletions encyclopaedia/book/book_ren.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@
from renpy import store
from renpy.game import persistent

from .actions_ren import (
BookNextPage,
BookPreviousPage,
)
from ..constants_ren import Direction
from ..eventemitter_ren import EventEmitter
from ..exceptions_ren import AddEntryError, GetEntryError
from .actions_ren import BookNextPage, BookPreviousPage

if TYPE_CHECKING: # pragma: no cover
from ..encyclopaedia_ren import Encyclopaedia
from ..encentry_ren import EncEntry
from ..encyclopaedia_ren import Encyclopaedia

"""renpy
init -84 python:
Expand Down
6 changes: 3 additions & 3 deletions encyclopaedia/encentry_ren.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
from renpy.game import persistent
from renpy.store import TintMatrix

from .utils_ren import string_to_list
from .eventemitter_ren import EventEmitter
from .constants_ren import Direction
from .eventemitter_ren import EventEmitter
from .utils_ren import string_to_list

if TYPE_CHECKING: # pragma: no cover
from .encyclopaedia_ren import Encyclopaedia
from .book import Book
from .encyclopaedia_ren import Encyclopaedia

"""renpy
init -84 python:
Expand Down
14 changes: 7 additions & 7 deletions encyclopaedia/encyclopaedia_ren.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
CloseActiveEntry,
FilterBySubject,
NextEntry,
PreviousEntry,
NextPage,
PreviousEntry,
PreviousPage,
SortEncyclopaedia,
SetEntry,
ResetSubPage,
SetEntry,
SortEncyclopaedia,
ToggleShowLockedButtonsAction,
ToggleShowLockedEntryAction,
)
from .book import Book
from .constants_ren import Direction, SortMode
from .entry_sorting_ren import push_locked_to_bottom
from .exceptions_ren import AddEntryError, UnknownEntryError
from .eventemitter_ren import EventEmitter
from .constants_ren import Direction, SortMode
from .book import Book
from .exceptions_ren import AddEntryError, UnknownEntryError
from .types_ren import ENTRY_TYPE

if TYPE_CHECKING: # pragma: no cover
Expand All @@ -31,7 +31,7 @@
"""
from math import floor # NOQA E402
from operator import attrgetter # NOQA E402
from typing import cast, Callable, Optional, Union # NOQA E402
from typing import Callable, Optional, Union, cast # NOQA E402


class Encyclopaedia(EventEmitter, store.object):
Expand Down
1 change: 0 additions & 1 deletion encyclopaedia/eventemitter_ren.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""
from typing import Callable


CALLBACK_TYPE = Callable[['EventEmitter'], None]


Expand Down
3 changes: 1 addition & 2 deletions encyclopaedia/types_ren.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING: # pragma: no cover
from .encentry_ren import EncEntry
from .book import Book
from .encentry_ren import EncEntry

"""renpy
init -85 python:
"""
from typing import Union # NOQA E402


ENTRY_TYPE = Union['Book', 'EncEntry']
2 changes: 1 addition & 1 deletion encyclopaedia/utils_ren.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""renpy
init python:
"""
from typing import cast, Union
from typing import Union, cast

from renpy.python import RevertableList

Expand Down
1 change: 1 addition & 0 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
isort==5.13.2
pyright
ruff
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

sys.modules['renpy'] = renpy

from renpy.game import persistent, MockPersistent # NOQA
from renpy.game import MockPersistent, persistent # NOQA

from encyclopaedia import Encyclopaedia, EncEntry # NOQA
from encyclopaedia import EncEntry, Encyclopaedia # NOQA


@pytest.fixture
Expand Down
6 changes: 1 addition & 5 deletions tests/encyclopaedia/test_change_entry.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
from encyclopaedia import (
EncEntry,
Encyclopaedia,
constants_ren,
)
from encyclopaedia import EncEntry, Encyclopaedia, constants_ren
from encyclopaedia.book import Book


Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ skip_install = true
deps = -r requirements/lint.txt
changedir = .
commands =
ruff check encyclopaedia scripts tests
isort --trailing-comma encyclopaedia tests
ruff check encyclopaedia tests
pyright encyclopaedia


Expand Down

0 comments on commit dd8a7e2

Please sign in to comment.