mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-11-30 13:20:40 +03:00
lint code
This commit is contained in:
2
Makefile
2
Makefile
@@ -60,7 +60,7 @@ safety: ## Check for insecure dependencies
|
||||
|
||||
.PHONY: py-upgrade
|
||||
py-upgrade: ## Upgrade Python syntax to a newer version
|
||||
pyupgrade --py313-plus `find app -name "*.py"`
|
||||
pyupgrade --py314-plus `find app -name "*.py"`
|
||||
|
||||
.PHONY: lint
|
||||
lint: ## Lint and format project code
|
||||
|
||||
@@ -46,10 +46,10 @@ class Character(Base):
|
||||
abbrev: Mapped[str | None] = mapped_column(String(32))
|
||||
description: Mapped[str | None] = mapped_column(String(2056))
|
||||
|
||||
work: Mapped[list["Work"]] = relationship(
|
||||
work: Mapped[list[Work]] = relationship(
|
||||
"Work", secondary="shakespeare.character_work", back_populates="character"
|
||||
)
|
||||
paragraph: Mapped[list["Paragraph"]] = relationship(
|
||||
paragraph: Mapped[list[Paragraph]] = relationship(
|
||||
"Paragraph", back_populates="character"
|
||||
)
|
||||
|
||||
@@ -122,11 +122,11 @@ class Work(Base):
|
||||
total_paragraphs: Mapped[int] = mapped_column(Integer)
|
||||
notes: Mapped[str | None] = mapped_column(Text)
|
||||
|
||||
character: Mapped[list["Character"]] = relationship(
|
||||
character: Mapped[list[Character]] = relationship(
|
||||
"Character", secondary="shakespeare.character_work", back_populates="work"
|
||||
)
|
||||
chapter: Mapped[list["Chapter"]] = relationship("Chapter", back_populates="work")
|
||||
paragraph: Mapped[list["Paragraph"]] = relationship(
|
||||
chapter: Mapped[list[Chapter]] = relationship("Chapter", back_populates="work")
|
||||
paragraph: Mapped[list[Paragraph]] = relationship(
|
||||
"Paragraph", back_populates="work"
|
||||
)
|
||||
|
||||
@@ -170,8 +170,8 @@ class Chapter(Base):
|
||||
chapter_number: Mapped[int] = mapped_column(Integer)
|
||||
description: Mapped[str] = mapped_column(String(256))
|
||||
|
||||
work: Mapped["Work"] = relationship("Work", back_populates="chapter")
|
||||
paragraph: Mapped[list["Paragraph"]] = relationship(
|
||||
work: Mapped[Work] = relationship("Work", back_populates="chapter")
|
||||
paragraph: Mapped[list[Paragraph]] = relationship(
|
||||
"Paragraph", back_populates="chapter"
|
||||
)
|
||||
|
||||
@@ -259,11 +259,11 @@ class Paragraph(Base):
|
||||
char_count: Mapped[int] = mapped_column(Integer)
|
||||
word_count: Mapped[int] = mapped_column(Integer)
|
||||
|
||||
character: Mapped["Character"] = relationship(
|
||||
character: Mapped[Character] = relationship(
|
||||
"Character", back_populates="paragraph"
|
||||
)
|
||||
chapter: Mapped["Chapter"] = relationship("Chapter", back_populates="paragraph")
|
||||
work: Mapped["Work"] = relationship("Work", back_populates="paragraph")
|
||||
chapter: Mapped[Chapter] = relationship("Chapter", back_populates="paragraph")
|
||||
work: Mapped[Work] = relationship("Work", back_populates="paragraph")
|
||||
|
||||
@classmethod
|
||||
async def find(cls, db_session: AsyncSession, character: str):
|
||||
|
||||
@@ -29,7 +29,7 @@ class Stuff(Base):
|
||||
name: Mapped[str] = mapped_column(String, primary_key=True, unique=True)
|
||||
description: Mapped[str | None]
|
||||
|
||||
nonsense: Mapped["Nonsense"] = relationship(
|
||||
nonsense: Mapped[Nonsense] = relationship(
|
||||
"Nonsense", secondary="happy_hog.stuff_full_of_nonsense"
|
||||
)
|
||||
|
||||
@@ -47,7 +47,7 @@ class StuffFullOfNonsense(Base):
|
||||
UUID(as_uuid=True), default=uuid.uuid4, primary_key=True
|
||||
)
|
||||
stuff_id: Mapped[Stuff] = mapped_column(UUID, ForeignKey("happy_hog.stuff.id"))
|
||||
nonsense_id: Mapped["Nonsense"] = mapped_column(
|
||||
nonsense_id: Mapped[Nonsense] = mapped_column(
|
||||
UUID, ForeignKey("happy_hog.nonsense.id")
|
||||
)
|
||||
but_why: Mapped[str | None]
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
Reference in New Issue
Block a user