Annotate the return type of every function in loop_claude
This commit is contained in:
@@ -3,14 +3,14 @@ import subprocess
|
||||
from loop_claude.outcome import Stop
|
||||
|
||||
|
||||
def checkout_root(cwd):
|
||||
def checkout_root(cwd) -> str | Stop:
|
||||
found = subprocess.run(["git", "rev-parse", "--show-toplevel"], capture_output=True, cwd=cwd, text=True)
|
||||
if found.returncode != 0:
|
||||
return Stop(1, found.stderr.strip())
|
||||
return found.stdout.strip()
|
||||
|
||||
|
||||
def checkouts(root):
|
||||
def checkouts(root) -> list[str]:
|
||||
found = [root]
|
||||
listing = subprocess.run(["git", "worktree", "list", "--porcelain"], capture_output=True, cwd=root, text=True)
|
||||
if listing.returncode == 0:
|
||||
@@ -18,5 +18,5 @@ def checkouts(root):
|
||||
return sorted(set(found))
|
||||
|
||||
|
||||
def project_name(root, code):
|
||||
def project_name(root, code) -> str:
|
||||
return root.removeprefix(f"{code}/").lstrip("/")
|
||||
|
||||
Reference in New Issue
Block a user