Skip to content

Commit c1c66e3

Browse files
committed
add utf-8 decoding, address comments
1 parent 21a89ca commit c1c66e3

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

tools/retrieve_prs.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
"""
2-
Usage: python scripts/release_notes/retrieve_prs.py tags/v0.10.0 \
1+
"""Collect the PRs between the current and previous releases and
2+
output the commit titles, PR numbers, and labels in a json file.
3+
Usage: python tools/release_notes/retrieve_prs.py tags/v0.10.0 \
34
18685a517ae68353b05b9a0ede5343df31525c76 --file data.json
45
"""
56
import argparse
@@ -8,11 +9,9 @@
89
import subprocess
910
from collections import namedtuple
1011
from os.path import expanduser
11-
from pathlib import Path
1212

1313
import requests
1414

15-
ROOT_DIR = Path(__file__).parent.resolve()
1615

1716
Features = namedtuple(
1817
"Features",
@@ -25,10 +24,7 @@
2524

2625

2726
def _run_cmd(cmd):
28-
try:
29-
return subprocess.check_output(cmd).strip()
30-
except Exception:
31-
return None
27+
return subprocess.check_output(cmd).decode('utf-8').strip()
3228

3329

3430
def commit_title(commit_hash):
@@ -64,11 +60,8 @@ def get_ghstack_token():
6460

6561
def run_query(query):
6662
response = requests.post("https://github.com/api/graphql", json={"query": query}, headers=headers)
67-
try:
68-
response.raise_for_status()
69-
return response.json()
70-
except requests.exceptions.HTTPError as e:
71-
print(e)
63+
response.raise_for_status()
64+
return response.json()
7265

7366

7467
def gh_labels(pr_number):

0 commit comments

Comments
 (0)