File: summarize_pr.py

package info (click to toggle)
sqlitedict 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 200 kB
  • sloc: python: 825; makefile: 31; sh: 7
file content (26 lines) | stat: -rwxr-xr-x 828 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python
import json
import sys
import urllib.request


def copy_to_clipboard(text):
    try:
        import pyperclip
    except ImportError:
        print('pyperclip <https://pypi.org/project/pyperclip/> is missing.', file=sys.stderr)
        print('copy-paste the following text manually:', file=sys.stderr)
        print('  ' + text, file=sys.stderr)
    else:
        pyperclip.copy(text)


for prid in sys.argv[1:]:
    url = "https://api.github.com/repos/RaRe-Technologies/sqlitedict/pulls/%s" % prid
    with urllib.request.urlopen(url) as fin:
        prinfo = json.load(fin)

    prinfo['user_login'] = prinfo['user']['login']
    prinfo['user_html_url'] = prinfo['user']['html_url']
    text = '- %(title)s (PR [#%(number)s](%(html_url)s), [@%(user_login)s](%(user_html_url)s))' % prinfo
    print(text)