mirror of
https://github.com/9001/copyparty.git
synced 2026-01-12 07:44:08 -07:00
linter denoise
This commit is contained in:
parent
ec7ea30951
commit
3ee91dffad
|
|
@ -242,7 +242,7 @@ def ramdisk_chk(asrv: AuthSrv) -> None:
|
|||
zsl = list(ztsp)
|
||||
zsl[1] = False
|
||||
zsl[2] = False
|
||||
vn.uaxs[un] = tuple(zsl)
|
||||
vn.uaxs[un] = tuple(zsl) # type: ignore
|
||||
if mods:
|
||||
t = "WARNING: write-access was removed from the following volumes because they are not mapped to an actual HDD for storage! All uploaded data would live in RAM only, and all uploaded files would be LOST on next reboot. To allow uploading and ignore this hazard, enable the 'wram' option (global/volflag). List of affected volumes:"
|
||||
t2 = ["\n volume=[/%s], abspath=%r, type=%s, root=%r" % x for x in mods]
|
||||
|
|
|
|||
|
|
@ -812,6 +812,7 @@ class HttpCli(object):
|
|||
return self.tx_404() and False
|
||||
|
||||
try:
|
||||
assert avn # type: ignore # !rm
|
||||
(
|
||||
self.can_read,
|
||||
self.can_write,
|
||||
|
|
@ -1522,7 +1523,7 @@ class HttpCli(object):
|
|||
uv.append(ext)
|
||||
uq += " and ( %s )" % (" or ".join(zsl),)
|
||||
|
||||
zs1 = self.uparam.get("sort", self.args.rss_sort)
|
||||
zs1 = self.uparam.get("sort") or self.args.rss_sort
|
||||
zs2 = zs1.lower()
|
||||
zs = RSS_SORT.get(zs2)
|
||||
if not zs:
|
||||
|
|
@ -1846,6 +1847,7 @@ class HttpCli(object):
|
|||
bfree, btot, _ = get_df(vn.realpath, False)
|
||||
if btot:
|
||||
if "vmaxb" in vn.flags:
|
||||
assert vn.lim # type: ignore # !rm
|
||||
btot = vn.lim.vbmax
|
||||
if bfree == vn.lim.c_vb_r:
|
||||
bfree = min(bfree, max(0, vn.lim.vbmax - vn.lim.c_vb_v))
|
||||
|
|
@ -5392,7 +5394,7 @@ class HttpCli(object):
|
|||
"dbwt": None,
|
||||
}
|
||||
|
||||
assert vstate.items and vs # type: ignore # !rm
|
||||
assert vstate and vstate.items and vs # type: ignore # !rm
|
||||
|
||||
dls = dl_list = []
|
||||
if self.conn.hsrv.tdls:
|
||||
|
|
@ -5943,7 +5945,7 @@ class HttpCli(object):
|
|||
if shr_dbv:
|
||||
# translate vpaths from share-target to share-url
|
||||
# to satisfy access checks
|
||||
assert shr_vrem.split # type: ignore # !rm
|
||||
assert shr_vrem and shr_vrem.split # type: ignore # !rm
|
||||
vp_shr, vp_vfs = vroots(self.vpath, vjoin(shr_dbv.vpath, shr_vrem))
|
||||
for v in ret:
|
||||
vp = v["vp"]
|
||||
|
|
@ -6777,6 +6779,7 @@ class HttpCli(object):
|
|||
free, total, zs = get_df(abspath, False)
|
||||
if total:
|
||||
if "vmaxb" in vn.flags:
|
||||
assert vn.lim # type: ignore # !rm
|
||||
total = vn.lim.vbmax
|
||||
if free == vn.lim.c_vb_r:
|
||||
free = min(free, max(0, vn.lim.vbmax - vn.lim.c_vb_v))
|
||||
|
|
@ -7374,6 +7377,7 @@ class HttpCli(object):
|
|||
ogh["og:site_name"] = zs
|
||||
|
||||
try:
|
||||
assert file # type: ignore # !rm
|
||||
zs1, zs2 = file["tags"]["res"].split("x")
|
||||
file["tags"][".resw"] = zs1
|
||||
file["tags"][".resh"] = zs2
|
||||
|
|
@ -7413,6 +7417,7 @@ class HttpCli(object):
|
|||
}
|
||||
|
||||
try:
|
||||
assert file # type: ignore # !rm
|
||||
for k, v in file["tags"].items():
|
||||
zs = "{{ %s }}" % (k,)
|
||||
title = title.replace(zs, str(v))
|
||||
|
|
@ -7429,6 +7434,7 @@ class HttpCli(object):
|
|||
|
||||
for tag, hname in tagmap.items():
|
||||
try:
|
||||
assert file # type: ignore # !rm
|
||||
v = file["tags"][tag]
|
||||
if not v:
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class MDNS(MCast):
|
|||
self.ttl = 300
|
||||
|
||||
if not self.args.zm_nwa_1 and DNS_VND:
|
||||
set_avahi_379()
|
||||
set_avahi_379() # type: ignore
|
||||
|
||||
zs = self.args.zm_fqdn or (self.args.name + ".local")
|
||||
zs = zs.replace("--name", self.args.name).rstrip(".") + "."
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ def get_cover_from_epub(log: "NamedLogger", abspath: str) -> Optional[IO[bytes]]
|
|||
from .dxml import parse_xml
|
||||
|
||||
try:
|
||||
from urlparse import urljoin # Python2
|
||||
from urlparse import urljoin # type: ignore # Python2
|
||||
except ImportError:
|
||||
from urllib.parse import urljoin # Python3
|
||||
|
||||
|
|
|
|||
|
|
@ -3471,12 +3471,12 @@ class Up2k(object):
|
|||
if ow:
|
||||
replace_arg = str(job["replace"]).lower()
|
||||
|
||||
if ow and "skip" in replace_arg:
|
||||
if ow and "skip" in replace_arg: # type: ignore
|
||||
self.log("skipping upload, filename already exists: %r" % fp)
|
||||
err = "upload rejected, a file with that name already exists"
|
||||
raise Pebkac(409, err)
|
||||
|
||||
if ow and "mt" in replace_arg:
|
||||
if ow and "mt" in replace_arg: # type: ignore
|
||||
mts = bos.stat(fp).st_mtime
|
||||
mtc = job["lmod"]
|
||||
if mtc < mts:
|
||||
|
|
|
|||
|
|
@ -2286,6 +2286,7 @@ def sanitize_to(fn: str, tl: dict[int, int]) -> str:
|
|||
def sanitize_vpath(vp: str) -> str:
|
||||
if not FNTL_OS:
|
||||
return vp
|
||||
assert APTL_OS # type: ignore # !rm
|
||||
parts = vp.replace(os.sep, "/").split("/")
|
||||
ret = [sanitize_to(x, APTL_OS) for x in parts]
|
||||
return "/".join(ret)
|
||||
|
|
@ -2592,12 +2593,12 @@ def pathmod(
|
|||
|
||||
def _w8dec2(txt: bytes) -> str:
|
||||
"""decodes filesystem-bytes to wtf8"""
|
||||
return surrogateescape.decodefilename(txt)
|
||||
return surrogateescape.decodefilename(txt) # type: ignore
|
||||
|
||||
|
||||
def _w8enc2(txt: str) -> bytes:
|
||||
"""encodes wtf8 to filesystem-bytes"""
|
||||
return surrogateescape.encodefilename(txt)
|
||||
return surrogateescape.encodefilename(txt) # type: ignore
|
||||
|
||||
|
||||
def _w8dec3(txt: bytes) -> str:
|
||||
|
|
|
|||
Loading…
Reference in a new issue