medved/lib/net/Action.py
2018-04-03 02:47:50 +03:00

23 lines
538 B
Python

class Action:
"""Base class for remote actions"""
#this part should be removed, I think
#dunno
def __init__(self, datapool):
self._datapool = datapool
self.result = None
def run(self, data):
pass
class data_get(Action):
def run(self, data):
return self._datapool.get(data["plugin"], data["count"])
class data_put(Action):
def run(self, data):
self._datapool.put(data['plugin'], data['items'])
class ActionManager:
@staticmethod
def get(name: str):
return globals()[name.replace('.', '_')]