From 047ebcffe427e57db9b7fa06adf63ec8b4d95cb4 Mon Sep 17 00:00:00 2001
From: un-pogaz <46523284+un-pogaz@users.noreply.github.com>
Date: Fri, 24 Jan 2025 11:14:16 +0100
Subject: [PATCH] convert some legacy percent format (manual)
ruff 'UP031'
---
manual/epub.py | 2 +-
setup/build.py | 6 +++---
setup/check.py | 2 +-
setup/hosting.py | 8 ++++----
setup/install.py | 2 +-
setup/lc_data.py | 2 +-
setup/plugins_mirror.py | 2 +-
setup/publish.py | 6 +++---
setup/test.py | 2 +-
setup/translations.py | 2 +-
src/odf/attrconverters.py | 2 +-
src/odf/odf2moinmoin.py | 2 +-
src/odf/odf2xhtml.py | 12 ++++++------
src/odf/odfmanifest.py | 2 +-
src/odf/opendocument.py | 6 +++---
15 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/manual/epub.py b/manual/epub.py
index 6b2224a888..195a3a420a 100644
--- a/manual/epub.py
+++ b/manual/epub.py
@@ -50,7 +50,7 @@ class EPUBHelpBuilder(EpubBuilder):
fmt, width, height = identify(container.raw_data(imgname))
if width == -1:
raise ValueError('Failed to read size of: {}'.format(imgname))
- img.set('style', 'width: %dpx; height: %dpx' % (width, height))
+ img.set('style', 'width: {}px; height: {}px'.format(width, height))
def fix_opf(self, container):
spine_names = {n for n, l in container.spine_names}
diff --git a/setup/build.py b/setup/build.py
index 8835a7d7d8..0108af65e2 100644
--- a/setup/build.py
+++ b/setup/build.py
@@ -21,7 +21,7 @@ from setup import SRC, Command, isbsd, isfreebsd, ishaiku, islinux, ismacos, isw
isunix = islinux or ismacos or isbsd or ishaiku
-py_lib = os.path.join(sys.prefix, 'libs', 'python%d%d.lib' % sys.version_info[:2])
+py_lib = os.path.join(sys.prefix, 'libs', 'python{}{}.lib'.format(*sys.version_info[:2]))
class CompileCommand(NamedTuple):
cmd: list[str]
@@ -657,7 +657,7 @@ class Build(Command):
os.chdir(bdir)
try:
self.check_call(cmd + ['-S', os.path.dirname(sources[0])])
- self.check_call([self.env.make] + ['-j%d'%(cpu_count or 1)])
+ self.check_call([self.env.make] + ['-j{}'.format(cpu_count or 1)])
finally:
os.chdir(cwd)
os.rename(self.j(bdir, 'libheadless.so'), target)
@@ -734,7 +734,7 @@ sip-file = {os.path.basename(sipf)!r}
env = os.environ.copy()
if is_macos_universal_build:
env['ARCHS'] = 'x86_64 arm64'
- self.check_call([self.env.make] + ([] if iswindows else ['-j%d'%(os.cpu_count() or 1)]), env=env)
+ self.check_call([self.env.make] + ([] if iswindows else ['-j{}'.format(os.cpu_count() or 1)]), env=env)
e = 'pyd' if iswindows else 'so'
m = glob.glob(f'{ext.name}/{ext.name}.*{e}')
if not m:
diff --git a/setup/check.py b/setup/check.py
index aa73a07059..ea069b8582 100644
--- a/setup/check.py
+++ b/setup/check.py
@@ -150,7 +150,7 @@ class Check(Command):
for i, f in enumerate(dirty_files):
self.info('\tChecking', f)
if self.file_has_errors(f):
- self.info('%d files left to check' % (len(dirty_files) - i - 1))
+ self.info('{} files left to check'.format(len(dirty_files) - i - 1))
try:
edit_file(f)
except FileNotFoundError:
diff --git a/setup/hosting.py b/setup/hosting.py
index 4ca36854f0..5415fe11ba 100644
--- a/setup/hosting.py
+++ b/setup/hosting.py
@@ -56,16 +56,16 @@ class ReadFileWithProgressReporting: # {{{
eta = int((self._total - self.tell()) / bit_rate) + 1
eta_m, eta_s = eta / 60, eta % 60
sys.stdout.write(
- ' %.1f%% %.1f/%.1fMB %.1f KB/sec %d minutes, %d seconds left' %
- (frac * 100, mb_pos, mb_tot, kb_rate, eta_m, eta_s)
+ ' {:.1f}% {:.1f}/{:.1f}MB {:.1f} KB/sec {} minutes, {} seconds left'
+ .format(frac * 100, mb_pos, mb_tot, kb_rate, eta_m, eta_s)
)
sys.stdout.write('\x1b[u')
if self.tell() >= self._total:
sys.stdout.write('\n')
t = int(time.time() - self.start_time) + 1
print(
- 'Upload took %d minutes and %d seconds at %.1f KB/sec' %
- (t / 60, t % 60, kb_rate)
+ 'Upload took {} minutes and {} seconds at {:.1f} KB/sec'
+ .format(t/60, t % 60, kb_rate)
)
sys.stdout.flush()
diff --git a/setup/install.py b/setup/install.py
index eb7d622775..53df06d7a6 100644
--- a/setup/install.py
+++ b/setup/install.py
@@ -388,7 +388,7 @@ class Bootstrap(Command):
st = time.time()
clone_cmd.insert(2, '--depth=1')
subprocess.check_call(clone_cmd, cwd=self.d(self.SRC))
- print('Downloaded translations in %d seconds' % int(time.time() - st))
+ print('Downloaded translations in {} seconds'.format(int(time.time() - st)))
else:
if os.path.exists(tdir):
subprocess.check_call(['git', 'pull'], cwd=tdir)
diff --git a/setup/lc_data.py b/setup/lc_data.py
index a386e71228..94a1db2f4d 100644
--- a/setup/lc_data.py
+++ b/setup/lc_data.py
@@ -20,7 +20,7 @@ def generate_data():
ans = []
for x, limit in (('day', 8), ('mon', 13)):
for attr in ('ab' + x, x):
- ans.append((attr, tuple(map(nl, (getattr(locale, '%s_%d' % (attr.upper(), i)) for i in range(1, limit)))))),
+ ans.append((attr, tuple(map(nl, (getattr(locale, '{}_{}'.format(attr.upper(), i)) for i in range(1, limit)))))),
for x in ('d_t_fmt', 'd_fmt', 't_fmt', 't_fmt_ampm', 'radixchar', 'thousep', 'yesexpr', 'noexpr'):
ans.append((x, nl(getattr(locale, x.upper()))))
return ans
diff --git a/setup/plugins_mirror.py b/setup/plugins_mirror.py
index a240945b22..fe381f9dee 100644
--- a/setup/plugins_mirror.py
+++ b/setup/plugins_mirror.py
@@ -476,7 +476,7 @@ def plugin_to_index(plugin, count):
block.append('
')
block.append('