def _update_dispatch(self): if self.modules: installed_modules = sys.modules.keys() for module in self.modules.intersection(installed_modules): for handler in self.registry[module]: self.update(safe_import_string(handler), keep_existing=True) del self.registry[module] self.modules.remove(module)
def _update_plugins(self): if self.plugins_registry: for plugins_name, handler in self.plugins_registry.items(): handler = ''.join(handler) try: self.update(safe_import_string(handler)) except TypeError as e: logger.fatal( 'Failed to load encoder associated to plugins %s.' % plugins_name) raise e self.plugins_registry = defaultdict(list)
def __init__(self, normalizer=None, encoder=None, allow_external_objects=False, target_kernel_version=None, **kwargs): self.encode = self.chain_normalizer(normalizer, encoder=safe_import_string( encoder or wolfram_encoder)) self.allow_external_objects = allow_external_objects self.target_kernel_version = target_kernel_version or 11.3 self._properties = kwargs