mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 12:24:59 +00:00
style: Format code with consistent indentation and line breaks
This commit is contained in:
parent
92bbec1852
commit
479d476878
1 changed files with 17 additions and 13 deletions
|
@ -212,23 +212,22 @@ def handle_stale_closing(all_issues, auto_yes):
|
|||
|
||||
for issue in all_issues:
|
||||
# Skip if not open or not stale
|
||||
if (
|
||||
issue["state"] != "open"
|
||||
or "stale" not in [label["name"] for label in issue["labels"]]
|
||||
):
|
||||
if issue["state"] != "open" or "stale" not in [label["name"] for label in issue["labels"]]:
|
||||
continue
|
||||
|
||||
# Get the timeline to find when the stale label was last added
|
||||
timeline_url = f"{GITHUB_API_URL}/repos/{REPO_OWNER}/{REPO_NAME}/issues/{issue['number']}/timeline"
|
||||
timeline_url = (
|
||||
f"{GITHUB_API_URL}/repos/{REPO_OWNER}/{REPO_NAME}/issues/{issue['number']}/timeline"
|
||||
)
|
||||
response = requests.get(timeline_url, headers=headers)
|
||||
response.raise_for_status()
|
||||
events = response.json()
|
||||
|
||||
# Find the most recent stale label addition
|
||||
stale_events = [
|
||||
event for event in events
|
||||
if event.get("event") == "labeled"
|
||||
and event.get("label", {}).get("name") == "stale"
|
||||
event
|
||||
for event in events
|
||||
if event.get("event") == "labeled" and event.get("label", {}).get("name") == "stale"
|
||||
]
|
||||
|
||||
if not stale_events:
|
||||
|
@ -237,14 +236,17 @@ def handle_stale_closing(all_issues, auto_yes):
|
|||
latest_stale = datetime.strptime(stale_events[-1]["created_at"], "%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
# Get comments since the stale label
|
||||
comments_url = f"{GITHUB_API_URL}/repos/{REPO_OWNER}/{REPO_NAME}/issues/{issue['number']}/comments"
|
||||
comments_url = (
|
||||
f"{GITHUB_API_URL}/repos/{REPO_OWNER}/{REPO_NAME}/issues/{issue['number']}/comments"
|
||||
)
|
||||
response = requests.get(comments_url, headers=headers)
|
||||
response.raise_for_status()
|
||||
comments = response.json()
|
||||
|
||||
# Check for comments newer than the stale label
|
||||
new_comments = [
|
||||
comment for comment in comments
|
||||
comment
|
||||
for comment in comments
|
||||
if datetime.strptime(comment["created_at"], "%Y-%m-%dT%H:%M:%SZ") > latest_stale
|
||||
]
|
||||
|
||||
|
@ -278,7 +280,9 @@ def handle_stale_closing(all_issues, auto_yes):
|
|||
|
||||
# Add closing comment
|
||||
comment_url = f"{GITHUB_API_URL}/repos/{REPO_OWNER}/{REPO_NAME}/issues/{issue['number']}/comments"
|
||||
response = requests.post(comment_url, headers=headers, json={"body": CLOSE_STALE_COMMENT})
|
||||
response = requests.post(
|
||||
comment_url, headers=headers, json={"body": CLOSE_STALE_COMMENT}
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
# Close the issue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue