MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / _user_match_score

Function _user_match_score

Scripts/ButSystem.py:13635–13655  ·  view source on GitHub ↗

_user_match_score. Internal helper function. This docstring was added automatically to improve maintainability. Args: q: Parameter. u: Parameter. Returns: Varies.

(q: str, u: str)

Source from the content-addressed store, hash-verified

13633 cur.execute(
13634 "INSERT INTO dm_files(dm_id, filename, mime, stored_path, size, created_at) VALUES(?,?,?,?,?,?)",
13635 (dm_id, "gif.gif", "image/gif", "PENDING", 0, now_z())
13636 )
13637 fid = cur.lastrowid
13638 stored_path = os.path.join(DM_FILES_DIR, f"dm_file_{fid}.bin")
13639
13640 max_bytes = CHAT_MAX_BYTES # 33 MB
13641 size = 0
13642 mime = "image/gif"
13643 filename = "gif.gif"
13644
13645 req = urllib.request.Request(
13646 gif_url,
13647 headers={
13648 "User-Agent": "ButSystem/1.0 (+https://example.invalid)",
13649 "Accept": "image/gif,image/*,video/*,*/*;q=0.8",
13650 },
13651 method="GET",
13652 )
13653 with _safe_urlopen(req, timeout=12) as resp:
13654 ctype = (resp.headers.get("Content-Type") or "").split(";")[0].strip().lower()
13655 if ctype:
13656 mime = ctype
13657 if not (mime == "image/gif" or mime.startswith("video/")):
13658 path = (u.path or "").lower()

Callers 1

scoreFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected