From 24410a011cdbcfa9cac1ef7abdda3820a6cf21a4 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Wed, 1 Jan 2025 13:29:46 -0500 Subject: [PATCH] Also check Python formatting (#18) --- .github/workflows/checks.yml | 9 ++++++++- pyproject.toml | 5 +++++ taskchampion.pyi | 23 +++-------------------- tests/test_replica.py | 1 + 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 7888612..b66c32a 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -45,7 +45,7 @@ jobs: fmt: runs-on: ubuntu-latest - name: "Formatting" + name: "Rust Formatting" steps: - uses: actions/checkout@v4 @@ -60,3 +60,10 @@ jobs: with: command: fmt args: --all -- --check + + black: + runs-on: ubuntu-latest + name: "Python Formatting" + steps: + - uses: actions/checkout@v4 + - uses: psf/black@stable diff --git a/pyproject.toml b/pyproject.toml index 34380a9..4e1af37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,3 +29,8 @@ maturin = { extras = ["patchelf"], version = "^1.5.1" } [tool.poetry.group.test.dependencies] pytest = "^8.2.0" mypy = "^1.10.0" + +[tool.black] +line-length = 88 +target-version = ['py39'] +include = '\.pyi?$' diff --git a/taskchampion.pyi b/taskchampion.pyi index 21acd47..534aa66 100644 --- a/taskchampion.pyi +++ b/taskchampion.pyi @@ -2,7 +2,6 @@ from datetime import datetime from enum import Enum from typing import Optional, Iterator - class Replica: def __init__(self, path: str, create_if_missing: bool): ... @staticmethod @@ -12,7 +11,6 @@ class Replica: def create_task(self, uuid: str) -> tuple["Task", list["Operation"]]: ... def all_task_uuids(self) -> list[str]: ... def all_tasks(self) -> dict[str, "Task"]: ... - def update_task( self, uuid: str, property: str, value: Optional[str] ) -> dict[str, str]: ... @@ -27,13 +25,11 @@ class Replica: def num_undo_points(self) -> int: ... def commit_operations(self, operations: list["Operation"]) -> None: ... - class Operation: @staticmethod def Create(uuid: str) -> "Operation": ... @staticmethod def Delete(uuid: str, old_task: dict[str, str]): ... - @staticmethod def Update( uuid: str, @@ -45,7 +41,6 @@ class Operation: @staticmethod def UndoPoint() -> "Operation": ... - class Status(Enum): Pending = 1 Completed = 2 @@ -53,7 +48,6 @@ class Status(Enum): Recurring = 4 Unknown = 5 - class Task: def get_uuid(self) -> str: ... def get_status(self) -> "Status": ... @@ -80,7 +74,6 @@ class Task: def set_entry(self, entry: Optional[str]) -> list["Operation"]: ... def set_wait(self, wait: Optional[str]) -> list["Operation"]: ... def set_modified(self, modified: Optional[str]) -> list["Operation"]: ... - def set_value( self, property: str, value: Optional[str] ) -> Optional["Operation"]: ... @@ -89,23 +82,16 @@ class Task: def done(self) -> list["Operation"]: ... def add_tag(self, tag: "Tag") -> list["Operation"]: ... def remove_tag(self, tag: "Tag") -> list["Operation"]: ... - - def add_annotation( - self, annotation: "Annotation") -> list["Operation"]: ... - def remove_annotation( - self, annotation: "Annotation") -> list["Operation"]: ... - + def add_annotation(self, annotation: "Annotation") -> list["Operation"]: ... + def remove_annotation(self, annotation: "Annotation") -> list["Operation"]: ... def set_due(self, due: Optional[datetime]) -> list["Operation"]: ... - def set_uda(self, namespace: str, key: str, - value: str) -> list["Operation"]: ... - + def set_uda(self, namespace: str, key: str, value: str) -> list["Operation"]: ... def remove_uda(self, namespace: str, key: str) -> list["Operation"]: ... def set_legacy_uda(self, key: str, value: str) -> list["Operation"]: ... def remove_legacy_uda(self, key: str) -> list["Operation"]: ... def add_dependency(self, uuid: str) -> list["Operation"]: ... def remove_dependency(self, uuid: str) -> list["Operation"]: ... - class WorkingSet: def __len__(self) -> int: ... def largest_index(self) -> int: ... @@ -115,19 +101,16 @@ class WorkingSet: def __iter__(self) -> Iterator[tuple[int, str]]: ... def __next__(self) -> tuple[int, str]: ... - class Annotation: entry: str description: str def __init__(self) -> None: ... - class DependencyMap: def dependencies(self, dep_of: str) -> list[str]: ... def dependents(self, dep_on: str) -> list[str]: ... - class Tag: def __init__(self, tag: str): ... def is_synthetic(self) -> bool: ... diff --git a/tests/test_replica.py b/tests/test_replica.py index 0d1f6d7..f05cfb3 100644 --- a/tests/test_replica.py +++ b/tests/test_replica.py @@ -4,6 +4,7 @@ import pytest from taskchampion import Replica + @pytest.fixture def empty_replica() -> Replica: return Replica.new_in_memory()