MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / fetch_dict

Function fetch_dict

leaderboard/leaderboard/utils/checkpoint_tools.py:24–47  ·  view source on GitHub ↗
(endpoint)

Source from the content-addressed store, hash-verified

22
23
24def fetch_dict(endpoint):
25 data = None
26 if endpoint.startswith(('http:', 'https:', 'ftp:')):
27 proxies = autodetect_proxy()
28
29 if proxies:
30 response = requests.get(url=endpoint, proxies=proxies)
31 else:
32 response = requests.get(url=endpoint)
33
34 try:
35 data = response.json()
36 except json.decoder.JSONDecodeError:
37 data = {}
38 else:
39 data = {}
40 if os.path.exists(endpoint):
41 with open(endpoint) as fd:
42 try:
43 data = json.load(fd)
44 except json.JSONDecodeError:
45 data = {}
46
47 return data
48
49
50def create_default_json_msg():

Callers 7

resumeMethod · 0.90
save_recordMethod · 0.90
save_global_recordMethod · 0.90
save_sensorsMethod · 0.90
save_entry_statusMethod · 0.90
resumeMethod · 0.90
save_stateMethod · 0.90

Calls 3

autodetect_proxyFunction · 0.85
getMethod · 0.80
loadMethod · 0.80

Tested by

no test coverage detected