Skip to content

Commit

Permalink
Update action.py
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunsuresh authored Feb 23, 2025
1 parent ff6b241 commit 624dcba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mlc/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ def setup_logging(log_path = os.getcwd(),log_file = 'mlc-log.txt'):
logger.addHandler(consoleHandler)
logger.propagate = False

# Factory to get the appropriate action class
def get_action(target, parent):
action_class = actions.get(target, None)
return action_class(parent) if action_class else None


def access(i):
action = i['action']
target = i.get('target', i.get('automation'))
action_class = get_action(target, default_parent)
r = action_class.access(i)
return r

# Base class for CLI actions
class Action:
Expand Down

0 comments on commit 624dcba

Please sign in to comment.