mirror of
https://github.com/9001/copyparty.git
synced 2025-10-02 14:42:28 -06:00
more ruff check fixes
This commit is contained in:
parent
506a448a19
commit
9a07d1dd80
|
@ -2,7 +2,6 @@
|
||||||
from __future__ import print_function, unicode_literals
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import traceback
|
|
||||||
|
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
|
|
||||||
|
|
|
@ -405,7 +405,7 @@ class HttpSrv(object):
|
||||||
self.log(self.name, "accept({}): {}".format(fno, ex), c=6)
|
self.log(self.name, "accept({}): {}".format(fno, ex), c=6)
|
||||||
time.sleep(0.02)
|
time.sleep(0.02)
|
||||||
continue
|
continue
|
||||||
except TypeError as ex:
|
except TypeError:
|
||||||
# on macOS, accept() may return a None saddr if blocked by LittleSnitch;
|
# on macOS, accept() may return a None saddr if blocked by LittleSnitch;
|
||||||
# unicode(saddr[0]) ==> TypeError: 'NoneType' object is not subscriptable
|
# unicode(saddr[0]) ==> TypeError: 'NoneType' object is not subscriptable
|
||||||
if tcp and not saddr:
|
if tcp and not saddr:
|
||||||
|
|
|
@ -10,7 +10,7 @@ import subprocess as sp
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from .__init__ import ANYWIN, EXE, PY2, WINDOWS, E, unicode
|
from .__init__ import ANYWIN, EXE, PY2, WINDOWS, unicode
|
||||||
from .authsrv import VFS
|
from .authsrv import VFS
|
||||||
from .bos import bos
|
from .bos import bos
|
||||||
from .util import (
|
from .util import (
|
||||||
|
|
|
@ -15,7 +15,6 @@ try:
|
||||||
raise Exception()
|
raise Exception()
|
||||||
|
|
||||||
HAVE_ARGON2 = True
|
HAVE_ARGON2 = True
|
||||||
from argon2 import exceptions as argon2ex
|
|
||||||
except:
|
except:
|
||||||
HAVE_ARGON2 = False
|
HAVE_ARGON2 = False
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import errno
|
||||||
import re
|
import re
|
||||||
import select
|
import select
|
||||||
import socket
|
import socket
|
||||||
import time
|
|
||||||
|
|
||||||
from .__init__ import TYPE_CHECKING
|
from .__init__ import TYPE_CHECKING
|
||||||
from .multicast import MC_Sck, MCast
|
from .multicast import MC_Sck, MCast
|
||||||
|
|
|
@ -8,7 +8,7 @@ from itertools import chain
|
||||||
from .bimap import Bimap, BimapError
|
from .bimap import Bimap, BimapError
|
||||||
from .bit import get_bits, set_bits
|
from .bit import get_bits, set_bits
|
||||||
from .buffer import BufferError
|
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
|
from .ranges import IP4, IP6, H, I, check_bytes
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import ctypes
|
||||||
from ctypes import wintypes
|
from ctypes import wintypes
|
||||||
|
|
||||||
if True: # pylint: disable=using-constant-test
|
if True: # pylint: disable=using-constant-test
|
||||||
from typing import Iterable, List
|
from typing import Iterable
|
||||||
|
|
||||||
from . import _shared as shared
|
from . import _shared as shared
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ if True: # pylint: disable=using-constant-test
|
||||||
import typing
|
import typing
|
||||||
from typing import Any, Optional, Union
|
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 .authsrv import BAD_CFG, AuthSrv
|
||||||
from .bos import bos
|
from .bos import bos
|
||||||
from .cert import ensure_cert
|
from .cert import ensure_cert
|
||||||
|
|
|
@ -1949,7 +1949,7 @@ class Up2k(object):
|
||||||
try:
|
try:
|
||||||
stl = bos.lstat(abspath)
|
stl = bos.lstat(abspath)
|
||||||
st = bos.stat(abspath) if stat.S_ISLNK(stl.st_mode) else stl
|
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)
|
self.log("missing file: %r" % (abspath,), 3)
|
||||||
f404.append((drd, dfn, w))
|
f404.append((drd, dfn, w))
|
||||||
continue
|
continue
|
||||||
|
@ -3058,7 +3058,7 @@ class Up2k(object):
|
||||||
)
|
)
|
||||||
self.log(t)
|
self.log(t)
|
||||||
raise Exception()
|
raise Exception()
|
||||||
except Exception as ex:
|
except Exception:
|
||||||
if n4g:
|
if n4g:
|
||||||
st = NULLSTAT
|
st = NULLSTAT
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1836,7 +1836,7 @@ class MultipartParser(object):
|
||||||
# look for boundary near the end of the buffer
|
# look for boundary near the end of the buffer
|
||||||
n = 0
|
n = 0
|
||||||
for n in range(1, len(buf) + 1):
|
for n in range(1, len(buf) + 1):
|
||||||
if not buf[-n:] in self.boundary:
|
if buf[-n:] not in self.boundary:
|
||||||
n -= 1
|
n -= 1
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -3314,7 +3314,7 @@ def guess_mime(
|
||||||
if ret.startswith("text/htm"):
|
if ret.startswith("text/htm"):
|
||||||
# avoid serving up HTML content unless there was actually a .html extension
|
# avoid serving up HTML content unless there was actually a .html extension
|
||||||
ret = "text/plain"
|
ret = "text/plain"
|
||||||
except Exception as ex:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not ret:
|
if not ret:
|
||||||
|
|
Loading…
Reference in a new issue