bug fix: delegate (new feature)

pull/20/head
Steve Nyemba 5 months ago
parent 2edce85aed
commit 808378afdb

@ -81,9 +81,11 @@ def instance (**_args):
if not registry.isloaded () : if not registry.isloaded () :
if ('path' in _args and registry.exists(_args['path'] )) or registry.exists(): if ('path' in _args and registry.exists(_args['path'] )) or registry.exists():
registry.load() if 'path' not in _args else registry.load(_args['path']) registry.load() if 'path' not in _args else registry.load(_args['path'])
_info = {}
if 'label' in _args and registry.isloaded(): if 'label' in _args and registry.isloaded():
_info = registry.get(_args['label']) _info = registry.get(_args['label'])
else:
_info = registry.get()
if _info : if _info :
# #
# _args = dict(_args,**_info) # _args = dict(_args,**_info)
@ -132,7 +134,7 @@ class get :
""" """
@staticmethod @staticmethod
def reader (**_args): def reader (**_args):
if not _args : if not _args or 'provider' not in _args:
_args['label'] = 'default' _args['label'] = 'default'
_args['context'] = 'read' _args['context'] = 'read'
return instance(**_args) return instance(**_args)

@ -52,6 +52,13 @@ class IO:
if hasattr(self._agent,'apply') : if hasattr(self._agent,'apply') :
return self._agent.apply(_query) return self._agent.apply(_query)
return None return None
def submit(self,_query):
return self.delegate('submit',_query)
def delegate(self,_name,_query):
if hasattr(self._agent,_name) :
pointer = getattr(self._agent,_name)
return pointer(_query)
return None
class IReader(IO): class IReader(IO):
""" """
This is a wrapper for read functionalities This is a wrapper for read functionalities

Loading…
Cancel
Save