Skip to content

Commit

Permalink
fix(isort): fix isort settings
Browse files Browse the repository at this point in the history
  • Loading branch information
osoken committed May 4, 2024
1 parent bd8dd4b commit b2fa857
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 20 deletions.
7 changes: 4 additions & 3 deletions api/birdxplorer_api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
from urllib.parse import parse_qs as parse_query_string
from urllib.parse import urlencode as encode_query_string

from birdxplorer_common.logger import get_logger
from birdxplorer_common.settings import GlobalSettings
from birdxplorer_common.storage import gen_storage
from fastapi import FastAPI
from pydantic.alias_generators import to_snake
from starlette.types import ASGIApp, Receive, Scope, Send

from birdxplorer_common.logger import get_logger
from birdxplorer_common.settings import GlobalSettings
from birdxplorer_common.storage import gen_storage

from .routers.data import gen_router as gen_data_router
from .routers.system import gen_router as gen_system_router

Expand Down
3 changes: 2 additions & 1 deletion api/birdxplorer_api/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from birdxplorer_common.settings import GlobalSettings
from fastapi import FastAPI

from birdxplorer_common.settings import GlobalSettings

from .app import gen_app


Expand Down
5 changes: 3 additions & 2 deletions api/birdxplorer_api/routers/data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from datetime import timezone
from typing import List, Union

from dateutil.parser import parse as dateutil_parse
from fastapi import APIRouter, HTTPException, Query

from birdxplorer_common.models import (
BaseModel,
LanguageIdentifier,
Expand All @@ -16,8 +19,6 @@
UserEnrollment,
)
from birdxplorer_common.storage import Storage
from dateutil.parser import parse as dateutil_parse
from fastapi import APIRouter, HTTPException, Query


class TopicListResponse(BaseModel):
Expand Down
3 changes: 2 additions & 1 deletion api/birdxplorer_api/routers/system.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from birdxplorer_common.models import Message
from fastapi import APIRouter

from birdxplorer_common.models import Message


def gen_router() -> APIRouter:
router = APIRouter()
Expand Down
1 change: 1 addition & 0 deletions api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ init_typed = true

[tool.isort]
profile = "black"
known_first_party = "birdxplorer_api,birdxplorer_common"

[tool.tox]
legacy_tox_ini = """
Expand Down
13 changes: 7 additions & 6 deletions api/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
from typing import List, Type, Union
from unittest.mock import MagicMock, patch

from dotenv import load_dotenv
from fastapi.testclient import TestClient
from polyfactory import Use
from polyfactory.factories.pydantic_factory import ModelFactory
from polyfactory.pytest_plugin import register_fixture
from pytest import fixture

from birdxplorer_common.exceptions import UserEnrollmentNotFoundError
from birdxplorer_common.models import (
LanguageIdentifier,
Expand All @@ -21,12 +28,6 @@
)
from birdxplorer_common.settings import GlobalSettings, PostgresStorageSettings
from birdxplorer_common.storage import Storage
from dotenv import load_dotenv
from fastapi.testclient import TestClient
from polyfactory import Use
from polyfactory.factories.pydantic_factory import ModelFactory
from polyfactory.pytest_plugin import register_fixture
from pytest import fixture


def gen_random_twitter_timestamp() -> int:
Expand Down
3 changes: 2 additions & 1 deletion api/tests/routers/test_data.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import json
from typing import List

from birdxplorer_common.models import Note, Post, Topic, UserEnrollment
from fastapi.testclient import TestClient

from birdxplorer_common.models import Note, Post, Topic, UserEnrollment


def test_user_enrollments_get(client: TestClient, user_enrollment_samples: List[UserEnrollment]) -> None:
response = client.get(f"/api/v1/data/user-enrollments/{user_enrollment_samples[0].participant_id}")
Expand Down
2 changes: 1 addition & 1 deletion api/tests/test_app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from birdxplorer_common.settings import GlobalSettings
from pytest_mock import MockerFixture

from birdxplorer_api.app import gen_app
from birdxplorer_common.settings import GlobalSettings


def test_gen_app(mocker: MockerFixture, default_settings: GlobalSettings) -> None:
Expand Down
1 change: 1 addition & 0 deletions common/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ init_typed = true

[tool.isort]
profile = "black"
known_first_party = "birdxplorer_api,birdxplorer_common"

[tool.tox]
legacy_tox_ini = """
Expand Down
14 changes: 9 additions & 5 deletions scripts/migrations/migrate_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from dotenv import load_dotenv
from sqlalchemy.orm import Session

from birdxplorer.logger import get_logger
from birdxplorer.settings import GlobalSettings
from birdxplorer.storage import (
from birdxplorer_common.logger import get_logger
from birdxplorer_common.settings import GlobalSettings
from birdxplorer_common.storage import (
Base,
NoteRecord,
NoteTopicAssociation,
Expand Down Expand Up @@ -57,7 +57,11 @@
)
)
sess.commit()
with open(os.path.join(args.data_dir, args.notes_topics_association_file_name), "r", encoding="utf-8") as fin:
with open(
os.path.join(args.data_dir, args.notes_topics_association_file_name),
"r",
encoding="utf-8",
) as fin:
for d in csv.DictReader(fin):
if (
sess.query(NoteTopicAssociation)
Expand Down Expand Up @@ -109,7 +113,7 @@
post_id=d["post_id"],
user_id=d["user_id"],
text=d["text"],
media_details=json.loads(d["media_details"]) if len(d["media_details"]) > 0 else None,
media_details=(json.loads(d["media_details"]) if len(d["media_details"]) > 0 else None),
created_at=d["created_at"],
like_count=d["like_count"],
repost_count=d["repost_count"],
Expand Down

0 comments on commit b2fa857

Please sign in to comment.