MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / select_users

Function select_users

experiments/simulation/simulate_historical_episodes.py:855–872  ·  view source on GitHub ↗

Select a stable user subset without modifying the database.

(
    users: List[Dict[str, Any]],
    *,
    user_ids: Optional[List[str]] = None,
    user_count: Optional[int] = None,
)

Source from the content-addressed store, hash-verified

853
854
855def select_users(
856 users: List[Dict[str, Any]],
857 *,
858 user_ids: Optional[List[str]] = None,
859 user_count: Optional[int] = None,
860) -> List[Dict[str, Any]]:
861 """Select a stable user subset without modifying the database."""
862 if user_ids:
863 users_by_id = {str(user.get("user_id")): user for user in users}
864 missing = [user_id for user_id in user_ids if user_id not in users_by_id]
865 if missing:
866 raise SystemExit(f"Unknown user id(s): {', '.join(missing)}")
867 return [users_by_id[user_id] for user_id in user_ids]
868
869 if user_count and user_count > 0:
870 return sorted(users, key=_user_sort_key)[: min(user_count, len(users))]
871
872 return users
873
874
875def collect_papers_for_day(

Callers 1

mainFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected