diff --git a/pyproject.toml b/pyproject.toml index 5dbb664..418f98b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ exclude = ["client"] [tool.ruff] select = ["ALL"] -ignore = ["A003", "D101", "D104", "D406", "D407", "S104", "TRY201", "TRY003", "EM101", "EM102", "DTZ003", "PLR0913"] +ignore = ["ANN101", "A003", "D101", "D104", "D203", "D213", "D406", "D407", "S104", "TRY201", "TRY003", "EM101", "EM102", "DTZ003", "PLR0913"] line-length = 120 target-version = "py39" diff --git a/requirements_dev.txt b/requirements_dev.txt index 29ca330..1202aca 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,2 +1,2 @@ -ruff==0.0.260 -black==23.3.0 \ No newline at end of file +ruff +black \ No newline at end of file diff --git a/spoolman/api/v1/models.py b/spoolman/api/v1/models.py index 2689637..16a58a1 100644 --- a/spoolman/api/v1/models.py +++ b/spoolman/api/v1/models.py @@ -132,7 +132,7 @@ class Spool(BaseModel): def from_db(item: models.Spool) -> "Spool": """Create a new Pydantic spool object from a database spool object.""" filament = Filament.from_db(item.filament) - remaining_weight: Optional[float] = None + remaining_weight: float | None = None if filament.weight is not None: remaining_weight = max(filament.weight - item.used_weight, 0) diff --git a/spoolman/database/filament.py b/spoolman/database/filament.py index e622c08..a921e78 100644 --- a/spoolman/database/filament.py +++ b/spoolman/database/filament.py @@ -28,7 +28,7 @@ async def create( settings_bed_temp: Optional[int] = None, ) -> models.Filament: """Add a new filament to the database.""" - vendor_item: Optional[models.Vendor] = None + vendor_item: models.Vendor | None = None if vendor_id is not None: vendor_item = await vendor.get_by_id(db, vendor_id) diff --git a/spoolman/database/models.py b/spoolman/database/models.py index c8343ca..24e21d8 100644 --- a/spoolman/database/models.py +++ b/spoolman/database/models.py @@ -41,7 +41,6 @@ class Filament(Base): comment: Mapped[Optional[str]] = mapped_column(String(1024)) settings_extruder_temp: Mapped[Optional[int]] = mapped_column(comment="Overridden extruder temperature.") settings_bed_temp: Mapped[Optional[int]] = mapped_column(comment="Overridden bed temperature.") - # TODO: Color? class Spool(Base): diff --git a/spoolman/database/spool.py b/spoolman/database/spool.py index 897c46b..93c523f 100644 --- a/spoolman/database/spool.py +++ b/spoolman/database/spool.py @@ -139,7 +139,6 @@ async def use_weight_safe(db: AsyncSession, spool_id: int, weight: float) -> Non ) -# TODO: Make unit tests for race conditions on these async def use_weight(db: AsyncSession, spool_id: int, weight: float) -> models.Spool: """Consume filament from a spool by weight. diff --git a/spoolman/main.py b/spoolman/main.py index 0378068..ce8f3bb 100644 --- a/spoolman/main.py +++ b/spoolman/main.py @@ -90,7 +90,7 @@ async def startup() -> None: # There is some issue with the uvicorn worker that causes the process to hang when running alembic directly. # See: https://github.com/sqlalchemy/alembic/discussions/1155 project_root = Path(__file__).parent.parent - subprocess.run(["alembic", "upgrade", "head"], check=True, cwd=project_root) # noqa: S603, S607 + subprocess.run(["alembic", "upgrade", "head"], check=True, cwd=project_root) # noqa: S603, S607, ASYNC101 logger.info("Startup complete.") diff --git a/tests_integration/run.py b/tests_integration/run.py index 47a2e43..d78c583 100644 --- a/tests_integration/run.py +++ b/tests_integration/run.py @@ -1,5 +1,7 @@ """Build and run the integration tests.""" +# ruff: noqa: S605, S607 + import os os.system("docker build -t donkie/spoolman:test .")