MCPcopy Create free account
hub / github.com/celery/celery / try_import

Function try_import

celery/local.py:41–49  ·  view source on GitHub ↗

Try to import and return module. Returns None if the module does not exist.

(module, default=None)

Source from the content-addressed store, hash-verified

39
40
41def try_import(module, default=None):
42 """Try to import and return module.
43
44 Returns None if the module does not exist.
45 """
46 try:
47 return import_module(module)
48 except ImportError:
49 return default
50
51
52class Proxy:

Callers 3

test_importsMethod · 0.90
test_when_defaultMethod · 0.90
platforms.pyFile · 0.85

Calls

no outgoing calls

Tested by 2

test_importsMethod · 0.72
test_when_defaultMethod · 0.72