Skip to content

Commit

Permalink
feat: use stubtest to ensure that all public entites are documented (#32
Browse files Browse the repository at this point in the history
)
  • Loading branch information
illya-laifu authored Jan 3, 2025
1 parent 1817a58 commit 7da3781
Showing 1 changed file with 37 additions and 12 deletions.
49 changes: 37 additions & 12 deletions taskchampion.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
from datetime import datetime
from enum import Enum
from typing import Optional, Iterator
from typing import Optional, Iterator, final

__all__ = [
"Replica",
"Operation",
"Operations",
"Status",
"TaskData",
"Task",
"WorkingSet",
"Annotation",
"Tag",
"DependencyMap",
]

@final
class Replica:
@staticmethod
def new_on_disk(path: str, create_if_missing: bool): ...
Expand All @@ -10,10 +24,13 @@ class Replica:
def create_task(self, uuid: str, ops: "Operations") -> "Task": ...
def all_task_uuids(self) -> list[str]: ...
def all_tasks(self) -> dict[str, "Task"]: ...
def all_task_data(self) -> dict[str, "TaskData"]: ...
def working_set(self) -> "WorkingSet": ...
def dependency_map(self, force: bool) -> "DependencyMap": ...
def get_task(self, uuid: str) -> Optional["Task"]: ...
def import_task_with_uuid(self, uuid: str) -> "Task": ...
def get_undo_operations(self) -> Optional["Operations"]: ...
def get_task_data(self, uuid: str) -> Optional["TaskData"]: ...
def expire_tasks(self): ...
def sync_to_local(self, server_dir: str, avoid_snapshots: bool): ...
def sync_to_remote(
self, url: str, client_id: str, encryption_secret: str, avoid_snapshots: bool
Expand All @@ -29,8 +46,9 @@ class Replica:
def num_local_operations(self) -> int: ...
def num_undo_points(self) -> int: ...
def commit_operations(self, ops: "Operations") -> None: ...
def commit_reversed_operations(self, ops: "Operations") -> None: ...
def commit_reversed_operations(self, operations: "Operations") -> None: ...

@final
class Operation:
@staticmethod
def Create(uuid: str) -> "Operation": ...
Expand All @@ -41,8 +59,8 @@ class Operation:
uuid: str,
property: str,
timestamp: str,
old_value: Optional[str],
value: Optional[str],
old_value: Optional[str] = None,
value: Optional[str] = None,
) -> "Operation": ...
@staticmethod
def UndoPoint() -> "Operation": ...
Expand All @@ -58,20 +76,21 @@ class Operation:
old_value: Optional[str]
value: Optional[str]

@final
class Operations:
def append(self, op: "Operation"): ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator["Operation"]: ...
def __next__(self) -> "Operation": ...
def __getitem__(self, i: int) -> "Operation": ...

@final
class Status(Enum):
Pending = 1
Completed = 2
Deleted = 3
Recurring = 4
Unknown = 5

@final
class TaskData:
@staticmethod
def create(uuid: str, ops: "Operations") -> "TaskData": ...
Expand All @@ -80,11 +99,12 @@ class TaskData:
def has(self, value: str) -> bool: ...
def update(self, property: str, value: str, ops: "Operations"): ...
def delete(self, ops: "Operations"): ...
def get_uuid(self) -> str: ...

@final
class Task:
def get_uuid(self) -> str: ...
def get_status(self) -> "Status": ...
def get_taskmap(self) -> dict[str, str]: ...
def get_entry(self) -> Optional[datetime]: ...
def get_priority(self) -> str: ...
def get_wait(self) -> Optional[datetime]: ...
Expand Down Expand Up @@ -115,15 +135,17 @@ class Task:
def add_tag(self, tag: "Tag", ops: "Operations"): ...
def remove_tag(self, tag: "Tag", ops: "Operations"): ...
def add_annotation(self, annotation: "Annotation", ops: "Operations"): ...
def remove_annotation(self, annotation: "Annotation", ops: "Operations"): ...
def remove_annotation(self, timestamp: str, ops: "Operations"): ...
def set_due(self, due: Optional[datetime], ops: "Operations"): ...
def set_uda(self, namespace: str, key: str, value: str, ops: "Operations"): ...
def remove_uda(self, namespace: str, key: str, ops: "Operations"): ...
def set_legacy_uda(self, key: str, value: str, ops: "Operations"): ...
def remove_legacy_uda(self, key: str, ops: "Operations"): ...
def add_dependency(self, uuid: str, ops: "Operations"): ...
def remove_dependency(self, uuid: str, ops: "Operations"): ...
def add_dependency(self, dep: str, ops: "Operations"): ...
def remove_dependency(self, dep: str, ops: "Operations"): ...
def into_task_data(self) -> "TaskData": ...

@final
class WorkingSet:
def __len__(self) -> int: ...
def largest_index(self) -> int: ...
Expand All @@ -132,16 +154,19 @@ class WorkingSet:
def by_uuid(self, uuid: str) -> Optional[int]: ...
def __iter__(self) -> Iterator[tuple[int, str]]: ...

@final
class Annotation:
entry: datetime
description: str

def __init__(self, entry: datetime, description: str) -> "Annotation": ...
def __init__(self, entry: datetime, description: str) -> None: ...

@final
class DependencyMap:
def dependencies(self, dep_of: str) -> list[str]: ...
def dependents(self, dep_on: str) -> list[str]: ...

@final
class Tag:
def __init__(self, tag: str): ...
def is_synthetic(self) -> bool: ...
Expand Down

0 comments on commit 7da3781

Please sign in to comment.