Skip to content

Commit 8f73703

Browse files
author
rocky
committed
flynt more files; lint more.
1 parent 4c1ed81 commit 8f73703

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

test/test_pyenvlib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def file_matches(files, root, basenames, patterns):
200200
print("Processed %d files, total" % (i + 1))
201201
print(time.ctime())
202202
elapsed_time = time.time() - start_time
203-
print("%g seconds" % elapsed_time)
203+
print(f"{elapsed_time:g} seconds")
204204
os.chdir(cwd)
205205

206206

@@ -273,4 +273,4 @@ def file_matches(files, root, basenames, patterns):
273273
do_compile=do_compile,
274274
)
275275
else:
276-
print("### Path %s doesn't exist; skipping" % src_dir)
276+
print(f"### Path {src_dir} doesn't exist; skipping")

test/test_pythonlib.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# emacs-mode: -*-python-*-
32

43
"""
54
test_pythonlib.py -- disassemble Python libraries
@@ -109,11 +108,11 @@ def get_srcdir():
109108
"3.12",
110109
"3.13",
111110
):
112-
bytecode = "bytecode_%s" % vers
113-
key = "bytecode-%s" % vers
111+
bytecode = f"bytecode_{vers}"
112+
key = f"bytecode-{vers}"
114113
test_options[key] = (os.path.join(src_dir, bytecode), PYC, bytecode, vers)
115-
key = "%s" % vers
116-
pythonlib = "python%s" % vers
114+
key = vers
115+
pythonlib = f"python{vers}"
117116
if isinstance(vers, float) and vers >= 3.0:
118117
pythonlib = os.path.join(src_dir, pythonlib, "__pycache__")
119118
test_options[key] = (os.path.join(lib_prefix, pythonlib), PYOC, pythonlib, vers)
@@ -129,10 +128,10 @@ def get_srcdir():
129128
(312, 3.12),
130129
(313, 3.13),
131130
):
132-
bytecode = "bytecode_pypy%s" % vers
133-
key = "bytecode-pypy%s" % vers
131+
bytecode = f"bytecode_pypy{vers}"
132+
key = f"bytecode-pypy{vers}"
134133
test_options[key] = (os.path.join(src_dir, bytecode), PYOC, bytecode, vers_dot)
135-
key = "bytecode-pypy%s" % vers_dot
134+
key = f"bytecode-pypy{vers_dot}"
136135
test_options[key] = (os.path.join(src_dir, bytecode), PYOC, bytecode, vers_dot)
137136

138137

@@ -246,7 +245,7 @@ def file_matches(files, root, basenames, patterns):
246245
checked_dirs = []
247246
start_with = None
248247

249-
test_options_keys = list(test_options.keys())
248+
test_options_keys = [str(k) for k in test_options.keys()]
250249
test_options_keys.sort()
251250
opts, args = getopt.getopt(
252251
sys.argv[1:],
@@ -287,7 +286,7 @@ def file_matches(files, root, basenames, patterns):
287286
if os.path.isdir(src_dir):
288287
checked_dirs.append([src_dir, pattern, target_dir])
289288
else:
290-
sys.stderr.write("Can't find directory %s. Skipping\n" % src_dir)
289+
sys.stderr.write(f"Can't find directory {src_dir}. Skipping\n")
291290
continue
292291
last_compile_version = compiled_version
293292
pass

xdis/roundtrip_pyc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def load_meta_and_code_from_filename(path: str):
179179
return load_module_from_file_object(fp, filename=path, get_code=True)
180180

181181

182-
def roundtrip_pyc(input_path: str, unlink_on_success) -> int:
182+
def roundtrip_pyc(input_path: str, unlink_on_success: bool) -> int:
183183

184184
# parser = argparse.ArgumentParser(
185185
# description="Load a .pyc with xdis, rewrite it to a temporary file, and compare."

0 commit comments

Comments
 (0)