This will iterate only over the last chunk since the name of the last
        chunk indicates how many lines in total exist in all other chunks
163462
def numKeys(self) -> int:
        
        chunks = self._listChunks()
        num_chunks = len(chunks)
        if num_chunks == 0:
            return 0
        count = (num_chunks-1)*self.chunkSize
        last_chunk = self._openChunk(chunks[-1])
        count += sum(1 for _ in last_chunk._lines())
        last_chunk.close()
        return count
941858
def check_against_chunks(self, chunks):
        # type: (Iterator[bytes]) -> None
        
        gots = {}
        for hash_name in iterkeys(self._allowed):
            try:
                gots[hash_name] = hashlib.new(hash_name)
            except (ValueError, TypeError):
                raise InstallationError('Unknown hash name: %s' % hash_name)

        for chunk in chunks:
            for hash in itervalues(gots):
                hash.update(chunk)

        for hash_name, got in iteritems(gots):
            if got.hexdigest() in self._allowed[hash_name]:
                return
        self._raise(gots)
941383
def finalize(self):
        """"""
        for name, count in sorted(self.blocks.items(), key=lambda x: x[1]):
            print('{:3} {}'.format(count, name))
        print('{:3} total'.format(sum(self.blocks.values())))
685962
def clear_last_lines(self, n):
        
        self.term.stream.write(
            self.term.move_up * n + self.term.clear_eos)
        self.term.stream.flush()
1055380
def iter_chunks(chunk_size, iterator):
    ""
    iterator = iter(iterator)
    while True:
        next_chunk = _take_n(chunk_size, iterator)
        # If len(iterable) % chunk_size == 0, don't return an empty chunk.
        if next_chunk:
            yield next_chunk
        else:
            break
1088284
def _iter_chunk_offsets(self):
        
        chunk_offset = 8
        while True:
            chunk_data_len = self._stream_rdr.read_long(chunk_offset)
            chunk_type = self._stream_rdr.read_str(4, chunk_offset, 4)
            data_offset = chunk_offset + 8
            yield chunk_type, data_offset
            if chunk_type == 'IEND':
                break
            # incr offset for chunk len long, chunk type, chunk data, and CRC
            chunk_offset += (4 + 4 + chunk_data_len + 4)
915646
def most_even_chunk(string, group):
    """"""
    counts = [0] + most_even(len(string), group)
    indices = accumulate(counts)
    slices = window(indices, 2)
    return [string[slice(*one)] for one in slices]
1238815
function(n_newlines) {
				if('number' === typeof n_newlines) {
					for(let i=0; i<n_newlines; i++) {
						a_chunks.push('');
					}
				}
				else {
					a_chunks.push('');
				}
			}
446441
private int countLines() {
        InputStream is = IO.buffered(IO.inputStream(file));
        try {
            byte[] c = new byte[1024];

            int readChars = is.read(c);
            if (readChars == -1) {
                // bail out if nothing to read
                return 0;
            }

            // make it easy for the optimizer to tune this loop
            int count = 1;
            while (readChars == 1024) {
                for (int i = 0; i < 1024; ) {
                    if (c[i++] == '\n') {
                        ++count;
                    }
                }
                readChars = is.read(c);
            }

            // count remaining characters
            while (readChars != -1) {
                for (int i = 0; i < readChars; ++i) {
                    if (c[i] == '\n') {
                        ++count;
                    }
                }
                readChars = is.read(c);
            }

            return count;
        } catch (IOException e) {
            throw E.ioException(e);
        } finally {
            IO.close(is);
        }
    }
135258
def count_lines(abspath):
    
    with open(abspath, "rb") as f:
        i = 0
        for line in f:
            i += 1
            pass
        return i
1245385
def count_lines(path, extensions=None, excluded_dirnames=None):
    """"""
    if extensions is None:
        extensions = ['.py', '.pyw', '.ipy', '.enaml', '.c', '.h', '.cpp',
                      '.hpp', '.inc', '.', '.hh', '.hxx', '.cc', '.cxx',
                      '.cl', '.f', '.for', '.f77', '.f90', '.f95', '.f2k',
                      '.f03', '.f08']
    if excluded_dirnames is None:
        excluded_dirnames = ['build', 'dist', '.hg', '.svn']
    def get_filelines(path):
        dfiles, dlines = 0, 0
        if osp.splitext(path)[1] in extensions:
            dfiles = 1
            with open(path, 'rb') as textfile:
                dlines = len(textfile.read().strip().splitlines())
        return dfiles, dlines
    lines = 0
    files = 0
    if osp.isdir(path):
        for dirpath, dirnames, filenames in os.walk(path):
            for d in dirnames[:]:
                if d in excluded_dirnames:
                    dirnames.remove(d)
            if excluded_dirnames is None or \
               osp.dirname(dirpath) not in excluded_dirnames:
                for fname in filenames:
                    dfiles, dlines = get_filelines(osp.join(dirpath, fname))
                    files += dfiles
                    lines += dlines
    else:
        dfiles, dlines = get_filelines(path)
        files += dfiles
        lines += dlines
    return files, lines
1315719
def iter_lines(self, warn_only=False):
        """"""
        remain = ""
        for data in self.iter_content(LINE_CHUNK_SIZE, warn_only=True):
            line_break_found = data[-1] in (b"\n", b"\r")
            lines = data.decode(self.codec).splitlines()
            lines[0] = remain + lines[0]
            if not line_break_found:
                remain = lines.pop()
            for line in lines:
                yield line
        if remain:
            yield remain

        self._state = FINISHED
        if not warn_only:
            self.raise_for_error()
839162
def last(self, name, value):
        
        for counter in self._counters:
            counter.last(name, value)
642557
def per_section(it, is_delimiter=lambda x: x.isspace()):
    
    ret = []
    for line in it:
        if is_delimiter(line):
            if ret:
                yield ret  # OR  ''.join(ret)
                ret = []
        else:
            ret.append(line.rstrip())  # OR  ret.append(line)
    if ret:
        yield ret
844281
def count_lines(fname, mode='rU'):
    '''
    '''

    with open(fname, mode) as f:
        for i, l in enumerate(f):
            pass
    return i + 1
126501
function countLines (str) {
  if (str) {
    let lines = str.match(/\n/g);
    if (lines) {
      return lines.length;
    }
  }
  return 0;
}
1298019
def _chunkForSend(self, data):
        
        LIMIT = self.CHUNK_LIMIT
        for i in range(0, len(data), LIMIT):
            yield data[i:i + LIMIT]