# Path: humanrl/utils.py
# ACTION_MEANING = {
#     None: "NONE",
#     0: "NOOP",
#     1: "FIRE",
#     2: "UP",
#     3: "RIGHT",
#     4: "LEFT",
#     5: "DOWN",
#     6: "UPRIGHT",
#     7: "UPLEFT",
#     8: "DOWNRIGHT",
#     9: "DOWNLEFT",
#     10: "UPFIRE",
#     11: "RIGHTFIRE",
#     12: "LEFTFIRE",
#     13: "DOWNFIRE",
#     14: "UPRIGHTFIRE",
#     15: "UPLEFTFIRE",
#     16: "DOWNRIGHTFIRE",
#     17: "DOWNLEFTFIRE",
# }


import argparse
import gzip
import logging
import os
import os.path
import pickle
import time
import gym
import numpy as np
import log_coordinator
from multiprocessing.connection import Client
from humanrl.utils import ACTION_MEANING
    def __send_frame_to_human(self, frame, proposed_action):
        """ Sends a frame with a proposed action to the human for feedback. """
        # if proposed_action is not None and frame.action is not None:
        frame.action = proposed_action
        frame.info["frame/action/proposed_action"] = proposed_action
        # info["frame/action/real_action"] = real_action

        proposed_action_meaning = ACTION_MEANING[self.episode_info_common["action_set"][
            proposed_action]]
        logger.info('Sending frame. Proposed action: {}'.format(proposed_action_meaning))
        self.conn.send(frame)

    def __handle_feedback(self, msg, proposed_action):
        """Given the proposed action and the human feedback message

        Returns:
            - a tuple (action, label).

        """
        logger.info('online step, received: {}'.format(msg))
        real_action = proposed_action
        label = None
        # parse feedback message
        if isinstance(msg, dict):
            label = 'b'
            if self.online_blocking_mode == "action_pruning":
                return None, label
            real_action = msg['action']
            proposed_action_meaning = ACTION_MEANING[self.episode_info_common["action_set"][
                proposed_action]]

# Path: humanrl/utils.py
# ACTION_MEANING = {
#     None: "NONE",
#     0: "NOOP",
#     1: "FIRE",
#     2: "UP",
#     3: "RIGHT",
#     4: "LEFT",
#     5: "DOWN",
#     6: "UPRIGHT",
#     7: "UPLEFT",
#     8: "DOWNRIGHT",
#     9: "DOWNLEFT",
#     10: "UPFIRE",
#     11: "RIGHTFIRE",
#     12: "LEFTFIRE",
#     13: "DOWNFIRE",
#     14: "UPRIGHTFIRE",
#     15: "UPLEFTFIRE",
#     16: "DOWNRIGHTFIRE",
#     17: "DOWNLEFTFIRE",
# }


# Path: humanrl/frame.py
import argparse
import gzip
import logging
import os
import os.path
import pickle
import time
import gym
import numpy as np
import log_coordinator
from multiprocessing.connection import Client
from humanrl.utils import ACTION_MEANING

    def __send_frame_to_human(self, frame, proposed_action):
        """ Sends a frame with a proposed action to the human for feedback. """
        # if proposed_action is not None and frame.action is not None:
        frame.action = proposed_action
        frame.info["frame/action/proposed_action"] = proposed_action
        # info["frame/action/real_action"] = real_action

        proposed_action_meaning = ACTION_MEANING[self.episode_info_common["action_set"][
            proposed_action]]
        logger.info('Sending frame. Proposed action: {}'.format(proposed_action_meaning))
        self.conn.send(frame)

    def __handle_feedback(self, msg, proposed_action):
        """Given the proposed action and the human feedback message

        Returns:
            - a tuple (action, label).

        """
        logger.info('online step, received: {}'.format(msg))
        real_action = proposed_action
        label = None
        # parse feedback message
        if isinstance(msg, dict):
            label = 'b'
            if self.online_blocking_mode == "action_pruning":
                return None, label
            real_action = msg['action']
            proposed_action_meaning = ACTION_MEANING[self.episode_info_common["action_set"][
                proposed_action]]

            real_action_meaning = ACTION_MEANING[self.episode_info_common["action_set"][