convert some legacy percent format (extra-edit)

This commit is contained in:
un-pogaz
2025-01-24 11:14:16 +01:00
parent 047ebcffe4
commit 02854d8b8c
11 changed files with 41 additions and 41 deletions
+5 -5
View File
@@ -23,8 +23,8 @@ message with the summary of the closed bug.
LAUNCHPAD = os.path.expanduser('~/work/env/launchpad.py')
LAUNCHPAD_BUG = 'https://bugs.launchpad.net/calibre/+bug/%s'
GITHUB_BUG = 'https://api.github.com/repos/kovidgoyal/calibre/issues/%s'
LAUNCHPAD_BUG = 'https://bugs.launchpad.net/calibre/+bug/{}'
GITHUB_BUG = 'https://api.github.com/repos/kovidgoyal/calibre/issues/{}'
BUG_PAT = r'(Fix|Implement|Fixes|Fixed|Implemented|See)\s+#(\d+)'
socket.setdefaulttimeout(90)
@@ -44,18 +44,18 @@ class Bug:
if int(bug) > 100000: # Launchpad bug
try:
raw = urllib.request.urlopen(LAUNCHPAD_BUG % bug).read()
raw = urllib.request.urlopen(LAUNCHPAD_BUG.format(bug)).read()
h1 = html.fromstring(raw).xpath('//h1[@id="edit-title"]')[0]
summary = html.tostring(h1, method='text', encoding=str).strip()
except:
summary = 'Private bug'
else:
summary = json.loads(urllib.request.urlopen(GITHUB_BUG % bug).read())['title']
summary = json.loads(urllib.request.urlopen(GITHUB_BUG.format(bug)).read())['title']
if summary:
print('Working on bug:', summary)
if int(bug) > 100000 and action != 'See':
self.close_bug(bug, action)
return match.group() + f' [{summary}]({LAUNCHPAD_BUG % bug})'
return match.group() + f' [{summary}]({LAUNCHPAD_BUG.format(bug)})'
return match.group() + ' ({})'.format(summary)
return match.group()