# Path: aredis/utils.py
# _C_EXTENSION_SPEEDUP = False
#     _C_EXTENSION_SPEEDUP = True
# LOOP_DEPRECATED = sys.version_info >= (3, 8)
#     BLOCKED = 'blocked'
#     ALL_NODES = 'all-nodes'
#     ALL_MASTERS = 'all-masters'
#     RANDOM = 'random'
#     SLOT_ID = 'slot-id'
# def b(x):
# def nativestr(x):
# def iteritems(x):
# def iterkeys(x):
# def itervalues(x):
# def ban_python_version_lt(min_version):
#     def decorator(func):
#         def _inner(*args, **kwargs):
#     def __init__(self):
#     def set(self, value):
#     def get(self):
# def string_keys_to_dict(key_string, callback):
# def list_keys_to_dict(key_list, callback):
# def dict_merge(*dicts):
# def bool_ok(response):
# def list_or_args(keys, args):
# def int_or_none(response):
# def pairs_to_dict(response):
# def merge_result(res):
# def first_key(res):
# def blocked_command(self, command):
# def clusterdown_wrapper(func):
#     async def inner(*args, **kwargs):
#     def _crc16(data):
#     def _hash_slot(key):
# class dummy:
# class NodeFlag:
# 
# Path: aredis/exceptions.py
# class ConnectionError(RedisError):
#     pass
# 
# class RedisClusterException(Exception):
#     pass


import random
from aredis.utils import (b, hash_slot)
from aredis.exceptions import (ConnectionError,
                               RedisClusterException)
        from aredis.client import StrictRedis
                 nodemanager_follow_cluster=False, **connection_kwargs):
        """
        :skip_full_coverage_check:
            Skips the check of cluster-require-full-coverage config, useful for clusters
            without the CONFIG command (like aws)
        :nodemanager_follow_cluster:
            The node manager will during initialization try the last set of nodes that
            it was operating on. This will allow the client to drift along side the cluster
            if the cluster nodes move around a slot.
        """
        self.connection_kwargs = connection_kwargs
        self.nodes = {}
        self.slots = {}
        self.startup_nodes = [] if startup_nodes is None else startup_nodes
        self.orig_startup_nodes = self.startup_nodes[:]
        self.reinitialize_counter = 0
        self.reinitialize_steps = reinitialize_steps or 25
        self._skip_full_coverage_check = skip_full_coverage_check
        self.nodemanager_follow_cluster = nodemanager_follow_cluster

        if not self.startup_nodes:
            raise RedisClusterException("No startup nodes provided")

    def encode(self, value):
        """Returns a bytestring representation of the value"""
        if isinstance(value, bytes):
            return value
        elif isinstance(value, int):
            value = b(str(value))
        elif isinstance(value, float):

# Path: aredis/utils.py
# _C_EXTENSION_SPEEDUP = False
#     _C_EXTENSION_SPEEDUP = True
# LOOP_DEPRECATED = sys.version_info >= (3, 8)
#     BLOCKED = 'blocked'
#     ALL_NODES = 'all-nodes'
#     ALL_MASTERS = 'all-masters'
#     RANDOM = 'random'
#     SLOT_ID = 'slot-id'
# def b(x):
# def nativestr(x):
# def iteritems(x):
# def iterkeys(x):
# def itervalues(x):
# def ban_python_version_lt(min_version):
#     def decorator(func):
#         def _inner(*args, **kwargs):
#     def __init__(self):
#     def set(self, value):
#     def get(self):
# def string_keys_to_dict(key_string, callback):
# def list_keys_to_dict(key_list, callback):
# def dict_merge(*dicts):
# def bool_ok(response):
# def list_or_args(keys, args):
# def int_or_none(response):
# def pairs_to_dict(response):
# def merge_result(res):
# def first_key(res):
# def blocked_command(self, command):
# def clusterdown_wrapper(func):
#     async def inner(*args, **kwargs):
#     def _crc16(data):
#     def _hash_slot(key):
# class dummy:
# class NodeFlag:
# 
# Path: aredis/exceptions.py
# class ConnectionError(RedisError):
#     pass
# 
# class RedisClusterException(Exception):
#     pass


# Path: aredis/nodemanager.py
import random
from aredis.utils import (b, hash_slot)
from aredis.exceptions import (ConnectionError,
                               RedisClusterException)
        from aredis.client import StrictRedis

                 nodemanager_follow_cluster=False, **connection_kwargs):
        """
        :skip_full_coverage_check:
            Skips the check of cluster-require-full-coverage config, useful for clusters
            without the CONFIG command (like aws)
        :nodemanager_follow_cluster:
            The node manager will during initialization try the last set of nodes that
            it was operating on. This will allow the client to drift along side the cluster
            if the cluster nodes move around a slot.
        """
        self.connection_kwargs = connection_kwargs
        self.nodes = {}
        self.slots = {}
        self.startup_nodes = [] if startup_nodes is None else startup_nodes
        self.orig_startup_nodes = self.startup_nodes[:]
        self.reinitialize_counter = 0
        self.reinitialize_steps = reinitialize_steps or 25
        self._skip_full_coverage_check = skip_full_coverage_check
        self.nodemanager_follow_cluster = nodemanager_follow_cluster

        if not self.startup_nodes:
            raise RedisClusterException("No startup nodes provided")

    def encode(self, value):
        """Returns a bytestring representation of the value"""
        if isinstance(value, bytes):
            return value
        elif isinstance(value, int):
            value = b(str(value))
        elif isinstance(value, float):

            value = b(repr(value))