convert some legacy percent format (manual)

ruff 'UP031'
This commit is contained in:
un-pogaz
2025-01-24 11:14:16 +01:00
parent 0560b429bf
commit 047ebcffe4
15 changed files with 29 additions and 29 deletions
+3 -3
View File
@@ -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:
+1 -1
View File
@@ -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:
+4 -4
View File
@@ -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()
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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
+1 -1
View File
@@ -476,7 +476,7 @@ def plugin_to_index(plugin, count):
block.append('<br>')
block.append('<li>{}</li>'.format(li))
block = '<ul>{}</ul>'.format('\n'.join(block))
downloads = ('\xa0<span class="download-count">[%d total downloads]</span>' % count) if count else ''
downloads = ('\xa0<span class="download-count">[{} total downloads]</span>'.format(count)) if count else ''
zipfile = '<div class="end"><a href={} title="Download plugin" download={}>Download plugin \u2193</a>{}</div>'.format(
quoteattr(plugin['file']), quoteattr(plugin['name'] + '.zip'), downloads)
desc = plugin['description'] or ''
+3 -3
View File
@@ -203,7 +203,7 @@ class Manual(Command):
sys.executable, self.j(self.d(self.SRC), 'manual', 'build.py'),
language, self.j(tdir, language)
], '\n\n**************** Building translations for: {}'.format(language)))
self.info('Building manual for %d languages' % len(jobs))
self.info('Building manual for {} languages'.format(len(jobs)))
subprocess.check_call(jobs[0].cmd)
if not parallel_build(jobs[1:], self.info):
raise SystemExit(1)
@@ -222,8 +222,8 @@ class Manual(Command):
if x and not os.path.exists(x):
os.symlink('.', x)
self.info(
'Built manual for %d languages in %s minutes' %
(len(jobs), int((time.time() - st) / 60.))
'Built manual for {} languages in {} minutes'
.format(len(jobs), int((time.time() - st) / 60.))
)
finally:
os.chdir(cwd)
+1 -1
View File
@@ -37,7 +37,7 @@ class Test(BaseTest):
super().add_options(parser)
parser.add_option('--test-verbosity', type=int, default=4, help='Test verbosity (0-4)')
parser.add_option('--test-module', '--test-group', default=[], action='append', type='choice', choices=sorted(map(str, TEST_MODULES)),
help='The test module to run (can be specified more than once for multiple modules). Choices: {}'.format(', '.join(sorted(TEST_MODULES))))
help='The test module to run (can be specified more than once for multiple modules). Choices: {}'.format(', '.join(sorted(TEST_MODULES))))
parser.add_option('--test-name', '-n', default=[], action='append',
help='The name of an individual test to run. Can be specified more than once for multiple tests. The name of the'
' test is the name of the test function without the leading test_. For example, the function test_something()'
+1 -1
View File
@@ -93,7 +93,7 @@ class POT(Command): # {{{
ans = []
for lineno, msg in msgs:
ans.append('#: %s:%d'%(path, lineno))
ans.append('#: {}:{}'.format(path, lineno))
slash = codepoint_to_chr(92)
msg = msg.replace(slash, slash*2).replace('"', r'\"').replace('\n',
r'\n').replace('\r', r'\r').replace('\t', r'\t')