INNER CODE UNIT · Python
validate_usernames
OpenOSINT/OpenOSINT · actors/username-recon/src/main.py:88
def validate_usernames(raw: list) -> tuple[list[str], list[str]]:
"""Dedupe and split raw input into (valid, rejected) usernames."""
deduped = _dedupe_preserve_order([str(u) for u in raw])
valid, rejected = [], []
for username in deduped:
if _USERNAME_RE.match(username):
valid.append(username)
else:
rejected.append(username)
return valid, rejected
def chunk_site_data(site_data: dict, size: int = _CHUNK_SIZE) -> list[dict]:
"""Split a sherlock site-data dict into a list of smaller dicts of at most `size` sites."""
items = list(site_data.items())
return [dict(items[i : i + size]) for i in range(0, len(items), size)]