diff --git a/.github/workflows/download-arm64-libs.py b/.github/workflows/download-arm64-libs.py index 63e48971ab..21b23cc79a 100644 --- a/.github/workflows/download-arm64-libs.py +++ b/.github/workflows/download-arm64-libs.py @@ -21,11 +21,11 @@ VERSION = "{}.{}.{}".format(*sys.version_info[:3]) if sys.version_info.releaselevel == "alpha": - VERSION += "-a{}".format(sys.version_info.serial) + VERSION += f"-a{sys.version_info.serial}" if sys.version_info.releaselevel == "beta": - VERSION += "-b{}".format(sys.version_info.serial) + VERSION += f"-b{sys.version_info.serial}" if sys.version_info.releaselevel == "candidate": - VERSION += "-rc{}".format(sys.version_info.serial) + VERSION += f"-rc{sys.version_info.serial}" URL = f"https://www.nuget.org/api/v2/package/pythonarm64/{VERSION}" PATH = dest / f"pythonarm64.{VERSION}.zip" diff --git a/AutoDuck/BuildHHP.py b/AutoDuck/BuildHHP.py index aa1f4119f0..52662d8f4a 100644 --- a/AutoDuck/BuildHHP.py +++ b/AutoDuck/BuildHHP.py @@ -40,7 +40,7 @@ def handle_globs(lGlobs): for g in lGlobs: new = glob.glob(g) if len(new) == 0: - print("The pattern '%s' yielded no files!" % (g,)) + print(f"The pattern '{g}' yielded no files!") lFiles = lFiles + new # lFiles is now the list of origin files. # Normalize all of the paths: @@ -111,12 +111,12 @@ def main(): shutil.copyfile(lSrcFiles[i], file) for file in lDestFiles: - html_files = html_files + "%s\\%s\n" % (html_dir, file) + html_files = html_files + f"{html_dir}\\{file}\n" for cat in doc: - html_files = html_files + "%s\\%s.html\n" % (output_dir, cat.id) + html_files = html_files + f"{output_dir}\\{cat.id}.html\n" for suffix in "_overview _modules _objects _constants".split(): - html_files = html_files + "%s\\%s%s.html\n" % (output_dir, cat.id, suffix) + html_files = html_files + f"{output_dir}\\{cat.id}{suffix}.html\n" f.write(sHHPFormat % {"output": output, "target": target, "html_files": html_files}) f.close() diff --git a/AutoDuck/Dump2HHC.py b/AutoDuck/Dump2HHC.py index d6071d31b4..42790a9d81 100644 --- a/AutoDuck/Dump2HHC.py +++ b/AutoDuck/Dump2HHC.py @@ -153,19 +153,16 @@ def parseTopics(cat, input): elif top.type == "const": d = cat.constants else: - raise RuntimeError("What is '%s'" % (top.type,)) + raise RuntimeError(f"What is '{top.type}'") if top.name in d: - print("Duplicate named %s detected: %s" % (top.type, top.name)) + print(f"Duplicate named {top.type} detected: {top.name}") # Skip the property fields line for module/object line = input.readline() line = line[:-1] fields = line.split("\t") - assert len(fields[0]) == 0 and len(fields[1]) == 0, "%s, %s" % ( - fields, - top.name, - ) + assert len(fields[0]) == 0 and len(fields[1]) == 0, f"{fields}, {top.name}" if line == "": raise ValueError("incomplete topic!") @@ -197,16 +194,10 @@ def parseTopics(cat, input): assert len(fields[0]) == 0 and len(fields[1]) == 0, fields if top2.type == "pymeth": top2.name = fields[2] - top2.context = "%s__%s_meth.html" % ( - _urlescape(top.name), - top2.name, - ) + top2.context = f"{_urlescape(top.name)}__{top2.name}_meth.html" elif top2.type == "prop": top2.name = fields[3] - top2.context = "%s__%s_prop.html" % ( - _urlescape(top.name), - top2.name, - ) + top2.context = f"{_urlescape(top.name)}__{top2.name}_prop.html" else: # and loop.... line = input.readline() @@ -244,7 +235,7 @@ def _genCategoryHTMLFromDict(dict, output): keys.sort() for key in keys: topic = dict[key] - output.write('
  • %s\n' % (topic.context, topic.name)) + output.write(f'
  • {topic.name}\n') def _genOneCategoryHTML(output_dir, cat, title, suffix, *dicts): @@ -271,7 +262,7 @@ def _genCategoryTopic(output_dir, cat, title): ("Modules", "_modules"), ("Objects", "_objects"), ): - output.write('
  • %s\n' % (cat.id, suffix, subtitle)) + output.write(f'
  • {subtitle}\n') output.write("\n") output.close() @@ -302,12 +293,13 @@ def _genItemsFromDict(dict, cat, output, target, do_children=1): output.write( """
  • - + - + - """ - % locals() + """.format( + **locals() + ) ) if not do_children: continue @@ -317,13 +309,12 @@ def _genItemsFromDict(dict, cat, output, target, do_children=1): containees.sort(key=TopicKey) for m in containees: output.write( - """ + f"""
  • - + - + """ - % (m.name, CHM, m.context) ) if len(dict[k].contains) > 0: output.write( @@ -347,13 +338,14 @@ def genTOC(cats, output, title, target):