12345678910111213141516171819202122232425262728293031 |
- from typing import List, Tuple
- from .random_street_view import SOURCE_GROUP as RSV_SOURCE_GROUP
- from .shared import ExhaustedSourceError
- from ..schemas import GameConfig, GenMethodEnum, CacheInfo
- source_groups = {
- GenMethodEnum.rsv: RSV_SOURCE_GROUP,
- }
- def generate_points(config: GameConfig) -> List[Tuple[float, float]]:
- """
- Generate points according to the GameConfig.
- """
- return source_groups[config.generation_method].get_points_from(config.rounds, config.country_lock)
- def restock_source(generation_method: GenMethodEnum):
- """
- Restock any caches associated with the generation method.
- """
- source_groups[generation_method].restock_all()
- def get_cache_info() -> List[CacheInfo]:
- """
- Get CacheInfo for all caches
- """
- return [CacheInfo(cache_name=c.get_name(), size=len(c.stock)) for g in source_groups.values() for c in g.cached]
|