def __init__(self, **kwargs): self.module = module = kwargs.pop('module', None) self.file_path = file_path = kwargs.pop('file_path', None) self.exc_info = kwargs.pop('exc_info', None) if module is not None: file_path = os.path.abspath(module.__file__) self.file_path = file_path if file_path is None: self.path = kwargs.get('path', None) self.file_name = kwargs.get('file_name', None) name = kwargs.get('name', None) else: if self.file_path.endswith(".pyc"): self.file_path = self.file_path[:-1] self.path, self.file_name = os.path.split(self.file_path) name, _ = os.path.splitext(self.file_name) self.meta_classes = {} self.meta_functions = {} if module is not None and module.__doc__: self.description = module.__doc__ self._code = getsourcelines(module)[0] else: self.description = name + " in error!" self._code = None kwargs['name'] = name kwargs['full_name'] = file_path or name SardanaBaseObject.__init__(self, **kwargs)
def __init__(self, **kwargs): self.module = module = kwargs.pop('module', None) self.file_path = file_path = kwargs.pop('file_path', None) self.exc_info = kwargs.pop('exc_info', None) if module is not None: file_path = os.path.abspath(module.__file__) self.file_path = file_path if file_path is None: self.path = kwargs.get('path', None) self.file_name = kwargs.get('file_name', None) name = kwargs.get('name', None) else: if self.file_path.endswith(".pyc"): self.file_path = self.file_path[:-1] self.path, self.file_name = os.path.split(self.file_path) name, _ = os.path.splitext(self.file_name) self.meta_classes = {} self.meta_functions = {} if module is not None: if module.__doc__ is not None: self.description = module.__doc__ self._code = getsourcelines(module)[0] else: self.description = name + " in error!" self._code = None kwargs['name'] = name kwargs['full_name'] = file_path or name SardanaBaseObject.__init__(self, **kwargs)
def __init__(self, **kwargs): lib = kwargs.pop('lib') self._lib = weakref.ref(lib) self._code_obj = kwargs.pop('code') doc = self._code_obj.__doc__ if doc: self.description = doc self._code = getsourcelines(self._code_obj) name = kwargs['name'] kwargs['full_name'] = "{0}.{1}".format(lib.name, name) kwargs['parent'] = kwargs.pop('parent', self.lib) SardanaBaseObject.__init__(self, **kwargs)
def serialize(self, *args, **kwargs): """Returns a serializable object describing this object. :return: a serializable dict :rtype: dict""" kwargs = SardanaBaseObject.serialize(self, *args, **kwargs) kwargs['id'] = 0 kwargs['module'] = self.module_name kwargs['file_name'] = self.file_name kwargs['file_path'] = self.file_path kwargs['path'] = self.path kwargs['description'] = self.description return kwargs
def serialize(self, *args, **kwargs): """Returns a serializable object describing this object. :return: a serializable dict :rtype: dict""" kwargs = SardanaBaseObject.serialize(self, *args, **kwargs) kwargs['id'] = 0 kwargs['module'] = self.name kwargs['file_path'] = self.file_path kwargs['file_name'] = self.file_name kwargs['path'] = self.path kwargs['description'] = self.description kwargs['elements'] = self.meta_classes.keys() + self.meta_functions.keys() if self.exc_info is None: kwargs['exc_summary'] = None kwargs['exc_info'] = None else: kwargs['exc_summary'] = "".join(traceback.format_exception_only(*self.exc_info[:2])) kwargs['exc_info'] = "".join(traceback.format_exception(*self.exc_info)) return kwargs
def serialize(self, *args, **kwargs): """Returns a serializable object describing this object. :return: a serializable dict :rtype: dict""" kwargs = SardanaBaseObject.serialize(self, *args, **kwargs) kwargs['id'] = 0 kwargs['module'] = self.name kwargs['file_path'] = self.file_path kwargs['file_name'] = self.file_name kwargs['path'] = self.path kwargs['description'] = self.description kwargs['elements'] = list(self.meta_classes.keys()) + \ list(self.meta_functions.keys()) if self.exc_info is None: kwargs['exc_summary'] = None kwargs['exc_info'] = None else: kwargs['exc_summary'] = "".join( traceback.format_exception_only(*self.exc_info[:2])) kwargs['exc_info'] = "".join( traceback.format_exception(*self.exc_info)) return kwargs
def serialize(self, *args, **kwargs): kwargs = SardanaBaseObject.serialize(self, *args, **kwargs) kwargs["pool"] = self.pool.name return kwargs
def __init__(self, **kwargs): kwargs["manager"] = kwargs.pop("pool") SardanaBaseObject.__init__(self, **kwargs)
def serialize(self, *args, **kwargs): kwargs = SardanaBaseObject.serialize(self, *args, **kwargs) kwargs['macro_server'] = self.macro_server.name return kwargs
def __init__(self, **kwargs): kwargs['manager'] = kwargs.pop('macro_server') SardanaBaseObject.__init__(self, **kwargs)
def serialize(self, *args, **kwargs): kwargs = SardanaBaseObject.serialize(self, *args, **kwargs) kwargs['pool'] = self.pool.name return kwargs
def __init__(self, **kwargs): kwargs['manager'] = kwargs.pop('pool') SardanaBaseObject.__init__(self, **kwargs)