Skip to content

Commit d05566a

Browse files
committed
apply pre-commit to all files
1 parent fca2cd3 commit d05566a

67 files changed

Lines changed: 253 additions & 230 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1+
default_language_version:
2+
python: python3.10
3+
14
repos:
2-
- repo: https://github.com/ambv/black
3-
rev: 22.3.0
5+
# native hints instead of `from typing` | List -> list
6+
- repo: https://github.com/sondrelg/pep585-upgrade
7+
rev: 'v1.0' # Version to check
48
hooks:
5-
- id: black
9+
- id: upgrade-type-hints
10+
11+
# Only for removing unused imports > Other staff done by Black
12+
- repo: https://github.com/myint/autoflake
13+
rev: "v1.4" # Version to check
14+
hooks:
15+
- id: autoflake
16+
args:
17+
- --in-place
18+
- --remove-all-unused-imports
19+
- --ignore-init-module-imports
20+
621
- repo: https://github.com/pycqa/isort
722
rev: 5.10.1
823
hooks:
924
- id: isort
1025
name: isort (python)
1126
args: ["--profile", "black"]
27+
28+
- repo: https://github.com/ambv/black
29+
rev: 22.3.0
30+
hooks:
31+
- id: black

migrations/env.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
from logging.config import fileConfig
55

6-
from sqlalchemy import engine_from_config
7-
from sqlalchemy import pool
6+
from sqlalchemy import engine_from_config, pool
87

98
from alembic import context
109

src/alembic/env.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from logging.config import fileConfig
22

3-
from sqlalchemy import engine_from_config
4-
from sqlalchemy import pool
3+
from sqlalchemy import engine_from_config, pool
54

65
from alembic import context
76

@@ -16,7 +15,6 @@
1615
# add your model's MetaData object here
1716
# for 'autogenerate' support
1817
from modules.catalog.infrastructure.listing_repository import CatalogListingModel
19-
from seedwork.infrastructure.database import Base
2018

2119
# from myapp import mymodel
2220
# target_metadata = mymodel.Base.metadata

src/alembic/versions/d6c2334f4816_initial_listing_model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
Create Date: 2021-09-27 17:33:02.166128
66
77
"""
8-
from alembic import op
98
import sqlalchemy as sa
109
from sqlalchemy.dialects import postgresql
1110

11+
from alembic import op
12+
1213
# revision identifiers, used by Alembic.
1314
revision = "d6c2334f4816"
1415
down_revision = None

src/api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from pathlib import Path
21
import sys
2+
from pathlib import Path
33

44
# add base project path to PYTHONPATH
55
BASE_DIR = Path(__file__).resolve().parent.parent

src/api/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import uvicorn
2+
23
from api.main import app
34

45
uvicorn.run(app, host="0.0.0.0", port=8000)

src/api/dependencies.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
from fastapi import Header, HTTPException
21
from pydantic import BaseModel
3-
from dataclasses import dataclass
2+
43
from seedwork.domain.value_objects import UUID
54

65

src/api/main.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import time
2-
from fastapi import FastAPI, Request, Depends, HTTPException, status
3-
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
42

5-
from seedwork.infrastructure.request_context import request_context
6-
from seedwork.infrastructure.logging import logger, LoggerFactory
3+
from fastapi import FastAPI, Request
74

8-
from api.routers import catalog, iam
5+
import api.routers.catalog
96
from api.models import CurrentUser
7+
from api.routers import catalog, iam
108
from config.api_config import ApiConfig
119
from config.container import Container
12-
import api.routers.catalog
10+
from seedwork.infrastructure.logging import LoggerFactory, logger
11+
from seedwork.infrastructure.request_context import request_context
1312

1413
# configure logger prior to first usage
1514
LoggerFactory.configure(logger_name="cli")

src/api/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from typing import List
21
from uuid import UUID, uuid4
2+
33
from pydantic import BaseModel
44

55

@@ -22,4 +22,4 @@ class ListingReadModel(BaseModel):
2222

2323

2424
class ListingIndexModel(BaseModel):
25-
data: List[ListingReadModel]
25+
data: list[ListingReadModel]

src/api/routers/catalog.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
from fastapi import APIRouter
2-
from seedwork.infrastructure.request_context import request_context
32

4-
from modules.catalog.module import CatalogModule
3+
from api.models import ListingIndexModel, ListingReadModel, ListingWriteModel
4+
from api.shared import dependency
5+
from config.container import Container, inject
56
from modules.catalog.application.command.create_listing_draft import (
67
CreateListingDraftCommand,
78
)
89
from modules.catalog.application.query.get_all_listings import GetAllListings
910
from modules.catalog.application.query.get_listing_details import GetListingDetails
10-
from config.container import Container, inject
11-
from api.models import ListingReadModel, ListingWriteModel, ListingIndexModel
12-
from api.shared import dependency
11+
from modules.catalog.module import CatalogModule
12+
from seedwork.infrastructure.request_context import request_context
1313

1414
router = APIRouter()
1515

0 commit comments

Comments
 (0)