|
@@ -112,16 +112,15 @@ class GeoPointSourceGroup:
|
|
|
def __init__(self, sources: Dict[str, GeoPointSource], default: GeoPointSource):
|
|
|
self.sources = sources
|
|
|
self.default = default
|
|
|
- self.cached = [s for s in sources.values() if isinstance(s, CachedGeoPointSource)]
|
|
|
- if isinstance(default, CachedGeoPointSource):
|
|
|
- self.cached.append(default)
|
|
|
|
|
|
- def restock_all(self):
|
|
|
+ def restock(self, key: Union[str, None] = None):
|
|
|
"""
|
|
|
- Restock any and all CachedGeoPointSources managed by this group.
|
|
|
+ Restock a CachedGeoPointSources managed by this group.
|
|
|
+ If the targeted GeoPointSource is uncached, this method does nothing.
|
|
|
"""
|
|
|
- for s in self.cached:
|
|
|
- s.restock()
|
|
|
+ src = self.sources.get(key, self.default)
|
|
|
+ if isinstance(src, CachedGeoPointSource):
|
|
|
+ src.restock()
|
|
|
|
|
|
def get_points_from(self, n: int, key: Union[str, None] = None) -> List[Tuple[float, float]]:
|
|
|
"""
|