You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
f-string convert a file
This commit is contained in:
@@ -1,9 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
# Mode: -*- python -*-
|
||||
#
|
||||
# Copyright (c) 2015-2016, 2018, 2020, 2022-2023 by Rocky Bernstein <rb@dustyfeet.com>
|
||||
# Copyright (c) 2015-2016, 2018, 2020, 2022-2024
|
||||
# by Rocky Bernstein <rb@dustyfeet.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
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
|
||||
|
Reference in New Issue
Block a user