Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if locations is not None:
try:
with open(self.cache_file) as f:
metadata = json.load(f)
except:
metadata = self.get_locations()
selected = [feature for feature in metadata['features'] if feature['id'] in locations]
return FeatureCollection(selected)
if bounding_box is None:
bounding_box = self.metadata['bounding_boxes'][0]
bbox = [float(p) for p in bounding_box]
locations = eros.get_raster_availability(self.product_key, bbox)
if os.path.exists(self.cache_file):
existing = json.load(open(self.cache_file))
locations = util.append_features(existing, locations)
with open(self.cache_file, 'w') as f:
dump(locations, f)
return locations