MCPcopy Index your code
hub / github.com/pyload/pyload / get_one

Function get_one

module/plugins/hoster/YoutubeCom.py:22–36  ·  view source on GitHub ↗
(src, what)

Source from the content-addressed store, hash-verified

20
21def try_get(data, *path):
22 def get_one(src, what):
23 if isinstance(src, dict) and isinstance(what, basestring):
24 return src.get(what, None)
25 elif isinstance(src, list) and type(what) is int:
26 try:
27 return src[what]
28 except IndexError:
29 return None
30 elif callable(what):
31 try:
32 return what(src)
33 except Exception:
34 return None
35 else:
36 return None
37
38 res = get_one(data, path[0])
39 for item in path[1:]:

Callers 1

try_getFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected