Skip to content

Commit

Permalink
chore: actually use isort
Browse files Browse the repository at this point in the history
  • Loading branch information
NiceAesth committed Feb 10, 2024
1 parent a3e8661 commit b92d6f8
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 21 deletions.
9 changes: 4 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@ repos:
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py37-plus, --keep-runtime-typing]
- 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
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
hooks:
Expand Down
1 change: 0 additions & 1 deletion aiordr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# isort: dont-add-imports
from __future__ import annotations

from datetime import date
from importlib import metadata
Expand Down
7 changes: 4 additions & 3 deletions aiordr/client.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""This module contains the client for interfacing with the o!rdr API."""

from __future__ import annotations

import functools
from typing import Literal
from typing import TYPE_CHECKING
from typing import Literal
from warnings import warn

import aiohttp
Expand All @@ -29,10 +30,10 @@
if TYPE_CHECKING:
from types import TracebackType
from typing import Any
from typing import Callable
from typing import Optional
from typing import Type
from typing import Union
from typing import Optional
from typing import Callable


__all__ = ("DeveloperModes", "ordrClient")
Expand Down
1 change: 1 addition & 0 deletions aiordr/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module contains custom exception types.
"""

from __future__ import annotations

from .models import ErrorCode
Expand Down
1 change: 1 addition & 0 deletions aiordr/helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module contains miscellaneous helper functions.
"""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
2 changes: 1 addition & 1 deletion aiordr/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""This module contains models for the o!rdr API."""

# isort: dont-add-imports
from __future__ import annotations

from .base import *
from .errorcode import *
Expand Down
1 change: 1 addition & 0 deletions aiordr/models/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module contains base models for objects.
"""

from __future__ import annotations

import pydantic
Expand Down
1 change: 1 addition & 0 deletions aiordr/models/errorcode.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module contains o!rdr API Error Codes.
"""

from __future__ import annotations

from enum import IntEnum
Expand Down
1 change: 1 addition & 0 deletions aiordr/models/events.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module contains models for websocket events.
"""

from __future__ import annotations

from pydantic import Field
Expand Down
1 change: 1 addition & 0 deletions aiordr/models/render.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module contains models for renders.
"""

from __future__ import annotations

from datetime import datetime
Expand Down
1 change: 1 addition & 0 deletions aiordr/models/renderserver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module contains models for render servers.
"""

from __future__ import annotations

from datetime import datetime
Expand Down
1 change: 1 addition & 0 deletions aiordr/models/skin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module contains models for skins.
"""

from __future__ import annotations

from pydantic import Field
Expand Down
25 changes: 15 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ check_untyped_defs = true
warn_unused_ignores = true
show_error_codes = true

[tool.isort]
add_imports = ["from __future__ import annotations"]
force_single_line = true
profile = "black"

[tools.pytest.ini_options]
testpaths = ["tests"]

Expand All @@ -25,7 +30,7 @@ keywords = ["osu!", "osu", "api"]
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Typing :: Typed"
"Typing :: Typed",
]
include = ["py.typed"]

Expand All @@ -35,14 +40,14 @@ aiohttp = "^3.8.3"
aiolimiter = "^1.0.0"
orjson = "^3.8.3"
pydantic = "^2.0.3"
pytest = {version="^7.2.0", optional = true}
pytest-asyncio = {version="^0.23.0", optional = true}
pytest-mock = {version="^3.10.0", optional = true}
toml = {version="^0.10.2", optional = true}
sphinx = {version="^7.0.0", optional = true}
furo = {version="^2023.5.20", optional = true}
types-toml = {version = "^0.10.8.1", optional = true}
python-socketio = {extras = ["asyncio-client"], version = "^5.7.2"}
pytest = { version = "^7.2.0", optional = true }
pytest-asyncio = { version = "^0.23.0", optional = true }
pytest-mock = { version = "^3.10.0", optional = true }
toml = { version = "^0.10.2", optional = true }
sphinx = { version = "^7.0.0", optional = true }
furo = { version = "^2023.5.20", optional = true }
types-toml = { version = "^0.10.8.1", optional = true }
python-socketio = { extras = ["asyncio-client"], version = "^5.7.2" }

[tool.poetry.group.dev.dependencies]
pytest = "^7.2.0"
Expand All @@ -54,7 +59,7 @@ types-toml = "^0.10.8.1"
sphinx = "^7.0.0"
furo = "^2023.5.20"
pytest-cov = "^4.0.0"
black = {version = "^23.0.0", allow-prereleases = true}
black = { version = "^23.0.0", allow-prereleases = true }
pre-commit = "^3.2.2"

[tool.poetry.extras]
Expand Down
2 changes: 1 addition & 1 deletion tests/classes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# isort: dont-add-imports
from __future__ import annotations


from .mock import MockResponse
1 change: 1 addition & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pytest

import aiordr

from .classes import MockResponse


Expand Down

0 comments on commit b92d6f8

Please sign in to comment.