MCPcopy Index your code
hub / github.com/plotly/plotly.py / get_module

Function get_module

_plotly_utils/optional_imports.py:14–36  ·  view source on GitHub ↗

Return module or None. Absolute import is required. :param (str) name: Dot-separated module path. E.g., 'scipy.stats'. :raise: (ImportError) Only when exc_msg is defined. :return: (module|None) If import succeeds, the module will be returned.

(name, should_load=True)

Source from the content-addressed store, hash-verified

12
13
14def get_module(name, should_load=True):
15 """
16 Return module or None. Absolute import is required.
17
18 :param (str) name: Dot-separated module path. E.g., 'scipy.stats'.
19 :raise: (ImportError) Only when exc_msg is defined.
20 :return: (module|None) If import succeeds, the module will be returned.
21
22 """
23 if not should_load:
24 return sys.modules.get(name, None)
25
26 if name not in _not_importable:
27 try:
28 return import_module(name)
29 except ImportError:
30 _not_importable.add(name)
31 except Exception:
32 _not_importable.add(name)
33 msg = f"Error importing optional module {name}"
34 logger.exception(msg)
35
36 return None

Callers 15

to_scalar_or_listFunction · 0.90
is_homogeneous_arrayFunction · 0.90
__init__Method · 0.90
validate_coerceMethod · 0.90
validate_coerceMethod · 0.90
validate_coerceMethod · 0.90
to_typed_array_specFunction · 0.90
encode_as_sageMethod · 0.90
encode_as_pandasMethod · 0.90
encode_as_numpyMethod · 0.90
encode_as_pilMethod · 0.90

Calls 2

getMethod · 0.45
addMethod · 0.45