misc cleanup;

* more typos
* python 3.13 deprecations
This commit is contained in:
ed 2024-10-11 20:46:40 +00:00
parent 4a4ec88d00
commit 1e7697b551
9 changed files with 10 additions and 9 deletions

View file

@ -896,7 +896,7 @@ def get_sects():
dedent( dedent(
""" """
the mDNS protocol is multicast-based, which means there are thousands the mDNS protocol is multicast-based, which means there are thousands
of fun and intersesting ways for it to break unexpectedly of fun and interesting ways for it to break unexpectedly
things to check if it does not work at all: things to check if it does not work at all:

View file

@ -924,7 +924,7 @@ class AuthSrv(object):
for un, gn in un_gn: for un, gn in un_gn:
# if ap/vp has a user/group placeholder, make sure to keep # if ap/vp has a user/group placeholder, make sure to keep
# track so the same user/gruop is mapped when setting perms; # track so the same user/group is mapped when setting perms;
# otherwise clear un/gn to indicate it's a regular volume # otherwise clear un/gn to indicate it's a regular volume
src1 = src0.replace("${u}", un or "\n") src1 = src0.replace("${u}", un or "\n")

View file

@ -3045,7 +3045,7 @@ class HttpCli(object):
if ex.errno != errno.ENOENT: if ex.errno != errno.ENOENT:
raise raise
# if file exists, chekc that timestamp matches the client's # if file exists, check that timestamp matches the client's
if srv_lastmod >= 0: if srv_lastmod >= 0:
same_lastmod = cli_lastmod3 in [-1, srv_lastmod3] same_lastmod = cli_lastmod3 in [-1, srv_lastmod3]
if not same_lastmod: if not same_lastmod:
@ -4789,7 +4789,7 @@ class HttpCli(object):
fmt = fmt.format(len(nfmt.format(biggest))) fmt = fmt.format(len(nfmt.format(biggest)))
retl = [ retl = [
"# {}: {}".format(x, ls[x]) ("# %s: %s" % (x, ls[x])).replace(r"</span> // <span>", " // ")
for x in ["acct", "perms", "srvinf"] for x in ["acct", "perms", "srvinf"]
if x in ls if x in ls
] ]

View file

@ -473,7 +473,7 @@ class MTag(object):
sv = str(zv).split("/")[0].strip().lstrip("0") sv = str(zv).split("/")[0].strip().lstrip("0")
ret[sk] = sv or 0 ret[sk] = sv or 0
# normalize key notation to rkeobo # normalize key notation to rekobo
okey = ret.get("key") okey = ret.get("key")
if okey: if okey:
key = str(okey).replace(" ", "").replace("maj", "").replace("min", "m") key = str(okey).replace(" ", "").replace("maj", "").replace("min", "m")

View file

@ -84,7 +84,7 @@ class SSDPr(object):
name = self.args.doctitle name = self.args.doctitle
zs = zs.strip().format(c(ubase), c(url), c(name), c(self.args.zsid)) zs = zs.strip().format(c(ubase), c(url), c(name), c(self.args.zsid))
hc.reply(zs.encode("utf-8", "replace")) hc.reply(zs.encode("utf-8", "replace"))
return False # close connectino return False # close connection
class SSDPd(MCast): class SSDPd(MCast):

View file

@ -95,7 +95,7 @@ class TcpSrv(object):
continue continue
# binding 0.0.0.0 after :: fails on dualstack # binding 0.0.0.0 after :: fails on dualstack
# but is necessary on non-dualstakc # but is necessary on non-dualstack
if successful_binds: if successful_binds:
continue continue

View file

@ -1163,7 +1163,7 @@ class Magician(object):
return ret return ret
mime = magic.from_file(fpath, mime=True) mime = magic.from_file(fpath, mime=True)
mime = re.split("[; ]", mime, 1)[0] mime = re.split("[; ]", mime, maxsplit=1)[0]
try: try:
return EXTS[mime] return EXTS[mime]
except: except:

View file

@ -279,6 +279,7 @@ the rest is mostly optional; if you need a working env for vscode or similar
python3 -m venv .venv python3 -m venv .venv
. .venv/bin/activate . .venv/bin/activate
pip install jinja2 strip_hints # MANDATORY pip install jinja2 strip_hints # MANDATORY
pip install argon2-cffi # password hashing
pip install mutagen # audio metadata pip install mutagen # audio metadata
pip install pyftpdlib # ftp server pip install pyftpdlib # ftp server
pip install partftpy # tftp server pip install partftpy # tftp server

View file

@ -71,7 +71,7 @@ def cnv(src):
def main(): def main():
src = readclip() src = readclip()
src = re.split("0{100,200}", src[::-1], 1)[1][::-1] src = re.split("0{100,200}", src[::-1], maxsplit=1)[1][::-1]
with open("helptext.html", "wb") as fo: with open("helptext.html", "wb") as fo:
for ln in cnv(iter(src.split("\n")[:-3])): for ln in cnv(iter(src.split("\n")[:-3])):
fo.write(ln.encode("utf-8") + b"\r\n") fo.write(ln.encode("utf-8") + b"\r\n")