diff --git a/copyparty/broker_util.py b/copyparty/broker_util.py index ea987200..10c778dc 100644 --- a/copyparty/broker_util.py +++ b/copyparty/broker_util.py @@ -2,7 +2,6 @@ from __future__ import print_function, unicode_literals import argparse -import traceback from queue import Queue diff --git a/copyparty/httpsrv.py b/copyparty/httpsrv.py index 77492d56..cad97e22 100644 --- a/copyparty/httpsrv.py +++ b/copyparty/httpsrv.py @@ -405,7 +405,7 @@ class HttpSrv(object): self.log(self.name, "accept({}): {}".format(fno, ex), c=6) time.sleep(0.02) continue - except TypeError as ex: + except TypeError: # on macOS, accept() may return a None saddr if blocked by LittleSnitch; # unicode(saddr[0]) ==> TypeError: 'NoneType' object is not subscriptable if tcp and not saddr: diff --git a/copyparty/mtag.py b/copyparty/mtag.py index 29750733..9ce02d63 100644 --- a/copyparty/mtag.py +++ b/copyparty/mtag.py @@ -10,7 +10,7 @@ import subprocess as sp import sys import tempfile -from .__init__ import ANYWIN, EXE, PY2, WINDOWS, E, unicode +from .__init__ import ANYWIN, EXE, PY2, WINDOWS, unicode from .authsrv import VFS from .bos import bos from .util import ( diff --git a/copyparty/pwhash.py b/copyparty/pwhash.py index d4455ca8..f9e89290 100644 --- a/copyparty/pwhash.py +++ b/copyparty/pwhash.py @@ -15,7 +15,6 @@ try: raise Exception() HAVE_ARGON2 = True - from argon2 import exceptions as argon2ex except: HAVE_ARGON2 = False diff --git a/copyparty/ssdp.py b/copyparty/ssdp.py index e95bf69e..ad7a545a 100644 --- a/copyparty/ssdp.py +++ b/copyparty/ssdp.py @@ -5,7 +5,6 @@ import errno import re import select import socket -import time from .__init__ import TYPE_CHECKING from .multicast import MC_Sck, MCast diff --git a/copyparty/stolen/dnslib/dns.py b/copyparty/stolen/dnslib/dns.py index deba28f2..04077d4d 100644 --- a/copyparty/stolen/dnslib/dns.py +++ b/copyparty/stolen/dnslib/dns.py @@ -8,7 +8,7 @@ from itertools import chain from .bimap import Bimap, BimapError from .bit import get_bits, set_bits from .buffer import BufferError -from .label import DNSBuffer, DNSLabel, set_avahi_379 +from .label import DNSBuffer, DNSLabel from .ranges import IP4, IP6, H, I, check_bytes diff --git a/copyparty/stolen/ifaddr/_win32.py b/copyparty/stolen/ifaddr/_win32.py index db0d3d40..556fe071 100644 --- a/copyparty/stolen/ifaddr/_win32.py +++ b/copyparty/stolen/ifaddr/_win32.py @@ -5,7 +5,7 @@ import ctypes from ctypes import wintypes if True: # pylint: disable=using-constant-test - from typing import Iterable, List + from typing import Iterable from . import _shared as shared diff --git a/copyparty/svchub.py b/copyparty/svchub.py index 199ccce9..61bd56d1 100644 --- a/copyparty/svchub.py +++ b/copyparty/svchub.py @@ -26,7 +26,7 @@ if True: # pylint: disable=using-constant-test import typing from typing import Any, Optional, Union -from .__init__ import ANYWIN, EXE, MACOS, PY2, TYPE_CHECKING, E, EnvParams, unicode +from .__init__ import ANYWIN, EXE, MACOS, PY2, TYPE_CHECKING, EnvParams, unicode from .authsrv import BAD_CFG, AuthSrv from .bos import bos from .cert import ensure_cert diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 7ae6441b..b299b76a 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -1949,7 +1949,7 @@ class Up2k(object): try: stl = bos.lstat(abspath) st = bos.stat(abspath) if stat.S_ISLNK(stl.st_mode) else stl - except Exception as ex: + except Exception: self.log("missing file: %r" % (abspath,), 3) f404.append((drd, dfn, w)) continue @@ -3058,7 +3058,7 @@ class Up2k(object): ) self.log(t) raise Exception() - except Exception as ex: + except Exception: if n4g: st = NULLSTAT else: diff --git a/copyparty/util.py b/copyparty/util.py index 76b68877..d24a0c99 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -1836,7 +1836,7 @@ class MultipartParser(object): # look for boundary near the end of the buffer n = 0 for n in range(1, len(buf) + 1): - if not buf[-n:] in self.boundary: + if buf[-n:] not in self.boundary: n -= 1 break @@ -3314,7 +3314,7 @@ def guess_mime( if ret.startswith("text/htm"): # avoid serving up HTML content unless there was actually a .html extension ret = "text/plain" - except Exception as ex: + except Exception: pass if not ret: