def _query_key_maker(self, *args, **kwargs): """Generate hashable keys for the query method The paramaters are scrubbed, turning them into a tuple or tuple of tuples, as needed """ arg_copy = list(args) query = remove_ws(arg_copy.pop(0)).lower() tupled_params = tuplify(arg_copy) kwarg_copy = tuple([(k, v) for k, v in kwargs.iteritems()]) return (self.connection_string.lower(), query, tupled_params, kwarg_copy)
def hex_tupler(l): """Tuplify a list, converting hex strings into bytes""" return tuplify(l, lambda i: hextobytes(i) if is_hex_string(i) else i)