def parse_arguments(self, action_type, query): func = getattr(self, action_type) argspecs = inspect.signature(func) param = list(argspecs.parameters.keys()) q = {} for i in param: if argspecs.parameters[i].default is None: q[i] = flatten_dictionaries(query.get(i, {})) else: q[i] = flatten_dictionaries(query[i]) return q
def __init__(self, action, driver, query): self.action = action self.driver = driver self.action_type = query.pop('action') if 'run' in query: self.run_count = query.pop('run') query['driver'] = driver query['action'] = action try: if isinstance(query['move_to_window_center'], bool): self.move_to_center = query['move_to_window_center'] elif isinstance(query['move_to_window_center'], int) or isinstance( query['move_to_window_center'], float): self.move_to_center = True self.move_to_center_delay = query['move_to_window_center'] elif isinstance( flatten_dictionaries(query['move_to_window_center']), dict): node = flatten_dictionaries(query['move_to_window_center']) self.move_to_center = True self.move_to_center_delay = node['delay'] except Exception: self.move_to_center = False self.query = self.parse_arguments(self.action_type, query)
def __init__(self, value, query): self.init_val = value self.re = re _query = query[0] self.register_aliases() for key, value in _query.items(): try: parse_query = util.flatten_dictionaries(value) except Exception as e: print("Error Configuration") print(str(e)) self.status = False return 0 self.query = parse_query self.method = key self.status = True