Get the length of a list in Redis

    CLI Example:

    .. code-block:: bash

        salt '*' redis.llen foo_list
176049
def llen(key, host=None, port=None, db=None, password=None):
    '''
    
    '''
    server = _connect(host, port, db, password)
    return server.llen(key)
940275
def get_data_length(self):
        # type: () -> int
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('Directory Record not yet initialized')
        if self.inode is not None:
            return self.inode.get_data_length()
        return self.data_length
917118
def CheckLineLength(filename, linenumber, clean_lines, errors):
    
    line = clean_lines.raw_lines[linenumber]
    if len(line) > _lint_state.linelength:
        return errors(
                filename,
                linenumber,
                'linelength',
                'Lines should be <= %d characters long' %
                    (_lint_state.linelength))
409860
def _get_nop_length(cls, insns):
        

        nop_length = 0

        if insns and cls._is_noop_insn(insns[0]):
            # see where those nop instructions terminate
            for insn in insns:
                if cls._is_noop_insn(insn):
                    nop_length += insn.size
                else:
                    break

        return nop_length
1053253
def size(self, key, resource_type):
        
        with self._objects_queue_lock:
            return len(self._objects_queue[key].get(resource_type, []))
707488
def length(self):
        
        item = self.head
        counter = 0

        while item is not None:
            counter += 1
            item = item.next_node

        return counter
426629
def list_sizes(self, provider=None):
        '''
        
        '''
        mapper = salt.cloud.Map(self._opts_defaults())
        return salt.utils.data.simple_types_filter(
            mapper.size_list(provider)
        )
125839
def ensure_list_size(list_, size_):
    
    lendiff = (size_) - len(list_)
    if lendiff > 0:
        extension = [None for _ in range(lendiff)]
        list_.extend(extension)
1040117
def hstrlen(self, name, key):
        
        with self.pipe as pipe:
            return pipe.hstrlen(self.redis_key(name), key)
628783
def load_data(fname):
    
    print('Loading ' + fname + ' to redis')
    r = redis.StrictRedis(host = '127.0.0.1', port = 6379, db = 0);
    with open(fname, 'r') as f:
        for line_num, row in enumerate(f): 
            if row.strip('') != '':
                if line_num < 100000000:
                    l_key, l_val = parse_n3(row, 'csv')
                    if line_num % 1000 == 0: 
                        print('loading line #', line_num, 'key=', l_key, ' = ', l_val)
                    if l_key != '':
                        r.set(l_key, l_val)
408005
def length_range(string, minimum, maximum):
    
    int_range(len(string), minimum, maximum)
    return string
531233
function (list) {
		var items = [];
		var i = 0;
		var listLength = list.length;

		for (; i < listLength; i++) {
			items.push(list[i]);
		}

		return items;
	}
497045
def calculate_size(name, data_list):
    
    data_size = 0
    data_size += calculate_size_str(name)
    data_size += INT_SIZE_IN_BYTES
    for data_list_item in data_list:
        data_size += calculate_size_data(data_list_item)
    return data_size
1039644
public static function size($list)
    {
        if ($list === null)
            return 0;

        if (is_scalar($list) || is_resource($list))
            return 1;

        if (is_array($list) || $list instanceof \Countable)
            return count($list);

        if ($list instanceof \Traversable)
            return iterator_count($list);

        $count = 0;
        static::each($list, function() use (& $count) { $count++; });
        return $count;
    }
135779
public static int len(String list, String delimiter, boolean ignoreEmpty) {
	if (delimiter.length() == 1) return len(list, delimiter.charAt(0), ignoreEmpty);
	char[] del = delimiter.toCharArray();
	int len = StringUtil.length(list);
	if (len == 0) return 0;

	int count = 0;
	int last = 0;
	char c;

	for (int i = 0; i < len; i++) {
	    c = list.charAt(i);
	    for (int y = 0; y < del.length; y++) {
		if (c == del[y]) {
		    if (!ignoreEmpty || last < i) count++;
		    last = i + 1;
		    break;
		}
	    }
	}
	if (!ignoreEmpty || last < len) count++;
	return count;
    }
402794
public static function getGroupLength($list)
    {
        /**
         * The number of opening brackets found.
         * This counter starts at one because by the time this function called,
         * the list already advanced one position and the opening bracket was
         * already parsed.
         *
         * @var int
         */
        $count = 1;

        /**
         * The length of this group.
         *
         * @var int
         */
        $length = 0;

        for ($idx = $list->idx; $idx < $list->count; ++$idx) {
            // Counting the brackets.
            if ($list->tokens[$idx]->type === Token::TYPE_OPERATOR) {
                if ($list->tokens[$idx]->value === '(') {
                    ++$count;
                } elseif ($list->tokens[$idx]->value === ')') {
                    --$count;
                    if ($count === 0) {
                        break;
                    }
                }
            }

            // Keeping track of this group's length.
            $length += mb_strlen((string) $list->tokens[$idx]->value, 'UTF-8');
        }

        return $length;
    }
1372970
def cmd2list(cmd):
   ''' 
   '''
   p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
   stdout, stderr = p.communicate()
   if p.returncode != 0 and stderr != '':
      return "ERROR: %s\n"%(stderr)
   else:
      return stdout.split('\n')