diff --git a/deluge/bencode.py b/deluge/bencode.py index 5adbc2ebe..20abf45a4 100644 --- a/deluge/bencode.py +++ b/deluge/bencode.py @@ -81,7 +81,7 @@ decode_func[b'9'] = decode_string def bdecode(x): try: - r, l = decode_func[x[0:1]](x, 0) + r, __ = decode_func[x[0:1]](x, 0) except (IndexError, KeyError, ValueError): raise BTFailure('Not a valid bencoded string') else: diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py index e2e7a86ec..f2b976c75 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py @@ -42,7 +42,7 @@ def raises_errors_as(error): """ try: return func(self, *args, **kwargs) - except: + except Exception: (value, tb) = exc_info()[1:] raise error, value, tb return wrapper diff --git a/deluge/rencode.py b/deluge/rencode.py index d9ac8fb89..4d281942f 100644 --- a/deluge/rencode.py +++ b/deluge/rencode.py @@ -311,10 +311,10 @@ def loads(x, decode_utf8=False): global _decode_utf8 _decode_utf8 = decode_utf8 try: - r, l = decode_func[x[0:1]](x, 0) + r, f = decode_func[x[0:1]](x, 0) except (IndexError, KeyError): raise ValueError - if l != len(x): + if f != len(x): raise ValueError return r diff --git a/deluge/ui/console/modes/cmdline.py b/deluge/ui/console/modes/cmdline.py index 287791a52..02b4e1ad7 100644 --- a/deluge/ui/console/modes/cmdline.py +++ b/deluge/ui/console/modes/cmdline.py @@ -777,20 +777,21 @@ class CmdLine(BaseMode, Commander): possible_matches.append(escaped_name) break else: - l = len(raw_line) + line_len = len(raw_line) # Let's avoid listing all torrents twice if there's no pattern if not empty and torrent_id.startswith(line): # Highlight the matching part - text = '{!info!}%s{!input!}%s - "%s"' % (torrent_id[:l], torrent_id[l:], torrent_name) + text = '{!info!}%s{!input!}%s - "%s"' % ( + torrent_id[:line_len], torrent_id[line_len:], torrent_name) possible_matches.append(text) if torrent_name.startswith(line): text = '{!info!}%s{!input!}%s ({!cyan!}%s{!input!})' % ( - escaped_name[:l], escaped_name[l:], torrent_id) + escaped_name[:line_len], escaped_name[line_len:], torrent_id) possible_matches.append(text) elif torrent_name.lower().startswith(line.lower()): text = '{!info!}%s{!input!}%s ({!cyan!}%s{!input!})' % ( - escaped_name[:l], escaped_name[l:], torrent_id) + escaped_name[:line_len], escaped_name[line_len:], torrent_id) possible_matches2.append(text) return possible_matches + possible_matches2 diff --git a/deluge/ui/console/modes/torrentlist/torrentview.py b/deluge/ui/console/modes/torrentlist/torrentview.py index 7d728da5e..3015faa54 100644 --- a/deluge/ui/console/modes/torrentlist/torrentview.py +++ b/deluge/ui/console/modes/torrentlist/torrentview.py @@ -306,12 +306,12 @@ class TorrentView(InputKeyHandler): todraw = [] # Affected lines are given when changing selected torrent if lines: - for l in lines: - if l < tidx: + for line in lines: + if line < tidx: continue - if l >= (tidx + self.torrent_rows) or l >= self.numtorrents: + if line >= (tidx + self.torrent_rows) or line >= self.numtorrents: break - todraw.append((l, l - self.curoff, draw_row(l))) + todraw.append((line, line - self.curoff, draw_row(line))) else: for i in range(tidx, tidx + self.torrent_rows): if i >= self.numtorrents: diff --git a/msgfmt.py b/msgfmt.py index abe246d73..201c09924 100755 --- a/msgfmt.py +++ b/msgfmt.py @@ -131,56 +131,56 @@ def make(filename, outfile): # Parse the catalog msgid = msgstr = '' lno = 0 - for l in lines: + for line in lines: lno += 1 # If we get a comment line after a msgstr, this is a new entry - if l[0] == '#' and section == section_str: + if line[0] == '#' and section == section_str: add(msgid, msgstr, fuzzy) section = None fuzzy = 0 # Record a fuzzy mark - if l[:2] == '#,' and (l.find('fuzzy') >= 0): + if line[:2] == '#,' and (line.find('fuzzy') >= 0): fuzzy = 1 # Skip comments - if l[0] == '#': + if line[0] == '#': continue # Start of msgid_plural section, separate from singular form with \0 - if l.startswith('msgid_plural'): + if line.startswith('msgid_plural'): msgid += '\x00' - l = l[12:] + line = line[12:] # Now we are in a msgid section, output previous section - elif l.startswith('msgid'): + elif line.startswith('msgid'): if section == section_str: add(msgid, msgstr, fuzzy) section = section_id - l = l[5:] + line = line[5:] msgid = msgstr = '' # Now we are in a msgstr section - elif l.startswith('msgstr'): + elif line.startswith('msgstr'): section = section_str - l = l[6:] + line = line[6:] # Check for plural forms - if l.startswith('['): + if line.startswith('['): # Separate plural forms with \0 - if not l.startswith('[0]'): + if not line.startswith('[0]'): msgstr += '\x00' # Ignore the index - must come in sequence - l = l[l.index(']') + 1:] + line = line[line.index(']') + 1:] # Skip empty lines - l = l.strip() - if not l: + line = line.strip() + if not line: continue - l = ast.literal_eval(l) + line = ast.literal_eval(line) # Python 2 ast.literal_eval returns bytes. - if isinstance(l, bytes): - l = l.decode('utf8') + if isinstance(line, bytes): + line = line.decode('utf8') if section == section_id: - msgid += l + msgid += line elif section == section_str: - msgstr += l + msgstr += line else: print('Syntax error on %s:%d' % (infile, lno), 'before:', file=sys.stderr) - print(l, file=sys.stderr) + print(line, file=sys.stderr) sys.exit(1) # Add last entry if section == section_str: