import time from typing import Dict, List, Optional from .lineage_model import ContributorInfo class ContributorIndex: def __init__(self): self._contributors: Dict[str, ContributorInfo] = {} def register_contributor(self, name: str) -> ContributorInfo: if name not in self._contributors: self._contributors[name] = ContributorInfo( name=name, registered_at=int(time.time() * 1000), contribution_count=1 ) else: self._contributors[name].contribution_count += 1 return self._contributors[name] def get_contributor(self, name: str) -> Optional[ContributorInfo]: return self._contributors.get(name) def list_contributors(self) -> List[ContributorInfo]: return list(self._contributors.values()) _global_index = ContributorIndex() def register_contributor(name: str) -> ContributorInfo: return _global_index.register_contributor(name) def get_contributor(name: str) -> Optional[ContributorInfo]: return _global_index.get_contributor(name) def list_contributors() -> List[ContributorInfo]: return _global_index.list_contributors()