equal
deleted
inserted
replaced
25 |
25 |
26 # Package initialisation |
26 # Package initialisation |
27 |
27 |
28 |
28 |
29 import os |
29 import os |
|
30 import importlib |
30 from os import listdir, path |
31 from os import listdir, path |
31 from connectors.ConnectorBase import ConnectorBase |
32 from connectors.ConnectorBase import ConnectorBase |
32 |
33 |
33 connectors_packages = ["PYRO", "WAMP"] |
34 connectors_packages = ["PYRO", "WAMP"] |
34 |
35 |
35 |
36 |
36 def _GetLocalConnectorClassFactory(name): |
37 def _GetLocalConnectorClassFactory(name): |
37 return lambda: getattr(__import__(name, globals(), locals()), name + "_connector_factory") |
38 return lambda: getattr(importlib.import_module(f"connectors.{name}"), |
|
39 f"{name}_connector_factory") |
38 |
40 |
39 |
41 |
40 connectors = {name: _GetLocalConnectorClassFactory(name) |
42 connectors = {name: _GetLocalConnectorClassFactory(name) |
41 for name in connectors_packages} |
43 for name in connectors_packages} |
42 |
44 |
51 if not _dialogs_imported: |
53 if not _dialogs_imported: |
52 _dialogs_imported = True |
54 _dialogs_imported = True |
53 per_URI_connectors = {} |
55 per_URI_connectors = {} |
54 schemes = [] |
56 schemes = [] |
55 for con_name in connectors_packages: |
57 for con_name in connectors_packages: |
56 module = __import__(con_name + '_dialog', globals(), locals()) |
58 module = importlib.import_module(f"connectors.{con_name}_dialog") |
57 |
59 |
58 for scheme in module.Schemes: |
60 for scheme in module.Schemes: |
59 per_URI_connectors[scheme] = getattr(module, con_name + '_dialog') |
61 per_URI_connectors[scheme] = getattr(module, con_name + '_dialog') |
60 schemes += [scheme] |
62 schemes += [scheme] |
61 |
63 |