aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/pyside2/PySide2/__init__.py.in5
-rw-r--r--sources/pyside2/PySide2/support/deprecated.py8
-rw-r--r--sources/pyside2/PySide2/support/generate_pyi.py31
-rw-r--r--sources/pyside2/tests/registry/existence_test.py8
-rw-r--r--sources/pyside2/tests/registry/init_platform.py20
-rw-r--r--sources/shiboken6/libshiboken/embed/embedding_generator.py25
-rw-r--r--sources/shiboken6/libshiboken/embed/module_collector.py6
-rw-r--r--sources/shiboken6/libshiboken/embed/signature_bootstrap.py2
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py10
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/importhandler.py4
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/layout.py8
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py3
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py6
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py3
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py6
-rw-r--r--testing/command.py6
-rw-r--r--testing/wheel_tester.py19
17 files changed, 82 insertions, 88 deletions
diff --git a/sources/pyside2/PySide2/__init__.py.in b/sources/pyside2/PySide2/__init__.py.in
index 89c47ae80..f062c284a 100644
--- a/sources/pyside2/PySide2/__init__.py.in
+++ b/sources/pyside2/PySide2/__init__.py.in
@@ -68,7 +68,8 @@ def _setupQtDirectories():
# We now use an explicit function instead of touching a signature.
_init_pyside_extension()
except AttributeError:
- print(dedent('''\
+ stars = 79 * "*"
+ print(dedent(f'''\
{stars}
PySide2/__init__.py: The `signature` module was not initialized.
This libshiboken module was loaded from
@@ -77,7 +78,7 @@ def _setupQtDirectories():
Please make sure that this is the real shiboken6 binary and not just a folder.
{stars}
- ''').format(stars=79*"*", **locals()), file=sys.stderr)
+ '''), file=sys.stderr)
raise
if sys.platform == 'win32':
diff --git a/sources/pyside2/PySide2/support/deprecated.py b/sources/pyside2/PySide2/support/deprecated.py
index 57f33d9e2..af4c18e14 100644
--- a/sources/pyside2/PySide2/support/deprecated.py
+++ b/sources/pyside2/PySide2/support/deprecated.py
@@ -65,14 +65,14 @@ class PySideDeprecationWarningRemovedInQt6(Warning):
def constData(self):
cls = self.__class__
name = cls.__qualname__
- warnings.warn(dedent("""
+ warnings.warn(dedent(f"""
{name}.constData is unpythonic and will be removed in Qt For Python 6.0 .
- Please use {name}.data instead."""
- .format(**locals())), PySideDeprecationWarningRemovedInQt6, stacklevel=2)
+ Please use {name}.data instead."""), PySideDeprecationWarningRemovedInQt6, stacklevel=2)
return cls.data(self)
-def fix_for_QtGui(QtGui):
+# No longer needed but kept for reference.
+def _unused_fix_for_QtGui(QtGui):
for name, cls in QtGui.__dict__.items():
if name.startswith("QMatrix") and "data" in cls.__dict__:
cls.constData = constData
diff --git a/sources/pyside2/PySide2/support/generate_pyi.py b/sources/pyside2/PySide2/support/generate_pyi.py
index 6cca2ebbe..12ad105b9 100644
--- a/sources/pyside2/PySide2/support/generate_pyi.py
+++ b/sources/pyside2/PySide2/support/generate_pyi.py
@@ -122,8 +122,7 @@ class Formatter(Writer):
# this became _way_ too much.
# See also the comment in layout.py .
brace_pat = build_brace_pattern(3)
- pattern = (r"\b Union \s* \[ \s* {brace_pat} \s*, \s* NoneType \s* \]"
- .format(**locals()))
+ pattern = fr"\b Union \s* \[ \s* {brace_pat} \s*, \s* NoneType \s* \]"
replace = r"Optional[\1]"
optional_searcher = re.compile(pattern, flags=re.VERBOSE)
def optional_replacer(source):
@@ -165,9 +164,9 @@ class Formatter(Writer):
self.print()
here = self.outfile.tell()
if self.have_body:
- self.print("{spaces}class {class_str}:".format(**locals()))
+ self.print(f"{spaces}class {class_str}:")
else:
- self.print("{spaces}class {class_str}: ...".format(**locals()))
+ self.print(f"{spaces}class {class_str}: ...")
yield
@contextmanager
@@ -178,7 +177,7 @@ class Formatter(Writer):
spaces = indent * self.level
if type(signature) == type([]):
for sig in signature:
- self.print('{spaces}@typing.overload'.format(**locals()))
+ self.print(f'{spaces}@typing.overload')
self._function(func_name, sig, spaces)
else:
self._function(func_name, signature, spaces)
@@ -188,15 +187,15 @@ class Formatter(Writer):
def _function(self, func_name, signature, spaces):
if "self" not in tuple(signature.parameters.keys()):
- self.print('{spaces}@staticmethod'.format(**locals()))
+ self.print(f'{spaces}@staticmethod')
signature = self.optional_replacer(signature)
- self.print('{spaces}def {func_name}{signature}: ...'.format(**locals()))
+ self.print(f'{spaces}def {func_name}{signature}: ...')
@contextmanager
def enum(self, class_name, enum_name, value):
spaces = indent * self.level
hexval = hex(value)
- self.print("{spaces}{enum_name:25}: {class_name} = ... # {hexval}".format(**locals()))
+ self.print(f"{spaces}{enum_name:25}: {class_name} = ... # {hexval}")
yield
@@ -221,8 +220,7 @@ def generate_pyi(import_name, outpath, options):
top = __import__(import_name)
obj = getattr(top, plainname)
if not getattr(obj, "__file__", None) or os.path.isdir(obj.__file__):
- raise ModuleNotFoundError("We do not accept a namespace as module "
- "{plainname}".format(**locals()))
+ raise ModuleNotFoundError(f"We do not accept a namespace as module {plainname}")
module = sys.modules[import_name]
outfile = io.StringIO()
@@ -232,12 +230,12 @@ def generate_pyi(import_name, outpath, options):
if USE_PEP563:
fmt.print("from __future__ import annotations")
fmt.print()
- fmt.print(dedent('''\
+ fmt.print(dedent(f'''\
"""
This file contains the exact signatures for all functions in module
{import_name}, except for defaults which are replaced by "...".
"""
- '''.format(**locals())))
+ '''))
HintingEnumerator(fmt).module(import_name)
fmt.print()
fmt.print("# eof")
@@ -262,7 +260,7 @@ def generate_pyi(import_name, outpath, options):
wr.print()
else:
wr.print(line)
- logger.info("Generated: {outfilepath}".format(**locals()))
+ logger.info(f"Generated: {outfilepath}")
if is_py3 and (options.check or is_ci):
# Python 3: We can check the file directly if the syntax is ok.
subprocess.check_output([sys.executable, outfilepath])
@@ -292,11 +290,10 @@ def generate_all_pyi(outpath, options):
name_list = PySide2.__all__ if options.modules == ["all"] else options.modules
errors = ", ".join(set(name_list) - set(PySide2.__all__))
if errors:
- raise ImportError("The module(s) '{errors}' do not exist".format(**locals()))
+ raise ImportError(f"The module(s) '{errors}' do not exist")
quirk1, quirk2 = "QtMultimedia", "QtMultimediaWidgets"
if name_list == [quirk1]:
- logger.debug("Note: We must defer building of {quirk1}.pyi until {quirk2} "
- "is available".format(**locals()))
+ logger.debug(f"Note: We must defer building of {quirk1}.pyi until {quirk2} is available")
name_list = []
elif name_list == [quirk2]:
name_list = [quirk1, quirk2]
@@ -322,6 +319,6 @@ if __name__ == "__main__":
outpath = options.outpath
if outpath and not os.path.exists(outpath):
os.makedirs(outpath)
- logger.info("+++ Created path {outpath}".format(**locals()))
+ logger.info(f"+++ Created path {outpath}")
generate_all_pyi(outpath, options=options)
# eof
diff --git a/sources/pyside2/tests/registry/existence_test.py b/sources/pyside2/tests/registry/existence_test.py
index b8a42058d..c8185b140 100644
--- a/sources/pyside2/tests/registry/existence_test.py
+++ b/sources/pyside2/tests/registry/existence_test.py
@@ -115,8 +115,7 @@ except NameError as e:
have_refmodule = False
dict_name = "sig_dict"
if have_refmodule and not hasattr(sig_exists, dict_name):
- print("*** wrong module without '{dict_name}', removed:"
- .format(**locals()), shortpath)
+ print(f"*** wrong module without '{dict_name}', removed: {shortpath}")
os.unlink(effectiveRefPath)
have_refmodule = False
@@ -137,9 +136,8 @@ class TestSignaturesExists(unittest.TestCase):
def multi_signature_msg(key, actual, expect):
len_act = len(actual) if type(actual) is list else 1
len_exp = len(expect) if type(expect) is list else 1
- return ("multi-signature count mismatch for '{key}'. "
- "Actual {len_act} {actual} vs. expected {len_exp} {expect}')"
- .format(**locals()))
+ return (f"multi-signature count mismatch for '{key}'. "
+ f"Actual {len_act} {actual} vs. expected {len_exp} {expect}")
for key, value in sig_exists.sig_dict.items():
name = key.rsplit(".", 1)[-1]
diff --git a/sources/pyside2/tests/registry/init_platform.py b/sources/pyside2/tests/registry/init_platform.py
index 86548d7e5..e4b8d9cc3 100644
--- a/sources/pyside2/tests/registry/init_platform.py
+++ b/sources/pyside2/tests/registry/init_platform.py
@@ -170,16 +170,16 @@ class Formatter(object):
@contextmanager
def module(self, mod_name):
- self.print("")
- self.print("# Module", mod_name)
- self.print("sig_dict.update({")
+ self.print(f"")
+ self.print(f"# Module {mod_name}")
+ self.print(f"sig_dict.update({{")
yield
- self.print(' }}) if "{mod_name}" in sys.modules else None'.format(**locals()))
+ self.print(f' }}) if "{mod_name}" in sys.modules else None')
@contextmanager
def klass(self, class_name, class_str):
self.print()
- self.print("# class {self.mod_name}.{class_name}:".format(**locals()))
+ self.print(f"# class {self.mod_name}.{class_name}:")
yield
@contextmanager
@@ -189,15 +189,15 @@ class Formatter(object):
self.last_level = self.level
class_name = self.class_name
if class_name is None:
- key = viskey = "{self.mod_name}.{func_name}".format(**locals())
+ key = viskey = f"{self.mod_name}.{func_name}"
else:
- key = viskey = "{self.mod_name}.{class_name}.{func_name}".format(**locals())
+ key = viskey = f"{self.mod_name}.{class_name}.{func_name}"
if key.endswith("lY"):
# Some classes like PySide2.QtGui.QContextMenuEvent have functions
# globalX and the same with Y. The gerrit robot thinks that this
# is a badly written "globally". Convince it by hiding this word.
viskey = viskey[:-1] + '""Y'
- self.print(' "{viskey}": {signature},'.format(**locals()))
+ self.print(f' "{viskey}": {signature},')
yield key
@@ -223,7 +223,7 @@ def generate_all():
fmt.print("".join(lines[:license_line + 3]))
version = sys.version.replace('\n', ' ')
build = qt_build()
- fmt.print(dedent('''\
+ fmt.print(dedent(f'''\
"""
This file contains the simplified signatures for all functions in PySide
for module '{module}' using
@@ -236,7 +236,7 @@ def generate_all():
identical for Python 2 and 3. '__div__' is also removed,
since it exists in Python 2, only.
"""
- '''.format(**locals())))
+ '''))
fmt.print("import sys")
fmt.print("")
fmt.print("sig_dict = {}")
diff --git a/sources/shiboken6/libshiboken/embed/embedding_generator.py b/sources/shiboken6/libshiboken/embed/embedding_generator.py
index e7e66d646..1dd17e755 100644
--- a/sources/shiboken6/libshiboken/embed/embedding_generator.py
+++ b/sources/shiboken6/libshiboken/embed/embedding_generator.py
@@ -116,11 +116,11 @@ def create_zipfile(limited_api):
pass # We cannot compile, unless we have folders per Python version
else:
files = ' '.join(fn for fn in os.listdir('.'))
- runpy('-m compileall -q {flag} {files}'.format(**locals()))
+ runpy(f'-m compileall -q {flag} {files}')
files = ' '.join(fn for fn in os.listdir('.') if not fn == zip_name)
- runpy('-m zipfile -c {zip_name} {files}'.format(**locals()))
+ runpy(f'-m zipfile -c {zip_name} {files}')
tmp = tempfile.TemporaryFile(mode="w+")
- runpy('-m base64 {zip_name}'.format(**locals()), stdout=tmp)
+ runpy(f'-m base64 {zip_name}', stdout=tmp)
# now generate the include file
tmp.seek(0)
with open(inc_name, "w") as inc:
@@ -158,9 +158,9 @@ def _embed_file(fin, fout):
comma = "," if block else ""
block += 1
print(file=fout)
- print('/* Block {block} of {blocks} */{comma}'.format(**locals()), file=fout)
- print('\"{}\"'.format(line.strip()), file=fout)
- print('/* Sentinel */, \"\"', file=fout)
+ print(f'/* Block {block} of {blocks} */{comma}', file=fout)
+ print(f'\"{line.strip()}\"', file=fout)
+ print(f'/* Sentinel */, \"\"', file=fout)
def _embed_bytefile(fin, fout, is_text):
@@ -171,13 +171,13 @@ def _embed_bytefile(fin, fout, is_text):
fname = fin.name
remark = ("No .pyc file because '--LIMITED-API=yes'" if is_text else
"The .pyc header is stripped away")
- print(textwrap.dedent("""
+ print(textwrap.dedent(f"""
/*
* This is the file "{fname}" as a simple byte array.
* It can be directly embedded without any further processing.
* {remark}.
*/
- """).format(**locals()).strip(), file=fout)
+ """), file=fout)
headsize = ( 0 if is_text else
16 if sys.version_info >= (3, 7) else 12 if sys.version_info >= (3, 3) else 8)
binstr = fin.read()[headsize:]
@@ -187,13 +187,13 @@ def _embed_bytefile(fin, fout, is_text):
except SyntaxError as e:
print(e)
traceback.print_exc(file=sys.stdout)
- print(textwrap.dedent("""
+ print(textwrap.dedent(f"""
*************************************************************************
***
*** Could not compile the boot loader '{fname}'!
***
*************************************************************************
- """).format(version=sys.version_info[:3], **locals()))
+ """))
raise SystemError
else:
try:
@@ -201,14 +201,15 @@ def _embed_bytefile(fin, fout, is_text):
except ValueError as e:
print(e)
traceback.print_exc(file=sys.stdout)
- print(textwrap.dedent("""
+ version = sys.version_info[:3]
+ print(textwrap.dedent(f"""
*************************************************************************
***
*** This Python version {version} seems to have a new .pyc header size.
*** Please correct the 'headsize' constant ({headsize}).
***
*************************************************************************
- """).format(version=sys.version_info[:3], **locals()))
+ """))
raise SystemError
print(file=fout)
diff --git a/sources/shiboken6/libshiboken/embed/module_collector.py b/sources/shiboken6/libshiboken/embed/module_collector.py
index 3eaa0be5d..c3a878aa1 100644
--- a/sources/shiboken6/libshiboken/embed/module_collector.py
+++ b/sources/shiboken6/libshiboken/embed/module_collector.py
@@ -69,7 +69,7 @@ def source_archive(module, modname):
# Do not use: Some modules rename themselves!
version = ".".join(map(str, sys.version_info[:3]))
shortname = os.path.basename(fname)
- preamble = dedent(r"""
+ preamble = dedent(fr"""
# BEGIN SOURCE ARCHIVE Python {version} module {modname}
sources = {{}} if "sources" not in globals() else sources
@@ -77,7 +77,7 @@ def source_archive(module, modname):
{encoded}'''.replace("(triple_single)", "'''")
# END SOURCE ARCHIVE Python {version} module {modname}
- """).format(**locals())
+ """)
return preamble
def read_all(modules):
@@ -100,6 +100,6 @@ if __name__ == "__main__":
ret = license_header() + read_all(args.modules)
ma_mi = "_".join(map(str, sys.version_info[:2]))
outpath = os.path.join(os.path.dirname(__file__), "..", "..", "shibokenmodule",
- "files.dir", "shibokensupport", "python_minilib_{ma_mi}.py".format(**locals()))
+ "files.dir", "shibokensupport", f"python_minilib_{ma_mi}.py")
with open(outpath, "w") as f:
f.write(ret)
diff --git a/sources/shiboken6/libshiboken/embed/signature_bootstrap.py b/sources/shiboken6/libshiboken/embed/signature_bootstrap.py
index c659cc8d8..08928e915 100644
--- a/sources/shiboken6/libshiboken/embed/signature_bootstrap.py
+++ b/sources/shiboken6/libshiboken/embed/signature_bootstrap.py
@@ -143,7 +143,7 @@ def bootstrap():
os.remove(support_path)
except OSError as e:
print(e)
- print("Error deleting {support_path}, ignored".format(**locals()))
+ print(f"Error deleting {support_path}, ignored")
return loader
# New functionality: Loading from a zip archive.
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py
index 8ddb75c19..df7a0bca8 100644
--- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py
+++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py
@@ -111,21 +111,21 @@ def seterror_argument(args, func_name):
# temp!
found = matched_type(args, sigs)
if found:
- msg = dedent("""
+ msg = dedent(f"""
'{func_name}' called with wrong argument values:
{func_name}{args}
Found signature:
{func_name}{found}
- """.format(**locals())).strip()
+ """).strip()
return ValueError, msg
type_str = ", ".join(type(arg).__name__ for arg in args)
- msg = dedent("""
+ msg = dedent(f"""
'{func_name}' called with wrong argument types:
{func_name}({type_str})
Supported signatures:
- """.format(**locals())).strip()
+ """).strip()
for sig in sigs:
- msg += "\n {func_name}{sig}".format(**locals())
+ msg += f"\n {func_name}{sig}"
# We don't raise the error here, to avoid the loader in the traceback.
return TypeError, msg
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/importhandler.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/importhandler.py
index 7af43bea0..3dbc2e011 100644
--- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/importhandler.py
+++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/importhandler.py
@@ -72,8 +72,8 @@ def finish_import(module):
except Exception as e:
name = e.__class__.__qualname__
print(72 * "*")
- print("Error in deprecated.py, ignored:")
- print(" {name}: {e}".format(**locals()))
+ print(f"Error in deprecated.py, ignored:")
+ print(f" {name}: {e}")
"""
A note for people who might think this could be written in pure Python:
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/layout.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/layout.py
index 51ce60bfa..90ea07f1b 100644
--- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/layout.py
+++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/layout.py
@@ -102,18 +102,18 @@ class SignatureLayout(SimpleNamespace):
def _attributeerror(self, err_keys):
err_keys = ", ".join(err_keys)
allowed_keys = ", ".join(self.allowed_keys.__dict__.keys())
- raise AttributeError(dedent("""\
+ raise AttributeError(dedent(f"""\
Not allowed: '{err_keys}'.
The only allowed keywords are '{allowed_keys}'.
- """.format(**locals())))
+ """))
def _valueerror(self, err_values):
err_values = ", ".join(map(str, err_values))
allowed_values = ", ".join(map(str, self.allowed_values))
- raise ValueError(dedent("""\
+ raise ValueError(dedent(f"""\
Not allowed: '{err_values}'.
The only allowed values are '{allowed_values}'.
- """.format(**locals())))
+ """))
# The following names are used literally in this module.
# This way, we avoid the dict hashing problem.
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
index 371b3ca4a..dcbdd657c 100644
--- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
+++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
@@ -147,8 +147,7 @@ class ExactEnumerator(object):
if klass == subclass:
# this is a side effect of the typing module for Python 2.7
# via the "._gorg" property, which we can safely ignore.
- print("Warning: {class_name} points to itself via {subclass_name}, skipped!"
- .format(**locals()))
+ print(f"Warning: {class_name} points to itself via {subclass_name}, skipped!")
continue
ret.update(self.klass(subclass_name, subclass))
self.fmt.class_name = class_name
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py
index 24e75e42c..6d72fa5db 100644
--- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py
+++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py
@@ -106,8 +106,8 @@ def build_brace_pattern(level, separators=""):
ro, rc, so, sc, co, cc, ao, ac, separators, qu, bs, all = map(
escape, (ro, rc, so, sc, co, cc, ao, ac, separators, qu, bs, all))
- no_brace_sep_q = r"[^{all}{separators}{qu}{bs}]".format(**locals())
- no_quote = r"(?: [^{qu}{bs}] | {bs}. )*".format(**locals())
+ no_brace_sep_q = fr"[^{all}{separators}{qu}{bs}]"
+ no_quote = fr"(?: [^{qu}{bs}] | {bs}. )*"
pattern = dedent(r"""
(
(?: {__} {no_brace_sep_q}
@@ -119,7 +119,7 @@ def build_brace_pattern(level, separators=""):
)+
)
""")
- no_braces_q = "[^{all}{qu}{bs}]*".format(**locals())
+ no_braces_q = f"[^{all}{qu}{bs}]*"
repeated = dedent(r"""
{indent} (?: {__} {no_braces_q}
{indent} | {qu} {no_quote} {qu}
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
index c043b8435..43be5b95f 100644
--- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
+++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
@@ -217,8 +217,7 @@ def check_module(mod):
# without enforcing an '__init__.py'.
if not Reloader.module_valid(mod):
mod_name = mod.__name__
- raise ImportError("Module '{mod_name}' is not a binary module!"
- .format(**locals()))
+ raise ImportError(f"Module '{mod_name}' is not a binary module!")
update_mapping = Reloader().update
type_map = {}
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py
index 20c791cc1..6bf78cf95 100644
--- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py
+++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py
@@ -235,7 +235,7 @@ matrix_pattern = "PySide2.QtGui.QGenericMatrix"
def handle_matrix(arg):
n, m, typstr = tuple(map(lambda x:x.strip(), arg.split(",")))
assert typstr == "float"
- result = "PySide2.QtGui.QMatrix{n}x{m}".format(**locals())
+ result = f"PySide2.QtGui.QMatrix{n}x{m}"
return eval(result, namespace)
@@ -245,7 +245,7 @@ from inspect import currentframe
def lno(level):
lineno = currentframe().f_back.f_lineno
spaces = level * " "
- return "{lineno}{spaces}".format(**locals())
+ return f"{lineno}{spaces}"
"""
@@ -276,7 +276,7 @@ def _resolve_type(thing, line, level, var_handler):
part = repr(part)
pieces.append(to_string(part))
thing = ", ".join(pieces)
- result = "{contr}[{thing}]".format(**locals())
+ result = f"{contr}[{thing}]"
return eval(result, namespace)
return _resolve_value(thing, None, line)
diff --git a/testing/command.py b/testing/command.py
index d56d2509e..d6f814a34 100644
--- a/testing/command.py
+++ b/testing/command.py
@@ -130,7 +130,7 @@ def test_project(project, args, blacklist, runs):
res = item.rich_result
sharp = "#" + str(item.sharp)
mod_name = decorate(item.mod_name)
- print("RES {index}: Test {sharp:>4}: {res:<6} {mod_name}()".format(**locals()))
+ print(f"RES {index}: Test {sharp:>4}: {res:<6} {mod_name}()")
r[0] += 1 if res == "PASS" else 0
r[1] += 1 if res == "FAIL!" else 0
r[2] += 1 if res == "SKIPPED" else 0 # not yet supported
@@ -146,7 +146,7 @@ def test_project(project, args, blacklist, runs):
"{} passed, {} failed, {} skipped, {} blacklisted, {} bpassed."
.format(*r))
print()
- print("********* Finished testing of %s *********" % project)
+ print(f"********* Finished testing of {project} *********")
print()
ret.append(r)
if fatal:
@@ -202,7 +202,7 @@ def main():
try:
builds.set_buildno(args.buildno)
except IndexError:
- print("history out of range. Try '%s list'" % __file__)
+ print(f"history out of range. Try '{__file__} list'")
sys.exit(1)
if args.subparser_name == "getcwd":
diff --git a/testing/wheel_tester.py b/testing/wheel_tester.py
index 4339d7e95..e911913da 100644
--- a/testing/wheel_tester.py
+++ b/testing/wheel_tester.py
@@ -150,18 +150,17 @@ def try_install_wheels(wheels_dir, py_version):
log.info("")
for p in package_prefix_names():
- log.info("Trying to install {p}:".format(**locals()))
+ log.info(f"Trying to install {p}:")
pattern = "{}-*cp{}*.whl".format(p, int(float(py_version)))
files = find_files_using_glob(wheels_dir, pattern)
if files and len(files) == 1:
wheel_path = files[0]
install_wheel(wheel_path)
elif len(files) > 1:
- raise RuntimeError("More than one wheel found for specific {p} version."
- .format(**locals()))
+ raise RuntimeError(f"More than one wheel found for specific {p} version.")
else:
- raise RuntimeError("No {p} wheels compatible with Python {py_version} found "
- "for testing.".format(**locals()))
+ raise RuntimeError(f"No {p} wheels compatible with Python {py_version} found "
+ f"for testing.")
def is_unix():
@@ -200,13 +199,13 @@ def generate_build_qmake():
def raise_error_pyinstaller(msg):
print()
- print("PYINST: {msg}".format(**locals()))
- print("PYINST: sys.version = {}".format(sys.version.splitlines()[0]))
- print("PYINST: platform.platform() = {}".format(platform.platform()))
- print("PYINST: See the error message above.")
+ print(f"PYINST: {msg}")
+ print(f"PYINST: sys.version = {sys.version.splitlines()[0]}")
+ print(f"PYINST: platform.platform() = {platform.platform()}")
+ print(f"PYINST: See the error message above.")
print()
for line in run_process_output([sys.executable, "-m", "pip", "list"]):
- print("PyInstaller pip list: ", line)
+ print(f"PyInstaller pip list: {line}")
print()
raise(RuntimeError(msg))