comparison sat/tools/common/dynamic_import.py @ 2624:56f94936df1e

code style reformatting using black
author Goffi <goffi@goffi.org>
date Wed, 27 Jun 2018 20:14:46 +0200
parents 26edcf3a30eb
children 003b8b4b56a7
comparison
equal deleted inserted replaced
2623:49533de4540b 2624:56f94936df1e
20 """ tools dynamic import """ 20 """ tools dynamic import """
21 21
22 from importlib import import_module 22 from importlib import import_module
23 23
24 24
25 def bridge(name, module_path='sat.bridge'): 25 def bridge(name, module_path="sat.bridge"):
26 """Import bridge module 26 """Import bridge module
27 27
28 @param module_path(str): path of the module to import 28 @param module_path(str): path of the module to import
29 @param name(str): name of the bridge to import (e.g.: dbus) 29 @param name(str): name of the bridge to import (e.g.: dbus)
30 @return (module, None): imported module or None if nothing is found 30 @return (module, None): imported module or None if nothing is found
31 """ 31 """
32 try: 32 try:
33 bridge_module = import_module(module_path + '.' + name) 33 bridge_module = import_module(module_path + "." + name)
34 except ImportError: 34 except ImportError:
35 try: 35 try:
36 bridge_module = import_module(module_path + '.' + name + '_bridge') 36 bridge_module = import_module(module_path + "." + name + "_bridge")
37 except ImportError: 37 except ImportError:
38 bridge_module = None 38 bridge_module = None
39 return bridge_module 39 return bridge_module