lint code

This commit is contained in:
grillazz
2025-11-16 15:23:36 +01:00
parent c80b8d841c
commit b10665c64e
4 changed files with 13 additions and 15 deletions

View File

@@ -60,7 +60,7 @@ safety: ## Check for insecure dependencies
.PHONY: py-upgrade .PHONY: py-upgrade
py-upgrade: ## Upgrade Python syntax to a newer version 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 .PHONY: lint
lint: ## Lint and format project code lint: ## Lint and format project code

View File

@@ -46,10 +46,10 @@ class Character(Base):
abbrev: Mapped[str | None] = mapped_column(String(32)) abbrev: Mapped[str | None] = mapped_column(String(32))
description: Mapped[str | None] = mapped_column(String(2056)) 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" "Work", secondary="shakespeare.character_work", back_populates="character"
) )
paragraph: Mapped[list["Paragraph"]] = relationship( paragraph: Mapped[list[Paragraph]] = relationship(
"Paragraph", back_populates="character" "Paragraph", back_populates="character"
) )
@@ -122,11 +122,11 @@ class Work(Base):
total_paragraphs: Mapped[int] = mapped_column(Integer) total_paragraphs: Mapped[int] = mapped_column(Integer)
notes: Mapped[str | None] = mapped_column(Text) 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" "Character", secondary="shakespeare.character_work", back_populates="work"
) )
chapter: Mapped[list["Chapter"]] = relationship("Chapter", back_populates="work") chapter: Mapped[list[Chapter]] = relationship("Chapter", back_populates="work")
paragraph: Mapped[list["Paragraph"]] = relationship( paragraph: Mapped[list[Paragraph]] = relationship(
"Paragraph", back_populates="work" "Paragraph", back_populates="work"
) )
@@ -170,8 +170,8 @@ class Chapter(Base):
chapter_number: Mapped[int] = mapped_column(Integer) chapter_number: Mapped[int] = mapped_column(Integer)
description: Mapped[str] = mapped_column(String(256)) description: Mapped[str] = mapped_column(String(256))
work: Mapped["Work"] = relationship("Work", back_populates="chapter") work: Mapped[Work] = relationship("Work", back_populates="chapter")
paragraph: Mapped[list["Paragraph"]] = relationship( paragraph: Mapped[list[Paragraph]] = relationship(
"Paragraph", back_populates="chapter" "Paragraph", back_populates="chapter"
) )
@@ -259,11 +259,11 @@ class Paragraph(Base):
char_count: Mapped[int] = mapped_column(Integer) char_count: Mapped[int] = mapped_column(Integer)
word_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" "Character", back_populates="paragraph"
) )
chapter: Mapped["Chapter"] = relationship("Chapter", back_populates="paragraph") chapter: Mapped[Chapter] = relationship("Chapter", back_populates="paragraph")
work: Mapped["Work"] = relationship("Work", back_populates="paragraph") work: Mapped[Work] = relationship("Work", back_populates="paragraph")
@classmethod @classmethod
async def find(cls, db_session: AsyncSession, character: str): async def find(cls, db_session: AsyncSession, character: str):

View File

@@ -29,7 +29,7 @@ class Stuff(Base):
name: Mapped[str] = mapped_column(String, primary_key=True, unique=True) name: Mapped[str] = mapped_column(String, primary_key=True, unique=True)
description: Mapped[str | None] description: Mapped[str | None]
nonsense: Mapped["Nonsense"] = relationship( nonsense: Mapped[Nonsense] = relationship(
"Nonsense", secondary="happy_hog.stuff_full_of_nonsense" "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 UUID(as_uuid=True), default=uuid.uuid4, primary_key=True
) )
stuff_id: Mapped[Stuff] = mapped_column(UUID, ForeignKey("happy_hog.stuff.id")) 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") UUID, ForeignKey("happy_hog.nonsense.id")
) )
but_why: Mapped[str | None] but_why: Mapped[str | None]

View File

@@ -1,5 +1,3 @@
from __future__ import annotations
from typing import Any from typing import Any
from pydantic import BaseModel from pydantic import BaseModel