From 3ee91dffad01137b1e1a1f24fa4459bdb2e1f57c Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 2 Jan 2026 15:23:31 +0000 Subject: [PATCH] linter denoise --- copyparty/fsutil.py | 2 +- copyparty/httpcli.py | 12 +++++++++--- copyparty/mdns.py | 2 +- copyparty/mtag.py | 2 +- copyparty/up2k.py | 4 ++-- copyparty/util.py | 5 +++-- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/copyparty/fsutil.py b/copyparty/fsutil.py index e5ee78e3..9b2540c2 100644 --- a/copyparty/fsutil.py +++ b/copyparty/fsutil.py @@ -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] diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index d00ff2c5..436b705b 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -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 diff --git a/copyparty/mdns.py b/copyparty/mdns.py index 69929081..f64ce605 100644 --- a/copyparty/mdns.py +++ b/copyparty/mdns.py @@ -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(".") + "." diff --git a/copyparty/mtag.py b/copyparty/mtag.py index d8d00f1e..41c28a09 100644 --- a/copyparty/mtag.py +++ b/copyparty/mtag.py @@ -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 diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 1b7d993a..079001ee 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -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: diff --git a/copyparty/util.py b/copyparty/util.py index fb610823..9b1c3cf1 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -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: