Split line and check number of columns
186244
def _split_line(self, line_str):
        """"""
        arr = line_str.rstrip().split("\t")
        if len(arr) != self.expected_fields:
            raise exceptions.InvalidRecordException(
                (
                    "The line contains an invalid number of fields. Was "
                    "{} but expected {}\n{}".format(len(arr), 9 + len(self.samples.names), line_str)
                )
            )
        return arr
684521
def readline(self):
        """"""
        if self.line_number >= self.total_lines:
            return ''
        line = self.lines[self.line_number]
        self.line_number += 1
        if self.indent_char is None and line[:1] in WHITESPACE:
            self.indent_char = line[0]
        return line
121338
def _number_of_line(member_tuple):
    """"""
    member = member_tuple[1]
    try:
        return member.__code__.co_firstlineno
    except AttributeError:
        pass
    try:
        return inspect.findsource(member)[1]
    except BaseException:
        pass
    for value in vars(member).values():
        try:
            return value.__code__.co_firstlineno
        except AttributeError:
            pass
    return 0
388464
def pad(lines, delim):
	
	"""
	Populates text into chunks. If the delim was & then
	['12 & 344', '344 & 8', '8 & 88'] would be stored in chunks as
	[['12', '344', '8'], ['344', '8', '88']]
	"""
	chunks = []
	for i in range(len(lines)):
		line = lines[i]
		sections = line.split(delim)
		for j in range(len(sections)):
			if len(chunks) <= j:
				chunks.append([])
			chunks[j].append(sections[j])

	"""
	Calculates & Stores the max length of chunks
	"""
	max_lengths = []
	for i in range(len(chunks)):
		_max = max([len(j) for j in chunks[i]])
		max_lengths.append(_max)

	"""
	Pads the children of chunks according to the chunk's max length" \
	"""
	for i in range(len(chunks)):
		for j in range(len(chunks[i])):
			chunks[i][j] += (max_lengths[i] - len(chunks[i][j])) * ' '
	new_lines = ['' for i in range(len(lines))]

	for i in range(len(chunks)):
		for j in range(len(chunks[i])):
			new_lines[j] += chunks[i][j]
	return new_lines
71008
def _leading_space_count(line):
    """"""
    i = 0
    while i < len(line) and line[i] == ' ':
        i += 1
    return i
1149622
def columnize(rows):
    ''

    ## find all character columns that are not spaces
    allNonspaces = set()
    allNonspaces.add(max(len(r) for r in rows)+1)
    for r in rows:
        for i, ch in enumerate(r):
            if not ch.isspace():
                allNonspaces.add(i)

    colstart = 0
    prev = 0

    # collapse fields
    for i in allNonspaces:
        if i > prev+1:
            yield colstart, prev+1
            colstart = i
        prev = i
940672
def multiline_input():
    """"""
    lines = []
    while True:
        try:
            lines.append(input())
        except EOFError:
            break

    return "\n".join(lines).strip()
4765
def width_aware_splitlines(self, columns):
        # type: (int) -> Iterator[FmtStr]
        
        if columns < 2:
            raise ValueError("Column width %s is too narrow." % columns)
        if wcswidth(self.s) == -1:
            raise ValueError('bad values for width aware slicing')
        return self._width_aware_splitlines(columns)
211330
def split_input_output(self, text):
        """"""
        lines = _to_lines(text)
        i = 0
        for line in lines:
            if _starts_with_regex(line, self.input_prompt_regex):
                i += 1
            else:
                break
        return lines[:i], lines[i:]
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))
1349058
def _strip_counters(self, sub_line):
        """"""
        try:
            end = sub_line.rindex('}')
        except ValueError:
            return sub_line
        else:
            return sub_line[:(end + 1)]
153733
def _get_two_lines(f):
    
    l0 = f.readline()
    l1 = f.readline()
    return l0, l1
117239
public static int getNumberOfColumnsInFile(String filename, String delimiter) {
    try {
      BufferedReader in = new BufferedReader(new FileReader(filename));
      String line;
      while ((line = in.readLine()) != null) {
        String[] parts = line.split(delimiter);
        in.close();
        return parts.length;
      }
      in.close();
      // File is empty.
      return 0;
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
403408
def line_range(self, line_number):
    """"""
    if line_number <= 0 or line_number > len(self.lines):
      raise IndexError('NOTE: Python file line numbers are offset by 1.')

    if line_number not in self.logical_lines:
      return slice(line_number, line_number + 1)
    else:
      start, stop, _ = self.logical_lines[line_number]
      return slice(start, stop)
318961
def separator_line(cls, sep='-', size=10):
        
        if cls.intty():
            cls.echo(sep * size)
7820
def split_lines(source, maxline=79):
    
    result = []
    extend = result.extend
    append = result.append
    line = []
    multiline = False
    count = 0
    find = str.find
    for item in source:
        index = find(item, '\n')
        if index:
            line.append(item)
            multiline = index > 0
            count += len(item)
        else:
            if line:
                if count <= maxline or multiline:
                    extend(line)
                else:
                    wrap_line(line, maxline, result)
                count = 0
                multiline = False
                line = []
            append(item)
    return result
586757
function splitInLines() {
            let legendEntries = svg.selectAll('.legend-entry');
            let numberOfEntries = legendEntries.size();
            let lineHeight = (chartHeight / 2) * 1.7;
            let newLine = svg.select('.legend-group')
              .append('g')
                .classed('legend-line', true)
                .attr('transform', `translate(0, ${lineHeight})`);
            let lastEntry = legendEntries.filter(`:nth-child(${numberOfEntries})`);

            lastEntry.attr('transform', `translate(${markerSize},0)`);
            newLine.append(() => lastEntry.node());
        }