Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Lib/_py_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,6 @@ def warn_explicit(message, category, filename, lineno,
else:
text = message
message = category(message)
modules = None
key = (text, category, lineno)
with _wm._lock:
if registry is None:
Expand Down
2 changes: 1 addition & 1 deletion Lib/_threading_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def thread_deleted(_, idt=idt):
# as soon as the OS-level thread ends instead.
local = wrlocal()
if local is not None:
dct = local.dicts.pop(idt)
local.dicts.pop(idt)
wrlocal = ref(self, local_deleted)
wrthread = ref(thread, thread_deleted)
thread.__dict__[key] = wrlocal
Expand Down
4 changes: 2 additions & 2 deletions Lib/asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ async def sock_sendfile(self, sock, file, offset=0, count=None,
try:
return await self._sock_sendfile_native(sock, file,
offset, count)
except exceptions.SendfileNotAvailableError as exc:
except exceptions.SendfileNotAvailableError:
if not fallback:
raise
return await self._sock_sendfile_fallback(sock, file,
Expand Down Expand Up @@ -1270,7 +1270,7 @@ async def sendfile(self, transport, file, offset=0, count=None,
try:
return await self._sendfile_native(transport, file,
offset, count)
except exceptions.SendfileNotAvailableError as exc:
except exceptions.SendfileNotAvailableError:
if not fallback:
raise

Expand Down
2 changes: 1 addition & 1 deletion Lib/asyncio/proactor_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ async def sock_accept(self, sock):
async def _sock_sendfile_native(self, sock, file, offset, count):
try:
fileno = file.fileno()
except (AttributeError, io.UnsupportedOperation) as err:
except (AttributeError, io.UnsupportedOperation):
raise exceptions.SendfileNotAvailableError("not a regular file")
try:
fsize = os.fstat(fileno).st_size
Expand Down
2 changes: 1 addition & 1 deletion Lib/asyncio/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def _get_awaited_by_tasks(pid: int) -> list:
e = e.__context__
print(f"Error retrieving tasks: {e}")
sys.exit(1)
except PermissionError as e:
except PermissionError:
exit_with_permission_help_text()


Expand Down
2 changes: 1 addition & 1 deletion Lib/asyncio/unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ async def _sock_sendfile_native(self, sock, file, offset, count):
"os.sendfile() is not available")
try:
fileno = file.fileno()
except (AttributeError, io.UnsupportedOperation) as err:
except (AttributeError, io.UnsupportedOperation):
raise exceptions.SendfileNotAvailableError("not a regular file")
try:
fsize = os.fstat(fileno).st_size
Expand Down
4 changes: 2 additions & 2 deletions Lib/codeop.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ def _maybe_compile(compiler, source, filename, symbol, flags):
try:
compiler(source + "\n", filename, symbol, flags=flags)
return None
except _IncompleteInputError as e:
except _IncompleteInputError:
return None
except SyntaxError as e:
except SyntaxError:
pass
# fallthrough

Expand Down
2 changes: 1 addition & 1 deletion Lib/compileall.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def compile_file(fullname, ddir=None, force=False, rx=None, quiet=0,
cfile = importlib.util.cache_from_source(fullname)
opt_cfiles[opt_level] = cfile

head, tail = name[:-3], name[-3:]
tail = name[-3:]
if tail == '.py':
if not force:
try:
Expand Down
6 changes: 3 additions & 3 deletions Lib/concurrent/interpreters/_queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def put(self, obj, block=True, timeout=None, *,
while True:
try:
_queues.put(self._id, obj, unboundop)
except QueueFull as exc:
except QueueFull:
if timeout is not None and time.time() >= end:
raise # re-raise
time.sleep(_delay)
Expand Down Expand Up @@ -258,7 +258,7 @@ def get(self, block=True, timeout=None, *,
while True:
try:
obj, unboundop = _queues.get(self._id)
except QueueEmpty as exc:
except QueueEmpty:
if timeout is not None and time.time() >= end:
raise # re-raise
time.sleep(_delay)
Expand All @@ -277,7 +277,7 @@ def get_nowait(self):
"""
try:
obj, unboundop = _queues.get(self._id)
except QueueEmpty as exc:
except QueueEmpty:
raise # re-raise
if unboundop is not None:
assert obj is None, repr(obj)
Expand Down
1 change: 0 additions & 1 deletion Lib/dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,6 @@ def print_instruction_line(self, instr, mark_as_current):
fields.append(instr.opname.ljust(_OPNAME_WIDTH))
# Column: Opcode argument
if instr.arg is not None:
arg = repr(instr.arg)
# If opname is longer than _OPNAME_WIDTH, we allow it to overflow into
# the space reserved for oparg. This results in fewer misaligned opargs
# in the disassembly output.
Expand Down
2 changes: 1 addition & 1 deletion Lib/encodings/uu_codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def uu_decode(input, errors='strict'):
break
try:
data = binascii.a2b_uu(s)
except binascii.Error as v:
except binascii.Error:
# Workaround for broken uuencoders by /Fredrik Lundh
nbytes = (((s[0]-32) & 63) * 4 + 5) // 3
data = binascii.a2b_uu(s[:nbytes])
Expand Down
8 changes: 4 additions & 4 deletions Lib/ftplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ def makeport(self):
port = sock.getsockname()[1] # Get proper port
host = self.sock.getsockname()[0] # Get proper host
if self.af == socket.AF_INET:
resp = self.sendport(host, port)
self.sendport(host, port)
else:
resp = self.sendeprt(host, port)
self.sendeprt(host, port)
if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT:
sock.settimeout(self.timeout)
return sock
Expand Down Expand Up @@ -455,7 +455,7 @@ def retrlines(self, cmd, callback = None):
"""
if callback is None:
callback = print_line
resp = self.sendcmd('TYPE A')
self.sendcmd('TYPE A')
with self.transfercmd(cmd) as conn, \
conn.makefile('r', encoding=self.encoding) as fp:
while 1:
Expand Down Expand Up @@ -951,7 +951,7 @@ def test():
elif file[:2] == '-d':
cmd = 'CWD'
if file[2:]: cmd = cmd + ' ' + file[2:]
resp = ftp.sendcmd(cmd)
ftp.sendcmd(cmd)
elif file == '-p':
ftp.set_pasv(not ftp.passiveserver)
else:
Expand Down
2 changes: 1 addition & 1 deletion Lib/functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ def wrapper(*args, **kwds):
# still adjusting the links.
root = oldroot[NEXT]
oldkey = root[KEY]
oldresult = root[RESULT]
oldresult = root[RESULT] # noqa: F841
root[KEY] = root[RESULT] = None

# Now update the cache dictionary.
Expand Down
1 change: 0 additions & 1 deletion Lib/idlelib/pyshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ def restart_subprocess(self, with_cwd=False, filename=''):
self.rpcclt.close()
self.terminate_subprocess()
console = self.tkconsole
was_executing = console.executing
console.executing = False
self.spawn_subprocess()
try:
Expand Down
4 changes: 2 additions & 2 deletions Lib/idlelib/textview.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ def __init__(self, parent, title, contents, modal=True, wrap=WORD,
self.title(title)
self.viewframe = ViewFrame(self, contents, wrap=wrap)
self.protocol("WM_DELETE_WINDOW", self.ok)
self.button_ok = button_ok = Button(self, text='Close',
command=self.ok, takefocus=False)
self.button_ok = Button(self, text='Close',
command=self.ok, takefocus=False)
self.viewframe.pack(side='top', expand=True, fill='both')

self.is_modal = modal
Expand Down
6 changes: 3 additions & 3 deletions Lib/imaplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ def proxyauth(self, user):
"""

name = 'PROXYAUTH'
return self._simple_command('PROXYAUTH', user)
return self._simple_command(name, user)


def rename(self, oldmailbox, newmailbox):
Expand Down Expand Up @@ -1310,7 +1310,7 @@ def _get_tagged_response(self, tag, expect_bye=False):

try:
self._get_response()
except self.abort as val:
except self.abort:
if __debug__:
if self.debug >= 1:
self.print_log()
Expand Down Expand Up @@ -1867,7 +1867,7 @@ def Time2Internaldate(date_time):

try:
optlist, args = getopt.getopt(sys.argv[1:], 'd:s:')
except getopt.error as val:
except getopt.error:
optlist, args = (), ()

stream_command = None
Expand Down
1 change: 0 additions & 1 deletion Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2140,7 +2140,6 @@ def _signature_strip_non_python_syntax(signature):

current_parameter = 0
OP = token.OP
ERRORTOKEN = token.ERRORTOKEN

# token stream always starts with ENCODING token, skip it
t = next(token_stream)
Expand Down
1 change: 0 additions & 1 deletion Lib/modulefinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ def scan_opcodes(self, co):
yield "relative_import", (level, fromlist, name)

def scan_code(self, co, m):
code = co.co_code
scanner = self.scan_opcodes
for what, args in scanner(co):
if what == "store":
Expand Down
3 changes: 1 addition & 2 deletions Lib/multiprocessing/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,7 @@ def accept(self):
# written data and then disconnected -- see Issue 14725.
else:
try:
res = _winapi.WaitForMultipleObjects(
[ov.event], False, INFINITE)
_winapi.WaitForMultipleObjects([ov.event], False, INFINITE)
except:
ov.cancel()
_winapi.CloseHandle(handle)
Expand Down
2 changes: 1 addition & 1 deletion Lib/netrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def _parse(self, file, fp, default_netrc):
while 1:
# Look for a machine, default, or macdef top-level keyword
saved_lineno = lexer.lineno
toplevel = tt = lexer.get_token()
tt = lexer.get_token()
if not tt:
break
elif tt[0] == '#':
Expand Down
2 changes: 1 addition & 1 deletion Lib/ntpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ def realpath(path, /, *, strict=False):
try:
if _getfinalpathname(spath) == path:
path = spath
except ValueError as ex:
except ValueError:
# Unexpected, as an invalid path should not have gained a prefix
# at any point, but we ignore this error just in case.
pass
Expand Down
2 changes: 1 addition & 1 deletion Lib/optparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ def parse_args(self, args=None, values=None):
self.values = values

try:
stop = self._process_args(largs, rargs, values)
self._process_args(largs, rargs, values)
except (BadOptionError, OptionValueError) as err:
self.error(str(err))

Expand Down
5 changes: 2 additions & 3 deletions Lib/pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,6 @@ def save_frozenset(self, obj):

def save_global(self, obj, name=None):
write = self.write
memo = self.memo

if name is None:
name = getattr(obj, '__qualname__', None)
Expand Down Expand Up @@ -1734,7 +1733,7 @@ def load_binget(self):
i = self.read(1)[0]
try:
self.append(self.memo[i])
except KeyError as exc:
except KeyError:
msg = f'Memo value not found at index {i}'
raise UnpicklingError(msg) from None
dispatch[BINGET[0]] = load_binget
Expand All @@ -1743,7 +1742,7 @@ def load_long_binget(self):
i, = unpack('<I', self.read(4))
try:
self.append(self.memo[i])
except KeyError as exc:
except KeyError:
msg = f'Memo value not found at index {i}'
raise UnpicklingError(msg) from None
dispatch[LONG_BINGET[0]] = load_long_binget
Expand Down
3 changes: 1 addition & 2 deletions Lib/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,7 @@ def _syscmd_ver(system='', release='', version='',
text=True,
encoding="locale",
shell=True)
except (OSError, subprocess.CalledProcessError) as why:
#print('Command %s failed: %s' % (cmd, why))
except (OSError, subprocess.CalledProcessError):
continue
else:
break
Expand Down
1 change: 0 additions & 1 deletion Lib/pyclbr.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ def _readmodule(module, path, inpackage=None):
return _readmodule(submodule, parent['__path__'], package)

# Search the path for the module.
f = None
if inpackage is not None:
search_path = path
else:
Expand Down
1 change: 0 additions & 1 deletion Lib/re/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ def _parse_sub(source, state, verbose, nested):
items = []
itemsappend = items.append
sourcematch = source.match
start = source.tell()
while True:
itemsappend(_parse(source, state, verbose, nested + 1,
not nested and not items))
Expand Down
2 changes: 1 addition & 1 deletion Lib/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ def communicate(self, input=None, timeout=None):
finally:
self._communication_started = True
try:
sts = self.wait(timeout=self._remaining_time(endtime))
self.wait(timeout=self._remaining_time(endtime))
except TimeoutExpired as exc:
exc.timeout = timeout
raise
Expand Down
2 changes: 1 addition & 1 deletion Lib/tempfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ def opener(*args):
fd, name = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
try:
_os.unlink(name)
except BaseException as e:
except BaseException:
_os.close(fd)
raise
return fd
Expand Down
2 changes: 1 addition & 1 deletion Lib/tokenize.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def find_cookie(line):
return None
encoding = _get_normal_name(match.group(1).decode())
try:
codec = lookup(encoding)
lookup(encoding)
except LookupError:
# This behaviour mimics the Python interpreter
if filename is None:
Expand Down
4 changes: 2 additions & 2 deletions Lib/turtle.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ def _iscolorstring(self, color):
"""Check if the string color is a legal Tkinter color string.
"""
try:
rgb = self.cv.winfo_rgb(color)
self.cv.winfo_rgb(color)
ok = True
except TK.TclError:
ok = False
Expand Down Expand Up @@ -3747,7 +3747,7 @@ def _undo(self, action, data):
if action == "rot":
angle, degPAU = data
self._rotate(-angle*degPAU/self._degreesPerAU)
dummy = self.undobuffer.pop()
self.undobuffer.pop()
elif action == "stamp":
stitem = data[0]
self.clearstamp(stitem)
Expand Down
2 changes: 1 addition & 1 deletion Lib/urllib/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ def urlencode(query, doseq=False, safe='', encoding=None, errors=None,
else:
try:
# Is this a sufficient test for sequence-ness?
x = len(v)
len(v)
except TypeError:
# not a sequence
v = quote_via(str(v), safe, encoding, errors)
Expand Down
1 change: 0 additions & 1 deletion Lib/venv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ def setup_python(self, context):
binpath = context.bin_path
path = context.env_exe
copier = self.symlink_or_copy
dirname = context.python_dir
copier(context.executable, path)
if not os.path.islink(path):
os.chmod(path, 0o755)
Expand Down
Loading