mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
convert some legacy percent format (extra-edit)
This commit is contained in:
parent
047ebcffe4
commit
02854d8b8c
@ -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('*'):
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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:
|
||||
|
@ -502,25 +502,25 @@ def create_index(index, raw_stats):
|
||||
<head><meta charset="utf-8"><title>Index of calibre plugins</title>
|
||||
<link rel="icon" type="image/x-icon" href="//calibre-ebook.com/favicon.ico" />
|
||||
<style type="text/css">
|
||||
body {{ background-color: #eee; }}
|
||||
a {{ text-decoration: none }}
|
||||
a:hover, h3:hover {{ color: red }}
|
||||
a:visited {{ color: blue }}
|
||||
ul {{ list-style-type: none; font-size: smaller }}
|
||||
li {{ display: inline }}
|
||||
li+li:before {{ content: " - " }}
|
||||
.end {{ border-bottom: solid 1pt black; padding-bottom: 0.5ex; margin-bottom: 4ex; }}
|
||||
h1 img, h3 img {{ vertical-align: middle; margin-right: 0.5em; }}
|
||||
h1 {{ text-align: center }}
|
||||
.download-count {{ color: gray; font-size: smaller }}
|
||||
body { background-color: #eee; }
|
||||
a { text-decoration: none }
|
||||
a:hover, h3:hover { color: red }
|
||||
a:visited { color: blue }
|
||||
ul { list-style-type: none; font-size: smaller }
|
||||
li { display: inline }
|
||||
li+li:before { content: " - " }
|
||||
.end { border-bottom: solid 1pt black; padding-bottom: 0.5ex; margin-bottom: 4ex; }
|
||||
h1 img, h3 img { vertical-align: middle; margin-right: 0.5em; }
|
||||
h1 { text-align: center }
|
||||
.download-count { color: gray; font-size: smaller }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1><img src="//manual.calibre-ebook.com/_static/logo.png">Index of calibre plugins</h1>
|
||||
<div style="text-align:center"><a href="stats.html">Download counts for all plugins</a></div>
|
||||
{}
|
||||
%s
|
||||
</body>
|
||||
</html>'''.format('\n'.join(plugins))
|
||||
</html>''' % ('\n'.join(plugins)) # noqa: UP031
|
||||
raw = index.encode('utf-8')
|
||||
try:
|
||||
with open('index.html', 'rb') as f:
|
||||
@ -541,20 +541,20 @@ h1 {{ text-align: center }}
|
||||
<head><meta charset="utf-8"><title>Stats for calibre plugins</title>
|
||||
<link rel="icon" type="image/x-icon" href="//calibre-ebook.com/favicon.ico" />
|
||||
<style type="text/css">
|
||||
body {{ background-color: #eee; }}
|
||||
h1 img, h3 img {{ vertical-align: middle; margin-right: 0.5em; }}
|
||||
h1 {{ text-align: center }}
|
||||
body { background-color: #eee; }
|
||||
h1 img, h3 img { vertical-align: middle; margin-right: 0.5em; }
|
||||
h1 { text-align: center }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1><img src="//manual.calibre-ebook.com/_static/logo.png">Stats for calibre plugins</h1>
|
||||
<table>
|
||||
<tr><th>Plugin</th><th>Total downloads</th></tr>
|
||||
{}
|
||||
%s
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
'''.format('\n'.join(pstats))
|
||||
''' % ('\n'.join(pstats)) # noqa: UP031
|
||||
raw = stats.encode('utf-8')
|
||||
try:
|
||||
with open('stats.html', 'rb') as f:
|
||||
|
@ -171,14 +171,14 @@ class POT(Command): # {{{
|
||||
def pot_header(self, appname=__appname__, version=__version__):
|
||||
return textwrap.dedent('''\
|
||||
# Translation template file..
|
||||
# Copyright (C) %(year)s Kovid Goyal
|
||||
# Kovid Goyal <kovid@kovidgoyal.net>, %(year)s.
|
||||
# Copyright (C) {year} Kovid Goyal
|
||||
# Kovid Goyal <kovid@kovidgoyal.net>, {year}.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: %(appname)s %(version)s\\n"
|
||||
"POT-Creation-Date: %(time)s\\n"
|
||||
"PO-Revision-Date: %(time)s\\n"
|
||||
"Project-Id-Version: {appname} {version}\\n"
|
||||
"POT-Creation-Date: {time}\\n"
|
||||
"PO-Revision-Date: {time}\\n"
|
||||
"Last-Translator: Automatically generated\\n"
|
||||
"Language-Team: LANGUAGE\\n"
|
||||
"MIME-Version: 1.0\\n"
|
||||
@ -187,7 +187,7 @@ class POT(Command): # {{{
|
||||
"Content-Type: text/plain; charset=UTF-8\\n"
|
||||
"Content-Transfer-Encoding: 8bit\\n"
|
||||
|
||||
''')%dict(appname=appname, version=version,
|
||||
''').format(appname=appname, version=version,
|
||||
year=time.strftime('%Y'),
|
||||
time=time.strftime('%Y-%m-%d %H:%M+%Z'))
|
||||
|
||||
|
@ -126,7 +126,7 @@ def __save_prefix(attribute, arg, element):
|
||||
return str(arg)
|
||||
namespace = element.get_knownns(prefix)
|
||||
if namespace is None:
|
||||
# raise ValueError("'%s' is an unknown prefix" % unicode_type(prefix))
|
||||
# raise ValueError(f"'{unicode_type(prefix)}' is an unknown prefix")
|
||||
return str(arg)
|
||||
return str(arg)
|
||||
|
||||
|
@ -662,7 +662,7 @@ class ODF2XHTML(handler.ContentHandler):
|
||||
''' Get the title from the meta data and create a HTML <title>
|
||||
'''
|
||||
self.title = ''.join(self.data)
|
||||
# self.metatags.append('<title>%s</title>\n' % escape(self.title))
|
||||
# self.metatags.append('<title>{}</title>\n'.format(escape(self.title)))
|
||||
self.data = []
|
||||
|
||||
def e_dc_metatag(self, tag, attrs):
|
||||
@ -1355,7 +1355,7 @@ dl.notes dd:last-of-type { page-break-after: avoid }
|
||||
attrs = {'start': unicode_type(self.list_number_map[number_class])}
|
||||
if self.generate_css:
|
||||
attrs['class'] = list_class
|
||||
self.opentag('{}'.format(tag_name), attrs)
|
||||
self.opentag(str(tag_name), attrs)
|
||||
self.purgedata()
|
||||
|
||||
def e_text_list(self, tag, attrs):
|
||||
|
@ -403,7 +403,7 @@ class OpenDocument:
|
||||
self._z.writestr(zi, fileobj)
|
||||
# According to section 17.7.3 in ODF 1.1, the pictures folder should not have a manifest entry
|
||||
# if hasPictures:
|
||||
# self.manifest.addElement(manifest.FileEntry(fullpath="%sPictures/" % folder, mediatype=""))
|
||||
# self.manifest.addElement(manifest.FileEntry(fullpath=f"{folder}Pictures/", mediatype=""))
|
||||
# Look in subobjects
|
||||
subobjectnum = 1
|
||||
for subobject in object.childobjects:
|
||||
|
Loading…
x
Reference in New Issue
Block a user