MCPcopy Index your code
hub / github.com/tflearn/tflearn / get_from_module

Function get_from_module

tflearn/utils.py:20–33  ·  view source on GitHub ↗
(identifier, module_params, module_name, instantiate=False, kwargs=None)

Source from the content-addressed store, hash-verified

18
19
20def get_from_module(identifier, module_params, module_name, instantiate=False, kwargs=None):
21 if isinstance(identifier, six.string_types):
22 res = module_params.get(identifier)
23 if not res:
24 res = module_params.get(identifier.lower())
25 if not res:
26 raise Exception('Invalid ' + str(module_name) + ': ' + str(identifier))
27 if instantiate and not kwargs:
28 return res()
29 elif instantiate and kwargs:
30 return res(**kwargs)
31 else:
32 return res
33 return identifier
34
35
36# ------------------

Callers 8

getFunction · 0.85
getFunction · 0.85
getFunction · 0.85
getFunction · 0.85
getFunction · 0.85
getFunction · 0.85
getFunction · 0.85
getFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected