diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-04-24 01:09:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-24 01:09:46 (GMT) |
commit | 5054459678db1f9737e31b96a859112dbac98c52 (patch) | |
tree | 68abcce9e4295ab2c6c42342345406d0bd3c6006 /Lib/idlelib/pyshell.py | |
parent | 7b2ac6cf3dd33d591d0e14a020c84aa331d29932 (diff) | |
download | cpython-5054459678db1f9737e31b96a859112dbac98c52.zip cpython-5054459678db1f9737e31b96a859112dbac98c52.tar.gz cpython-5054459678db1f9737e31b96a859112dbac98c52.tar.bz2 |
[3.11] gh-103668: Run pyugrade on idlelib (GH-103671) (#103730)
---------
(cherry picked from commit bd2dca035af88694e25fb060f984fbbcda82bed8)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Terry Jan Reedy tjreedy@udel.edu
Diffstat (limited to 'Lib/idlelib/pyshell.py')
-rwxr-xr-x | Lib/idlelib/pyshell.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py index e68233a..bdde156 100755 --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -249,7 +249,7 @@ class PyShellEditorWindow(EditorWindow): breaks = self.breakpoints filename = self.io.filename try: - with open(self.breakpointPath, "r") as fp: + with open(self.breakpointPath) as fp: lines = fp.readlines() except OSError: lines = [] @@ -279,7 +279,7 @@ class PyShellEditorWindow(EditorWindow): if filename is None: return if os.path.isfile(self.breakpointPath): - with open(self.breakpointPath, "r") as fp: + with open(self.breakpointPath) as fp: lines = fp.readlines() for line in lines: if line.startswith(filename + '='): @@ -441,7 +441,7 @@ class ModifiedInterpreter(InteractiveInterpreter): # run from the IDLE source directory. del_exitf = idleConf.GetOption('main', 'General', 'delete-exitfunc', default=False, type='bool') - command = "__import__('idlelib.run').run.main(%r)" % (del_exitf,) + command = f"__import__('idlelib.run').run.main({del_exitf!r})" return [sys.executable] + w + ["-c", command, str(self.port)] def start_subprocess(self): @@ -574,9 +574,9 @@ class ModifiedInterpreter(InteractiveInterpreter): self.runcommand("""if 1: import sys as _sys - _sys.path = %r + _sys.path = {!r} del _sys - \n""" % (path,)) + \n""".format(path)) active_seq = None @@ -703,14 +703,14 @@ class ModifiedInterpreter(InteractiveInterpreter): def prepend_syspath(self, filename): "Prepend sys.path with file's directory if not already included" self.runcommand("""if 1: - _filename = %r + _filename = {!r} import sys as _sys from os.path import dirname as _dirname _dir = _dirname(_filename) if not _dir in _sys.path: _sys.path.insert(0, _dir) del _filename, _sys, _dirname, _dir - \n""" % (filename,)) + \n""".format(filename)) def showsyntaxerror(self, filename=None): """Override Interactive Interpreter method: Use Colorizing @@ -1536,7 +1536,7 @@ def main(): try: opts, args = getopt.getopt(sys.argv[1:], "c:deihnr:st:") except getopt.error as msg: - print("Error: %s\n%s" % (msg, usage_msg), file=sys.stderr) + print(f"Error: {msg}\n{usage_msg}", file=sys.stderr) sys.exit(2) for o, a in opts: if o == '-c': @@ -1668,9 +1668,9 @@ def main(): if cmd or script: shell.interp.runcommand("""if 1: import sys as _sys - _sys.argv = %r + _sys.argv = {!r} del _sys - \n""" % (sys.argv,)) + \n""".format(sys.argv)) if cmd: shell.interp.execsource(cmd) elif script: |