gabcares commited on
Commit
984358c
·
verified ·
1 Parent(s): 65a336a

Update utils/data.py

Browse files
Files changed (1) hide show
  1. utils/data.py +4 -3
utils/data.py CHANGED
@@ -2,7 +2,7 @@ import logging
2
  import requests
3
  import requests_cache
4
  from geopy.geocoders import Nominatim
5
- from .config import WEATHER_FILE, WEATHER_FILE_URL, TEST_FILE, TEST_FILE_URL, TRAIN_FILE, TRAIN_FILE_URL, ONE_WEEK_SEC
6
  from cachetools import TTLCache, cached
7
  from typing import List, Dict
8
  from pathlib import Path
@@ -16,7 +16,8 @@ pd.set_option("display.max_columns", None)
16
  pd.set_option('display.float_format', '{:.16f}'.format)
17
 
18
  # Install persistent cache
19
- requests_cache.install_cache('/client/requests_cache/yassir_requests_cache', expire_after=ONE_WEEK_SEC) # Cache expires after 1 week
 
20
 
21
 
22
  # Log
@@ -86,7 +87,7 @@ def full_time_sec_hms(sec: float) -> str:
86
  return f"{round(hours):,}h: {round(minutes)}m: {round(remaining_sec)}s"
87
 
88
 
89
- @cached(cache=TTLCache(maxsize=100000, ttl=ONE_WEEK_SEC)) # Memory
90
  def get_country_geojson():
91
  data = (
92
  pd.concat(
 
2
  import requests
3
  import requests_cache
4
  from geopy.geocoders import Nominatim
5
+ from utils.config import WEATHER_FILE, WEATHER_FILE_URL, TEST_FILE, TEST_FILE_URL, TRAIN_FILE, TRAIN_FILE_URL, ONE_WEEK_SEC
6
  from cachetools import TTLCache, cached
7
  from typing import List, Dict
8
  from pathlib import Path
 
16
  pd.set_option('display.float_format', '{:.16f}'.format)
17
 
18
  # Install persistent cache
19
+ # requests_cache.install_cache('/client/requests_cache/yassir_requests_cache', expire_after=ONE_WEEK_SEC) # Cache expires after 1 week
20
+ requests_cache.install_cache(backend='memory', expire_after=ONE_WEEK_SEC) # Cache expires after 1 week
21
 
22
 
23
  # Log
 
87
  return f"{round(hours):,}h: {round(minutes)}m: {round(remaining_sec)}s"
88
 
89
 
90
+ # @cached(cache=TTLCache(maxsize=100000, ttl=ONE_WEEK_SEC)) # Memory
91
  def get_country_geojson():
92
  data = (
93
  pd.concat(