Ensures +hash+ is a valid Tuple.
963768
def init_with_hash(hash)
      @tuple = Hash.new
      hash.each do |k, v|
        raise InvalidHashTupleKey unless String === k
        @tuple[k] = v
      end
    end
718596
def path_ok(match_tuple: MatchTuple) -> bool:
    """"""
    relative_path = match_tuple.link.split("#")[0]
    full_path = os.path.join(os.path.dirname(str(match_tuple.source)), relative_path)
    return os.path.exists(full_path)
285498
def filter_to_hash(valid_filters, keys_case=:undescore)
			hashed_filter = {}
			filter.each do |key, value|
				hashed_filter[get_attribute_key(key, keys_case)] = solve_filter_value(key, value)
			end
			return hashed_filter
		end
485220
def argshash(self, args, kwargs):
        ""
        a = repr(args)
        b = repr(sorted((repr(k), repr(v)) for k, v in kwargs.items()))
        return a + b
468639
def _ensure_ifaces_tuple(ifaces):
    """"""
    try:

        ifaces = tuple(ifaces)

    except TypeError:

        ifaces = (ifaces,)

    for iface in ifaces:

        if not _issubclass(iface, ibc.Iface):

            raise TypeError('Can only compare against interfaces.')

    return ifaces
191321
def _hash(number, alphabet):
    """"""
    hashed = ''
    len_alphabet = len(alphabet)
    while True:
        hashed = alphabet[number % len_alphabet] + hashed
        number //= len_alphabet
        if not number:
            return hashed
993455
def validate_wrap(self, value):
        ''' 
        '''
        if not isinstance(value, list) and not isinstance(value, tuple):
            self._fail_validation_type(value, tuple, list)

        for field, value in izip(self.types, list(value)):
            field.validate_wrap(value)
48130
function _is_hash(in_thing){
    var retval = false;
    if( in_thing && us.isObject(in_thing) &&
	! us.isArray(in_thing) &&
	! us.isFunction(in_thing) ){
	retval = true;
    }
    return retval;
}
466862
def key_hash_algo(self, value):
        

        if value not in set(['sha1', 'sha256']):
            raise ValueError(_pretty_message(
                '''
                hash_algo must be one of "sha1", "sha256", not %s
                ''',
                repr(value)
            ))

        self._key_hash_algo = value
896550
def has_hash_of(self, destpath, code, package):
        """"""
        if destpath is not None and os.path.isfile(destpath):
            with openfile(destpath, "r") as opened:
                compiled = readfile(opened)
            hashash = gethash(compiled)
            if hashash is not None and hashash == self.comp.genhash(package, code):
                return compiled
        return None
16119
def __is_valid_pos(pos_tuple, valid_pos):
    # type: (Tuple[text_type,...],List[Tuple[text_type,...]])->bool
    
    def is_valid_pos(valid_pos_tuple):
        # type: (Tuple[text_type,...])->bool
        length_valid_pos_tuple = len(valid_pos_tuple)
        if valid_pos_tuple == pos_tuple[:length_valid_pos_tuple]:
            return True
        else:
            return False

    seq_bool_flags = [is_valid_pos(valid_pos_tuple) for valid_pos_tuple in valid_pos]

    if True in set(seq_bool_flags):
        return True
    else:
        return False
322983
private function validateTuple(array $tuple)
    {
        $keys = array_keys($tuple);
        $count = count($this->items);
        for ($index = 0; $index < $count; $index++) {
            // In the specification is not clear what to do when instance size
            // is less than items size. I chose to pass null and if null passes
            // the validation, it returns true.
            $value = isset($keys[$index]) ? $tuple[$keys[$index]] : null;
            if (!$this->items[$index]->validate($value)) {
                return false;
            }
        }

        return true;
    }
970765
def set_hash(self, algo, digest):
        """"""
        self.algo = algo
        self.digest = digest
847320
def hash_of?(key_clause, value_clause)
      all_keys   = many_with_map?(key_clause, "all keys")     { |kv| kv[0] }
      all_values = many_with_map?(value_clause, "all values") { |kv| kv[1] }
      all? Hash, all_keys, all_values
    end
715465
def _ensure_element(tup, elem):
    
    try:
        return tup, tup.index(elem)
    except ValueError:
        return tuple(chain(tup, (elem,))), len(tup)
1194171
def ensure_tuple(obj):
    """"""
    if obj is None:
        return tuple()
    if isinstance(obj, Iterable) and not isinstance(obj, six.string_types):
        return tuple(obj)
    return obj,
213991
def hash(self):
        '''
        
        '''
        hashed = super(Trunc, self).hash()
        return khash(hashed, self._max_size)