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

Function load

module/lib/bottle.py:2273–2290  ·  view source on GitHub ↗

Import a module or fetch an object from a module. * ``package.module`` returns `module` as a module object. * ``pack.mod:name`` returns the module variable `name` from `pack.mod`. * ``pack.mod:func()`` calls `pack.mod.func()` and returns the result. The last form a

(target, **namespace)

Source from the content-addressed store, hash-verified

2271
2272
2273def load(target, **namespace):
2274 """ Import a module or fetch an object from a module.
2275
2276 * ``package.module`` returns `module` as a module object.
2277 * ``pack.mod:name`` returns the module variable `name` from `pack.mod`.
2278 * ``pack.mod:func()`` calls `pack.mod.func()` and returns the result.
2279
2280 The last form accepts not only function calls, but any type of
2281 expression. Keyword arguments passed to this function are available as
2282 local variables. Example: ``import_string('re:compile(x)', x='[a-z]')``
2283 """
2284 module, target = target.split(":", 1) if ':' in target else (target, None)
2285 if module not in sys.modules: __import__(module)
2286 if not target: return sys.modules[module]
2287 if target.isalnum(): return getattr(sys.modules[module], target)
2288 package_name = module.split('.')[0]
2289 namespace[package_name] = sys.modules[package_name]
2290 return eval('%s.%s' % (module, target), namespace)
2291
2292
2293def load_app(target):

Callers 3

decoratorMethod · 0.70
load_appFunction · 0.70
runFunction · 0.70

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected