diff --git a/imgsrc/srv/generate.py b/imgsrc/srv/generate.py index 93c2cf9c2d..c5506ca2ed 100644 --- a/imgsrc/srv/generate.py +++ b/imgsrc/srv/generate.py @@ -42,7 +42,7 @@ def merge(): recover=True, no_network=True, resolve_entities=False ) ) - symbol = ans.makeelement('{{{}}}symbol'.format(SVG_NS)) + symbol = ans.makeelement('{%s}symbol' % SVG_NS) # noqa: UP031 symbol.set('viewBox', svg.get('viewBox')) symbol.set('id', 'icon-' + f.rpartition('.')[0]) for child in svg.iterchildren('*'): diff --git a/manual/conf.py b/manual/conf.py index bf9a699f04..e41fd87dbc 100644 --- a/manual/conf.py +++ b/manual/conf.py @@ -253,5 +253,5 @@ latex_show_pagerefs = True latex_show_urls = 'footnote' latex_elements = { 'papersize':'letterpaper', - 'preamble': r'\renewcommand{{\pageautorefname}}{{{}}}'.format(_('page')), + 'preamble': r'\renewcommand{\pageautorefname}{%s}' % _('page'), # noqa: UP031 } diff --git a/recipes/liberation.recipe b/recipes/liberation.recipe index 531b02a41f..18b936ac6a 100644 --- a/recipes/liberation.recipe +++ b/recipes/liberation.recipe @@ -136,7 +136,7 @@ class Liberation(BasicNewsRecipe): b64 = base64.b64decode(self.key) query = { 'website': 'liberation', - 'website_url': '{}'.format(slug), + 'website_url': str(slug), 'published': 'true', '_sourceInclude': '_id,content_restrictions.content_code,credits,promo_items.basic.caption,promo_items.basic.credits,promo_items.basic.url,promo_items.basic.height,promo_items.basic.width,promo_items.basic.resized_image_urls,promo_items.basic.last_updated_date,promo_items.lead_art.caption,promo_items.lead_art.credits,promo_items.lead_art.url,promo_items.lead_art.height,promo_items.lead_art.width,promo_items.lead_art.resized_image_urls,promo_items.lead_art.last_updated_date,source.additional_properties.legacy_url,content_elements,source.source_id,taxonomy.primary_section.additional_properties.original._admin.alias_ids,taxonomy.primary_section.additional_properties.original.navigation.nav_title,taxonomy.primary_section._id,taxonomy.primary_section.name,taxonomy.primary_section.path,taxonomy.tags,label,subheadlines.basic,headlines.basic,source.additional_properties.legacy_url,source.source_type,first_publish_date,display_date,canonical_url' # noqa: E501 } diff --git a/setup/__init__.py b/setup/__init__.py index 1886deafc1..d43f1e8dd4 100644 --- a/setup/__init__.py +++ b/setup/__init__.py @@ -126,7 +126,7 @@ def initialize_constants(): with open(os.path.join(SRC, 'calibre/constants.py'), 'rb') as f: src = f.read().decode('utf-8') nv = re.search(r'numeric_version\s+=\s+\((\d+), (\d+), (\d+)\)', src) - __version__ = '{}.{}.{}'.format(nv.group(1), nv.group(2), nv.group(3)) + __version__ = '.'.join([nv.group(1), nv.group(2), nv.group(3)]) __appname__ = re.search(r'__appname__\s+=\s+(u{0,1})[\'"]([^\'"]+)[\'"]', src).group(2) with open(os.path.join(SRC, 'calibre/linux.py'), 'rb') as sf: diff --git a/setup/git_pre_commit_hook.py b/setup/git_pre_commit_hook.py index 62be70ec45..afe837d1c6 100755 --- a/setup/git_pre_commit_hook.py +++ b/setup/git_pre_commit_hook.py @@ -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() diff --git a/setup/hosting.py b/setup/hosting.py index 5415fe11ba..ff3675d30a 100644 --- a/setup/hosting.py +++ b/setup/hosting.py @@ -416,20 +416,20 @@ def upload_to_servers(files, version): # {{{ # for server, rdir in {'files':'/srv/download/'}.items(): # print('Uploading to server:', server) - # server = '%s.calibre-ebook.com' % server + # server = f'{server}.calibre-ebook.com' # # Copy the generated index files # print('Copying generated index') # check_call(['rsync', '-hza', '-e', 'ssh -x', '--include', '*.html', - # '--filter', '-! */', base, 'root@%s:%s' % (server, rdir)]) + # '--filter', '-! */', base, f'root@{server}:{rdir}']) # # Copy the release files - # rdir = '%s%s/' % (rdir, version) + # rdir = f'{rdir}{version}/' # for x in files: # start = time.time() # print('Uploading', x) # for i in range(5): # try: # check_call(['rsync', '-h', '-z', '--progress', '-e', 'ssh -x', x, - # 'root@%s:%s'%(server, rdir)]) + # f'root@{server}:{rdir}']) # except KeyboardInterrupt: # raise SystemExit(1) # except: diff --git a/setup/plugins_mirror.py b/setup/plugins_mirror.py index fe381f9dee..3ee2f058ca 100644 --- a/setup/plugins_mirror.py +++ b/setup/plugins_mirror.py @@ -502,25 +502,25 @@ def create_index(index, raw_stats):