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

Function settings_security_questions

Scripts/ButSystem.py:11199–11230  ·  view source on GitHub ↗

settings_security_questions. Internal helper function. This docstring was added automatically to improve maintainability. Returns: Varies.

()

Source from the content-addressed store, hash-verified

11197 for future in as_completed(futures):
11198 try:
11199 items.extend(future.result())
11200 except Exception:
11201 continue
11202
11203 def parse_dt(published: str) -> float:
11204 published = (published or "").strip()
11205 if not published:
11206 return 0.0
11207 try:
11208 from email.utils import parsedate_to_datetime
11209 return parsedate_to_datetime(published).timestamp()
11210 except Exception:
11211 pass
11212 try:
11213 return datetime.fromisoformat(published.replace("Z", "+00:00")).timestamp()
11214 except Exception:
11215 return 0.0
11216
11217 items.sort(key=lambda it: parse_dt(it.get("published") or ""), reverse=True)
11218
11219 # Deduplicate and keep enough stories from every interest instead of letting popular topics crowd out niche ones.
11220 seen = set()
11221 per_topic: Dict[str, int] = {}
11222 balanced: List[Dict[str, str]] = []
11223 for item in items:
11224 url = (item.get("url") or "").strip()
11225 topic_key = str(item.get("topic_key") or "other")
11226 if not url or url in seen or per_topic.get(topic_key, 0) >= 25:
11227 continue
11228 seen.add(url)
11229 per_topic[topic_key] = per_topic.get(topic_key, 0) + 1
11230 balanced.append(item)
11231 if len(balanced) >= 800:
11232 break
11233 return balanced

Callers

nothing calls this directly

Calls 3

current_userFunction · 0.70
get_user_securityFunction · 0.70
set_user_securityFunction · 0.70

Tested by

no test coverage detected