From 33bc80bb2414151b4c4dc0ee7bfbd6b615b9870b Mon Sep 17 00:00:00 2001 From: rocky Date: Mon, 5 Feb 2024 16:26:59 -0500 Subject: [PATCH] f-string convert a file --- uncompyle6/bin/pydisassemble.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/uncompyle6/bin/pydisassemble.py b/uncompyle6/bin/pydisassemble.py index 29481ad1..e40e0dfc 100755 --- a/uncompyle6/bin/pydisassemble.py +++ b/uncompyle6/bin/pydisassemble.py @@ -1,9 +1,21 @@ #!/usr/bin/env python -# Mode: -*- python -*- # -# Copyright (c) 2015-2016, 2018, 2020, 2022-2023 by Rocky Bernstein +# Copyright (c) 2015-2016, 2018, 2020, 2022-2024 +# by Rocky Bernstein +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -from __future__ import print_function import getopt import os @@ -52,9 +64,8 @@ PATTERNS = ("*.pyc", "*.pyo") def main(): usage_short = ( - """usage: %s FILE... + f"""usage: {program} FILE... Type -h for for full help.""" - % program ) if len(sys.argv) == 1: @@ -67,7 +78,7 @@ Type -h for for full help.""" sys.argv[1:], "hVU", ["help", "version", "uncompyle6"] ) except getopt.GetoptError as e: - print("%s: %s" % (os.path.basename(sys.argv[0]), e), file=sys.stderr) + print(f"{os.path.basename(sys.argv[0])}: {e}", file=sys.stderr) sys.exit(-1) for opt, val in opts: @@ -75,7 +86,7 @@ Type -h for for full help.""" print(__doc__) sys.exit(1) elif opt in ("-V", "--version"): - print("%s %s" % (program, __version__)) + print(f"{program} {__version__}") sys.exit(0) else: print(opt) @@ -86,7 +97,7 @@ Type -h for for full help.""" if os.path.exists(files[0]): disassemble_file(file, sys.stdout) else: - print("Can't read %s - skipping" % files[0], file=sys.stderr) + print(f"Can't read {files[0]} - skipping", file=sys.stderr) pass pass return