Switch to uv from poetry
This commit is contained in:
@@ -2,6 +2,8 @@ import requests
|
||||
from pydantic import BaseModel
|
||||
from rich.console import Console
|
||||
|
||||
from typing import Any
|
||||
|
||||
from nixprstatus.output import OutputFormat
|
||||
|
||||
DEFAULT_HEADERS = {
|
||||
@@ -16,7 +18,7 @@ class PRStatus(BaseModel):
|
||||
merged: bool
|
||||
branches: dict[str, bool]
|
||||
|
||||
def print(self, format: OutputFormat = OutputFormat.CONSOLE):
|
||||
def print(self, format: OutputFormat = OutputFormat.CONSOLE) -> None:
|
||||
match format:
|
||||
case OutputFormat.JSON:
|
||||
print(self.model_dump_json())
|
||||
@@ -53,15 +55,21 @@ def commits_since(first_ref: str, last_ref: str) -> int:
|
||||
commit_response = requests.get(url, headers=DEFAULT_HEADERS)
|
||||
commit_response.raise_for_status()
|
||||
|
||||
return commit_response.json()["behind_by"]
|
||||
behind_by = commit_response.json()["behind_by"]
|
||||
if not isinstance(behind_by, int):
|
||||
raise TypeError("behind_by unexpected type")
|
||||
return behind_by
|
||||
|
||||
|
||||
def get_pr(pr: int) -> dict:
|
||||
def get_pr(pr: int) -> dict[str, Any]:
|
||||
url = f"https://api.github.com/repos/NixOS/nixpkgs/pulls/{pr}"
|
||||
pr_response = requests.get(url, headers=DEFAULT_HEADERS)
|
||||
pr_response.raise_for_status()
|
||||
|
||||
return pr_response.json()
|
||||
resp = pr_response.json()
|
||||
if not isinstance(resp, dict):
|
||||
raise TypeError("PR response has unexpected type")
|
||||
return resp
|
||||
|
||||
|
||||
def pr_merge_status(
|
||||
|
||||
Reference in New Issue
Block a user