# Path: aredis/utils.py
# def dict_merge(*dicts):
#     merged = {}
#     for d in dicts:
#         merged.update(d)
#     return merged
# 
# def nativestr(x):
#     return x if isinstance(x, str) else x.decode('utf-8', 'replace')
# 
# def list_keys_to_dict(key_list, callback):
#     return dict.fromkeys(key_list, callback)
# 
# class NodeFlag:
#     BLOCKED = 'blocked'
#     ALL_NODES = 'all-nodes'
#     ALL_MASTERS = 'all-masters'
#     RANDOM = 'random'
#     SLOT_ID = 'slot-id'
# 
# def bool_ok(response):
#     return nativestr(response) == 'OK'


from aredis.utils import (dict_merge, nativestr,
                          list_keys_to_dict,
                          NodeFlag, bool_ok)
        from aredis.scripting import Script

    async def script_flush(self):
        """Flushes all scripts from the script cache"""
        return await self.execute_command('SCRIPT FLUSH')

    async def script_kill(self):
        """Kills the currently executing Lua script"""
        return await self.execute_command('SCRIPT KILL')

    async def script_load(self, script):
        """Loads a Lua ``script`` into the script cache. Returns the SHA."""
        return await self.execute_command('SCRIPT LOAD', script)

    def register_script(self, script):
        """
        Registers a Lua ``script`` specifying the ``keys`` it will touch.
        Returns a Script object that is callable and hides the complexity of
        dealing with scripts, keys, and shas. This is the preferred way of
        working with Lua scripts.
        """
        return Script(self, script)


class ClusterScriptingCommandMixin(ScriptingCommandMixin):

    NODES_FLAGS = dict_merge(
        {
        'SCRIPT KILL': NodeFlag.BLOCKED
        },
        list_keys_to_dict(

# Path: aredis/utils.py
# def dict_merge(*dicts):
#     merged = {}
#     for d in dicts:
#         merged.update(d)
#     return merged
# 
# def nativestr(x):
#     return x if isinstance(x, str) else x.decode('utf-8', 'replace')
# 
# def list_keys_to_dict(key_list, callback):
#     return dict.fromkeys(key_list, callback)
# 
# class NodeFlag:
#     BLOCKED = 'blocked'
#     ALL_NODES = 'all-nodes'
#     ALL_MASTERS = 'all-masters'
#     RANDOM = 'random'
#     SLOT_ID = 'slot-id'
# 
# def bool_ok(response):
#     return nativestr(response) == 'OK'


# Path: aredis/commands/scripting.py
from aredis.utils import (dict_merge, nativestr,
                          list_keys_to_dict,
                          NodeFlag, bool_ok)
        from aredis.scripting import Script


    async def script_flush(self):
        """Flushes all scripts from the script cache"""
        return await self.execute_command('SCRIPT FLUSH')

    async def script_kill(self):
        """Kills the currently executing Lua script"""
        return await self.execute_command('SCRIPT KILL')

    async def script_load(self, script):
        """Loads a Lua ``script`` into the script cache. Returns the SHA."""
        return await self.execute_command('SCRIPT LOAD', script)

    def register_script(self, script):
        """
        Registers a Lua ``script`` specifying the ``keys`` it will touch.
        Returns a Script object that is callable and hides the complexity of
        dealing with scripts, keys, and shas. This is the preferred way of
        working with Lua scripts.
        """
        return Script(self, script)


class ClusterScriptingCommandMixin(ScriptingCommandMixin):

    NODES_FLAGS = dict_merge(
        {
        'SCRIPT KILL': NodeFlag.BLOCKED
        },
        list_keys_to_dict(

            ["SCRIPT LOAD", "SCRIPT FLUSH", "SCRIPT EXISTS",], NodeFlag.ALL_MASTERS