def run(self, head_rows, tail_rows=None, n_rows=None):
from .exceptions import RowIntuitError<EOL>header_rows = []<EOL>found_header = False<EOL>MIN_SKIP_ROWS = <NUM_LIT:30><EOL>try:<EOL><INDENT>data_pattern_skip_rows = min(MIN_SKIP_ROWS, len(head_rows) - <NUM_LIT:8>)<EOL><DEDENT>except TypeError:<EOL><INDENT>raise RowIntuitError("<STR_LIT>")<EOL><DEDENT>try:<EOL><INDENT>data_pattern, self.data_pattern_source, n_cols = self.data_pattern(head_rows[data_pattern_skip_rows:])<EOL><DEDENT>except Exception as e:<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>raise<EOL><DEDENT>patterns = ([('<STR_LIT:D>', data_pattern),<EOL>('<STR_LIT:H>', re.compile(r'<STR_LIT>'.format(max(<NUM_LIT:3>, n_cols/<NUM_LIT:8>),max(<NUM_LIT:3>,n_cols/<NUM_LIT:4>)))),<EOL>] +<EOL>list(self.patterns))<EOL>if self.debug:<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>for e in patterns:<EOL><INDENT>logger.debug("<STR_LIT>".format(e[<NUM_LIT:0>], e[<NUM_LIT:1>].pattern))<EOL><DEDENT><DEDENT>for i, row in enumerate(head_rows):<EOL><INDENT>picture = self.picture(row)<EOL>label = self.match_picture(picture, patterns)<EOL>try:<EOL><INDENT>if label != '<STR_LIT:B>' and len(re.search('<STR_LIT>', picture).group(<NUM_LIT:0>)) > len(row)/<NUM_LIT:2>:<EOL><INDENT>label = '<STR_LIT:C>'<EOL><DEDENT><DEDENT>except AttributeError:<EOL><INDENT>pass  <EOL><DEDENT>if not found_header and label == '<STR_LIT:H>':<EOL><INDENT>found_header = True<EOL><DEDENT>if label is False:<EOL><INDENT>if found_header:<EOL><INDENT>label = '<STR_LIT:D>'<EOL><DEDENT>else:<EOL><INDENT>found_header = True<EOL>label = '<STR_LIT:H>'<EOL><DEDENT><DEDENT>if self.debug:<EOL><INDENT>logger.debug("<STR_LIT>".format(i, label, picture, row))<EOL><DEDENT>if label == '<STR_LIT:C>':<EOL><INDENT>self.comment_lines.append(i)<EOL><DEDENT>elif label == '<STR_LIT:H>':<EOL><INDENT>self.header_lines.append(i)<EOL>header_rows.append(row)<EOL><DEDENT>elif label == '<STR_LIT:D>':<EOL><INDENT>self.start_line = i<EOL>self.headers = self.coalesce_headers(header_rows)<EOL>break<EOL><DEDENT><DEDENT>if tail_rows:<EOL><INDENT>from itertools import takewhile, islice<EOL>for i, row in enumerate(islice(reversed(tail_rows), <NUM_LIT:0>, <NUM_LIT:10>)):<EOL><INDENT>picture = self.picture(row)<EOL>label = self.match_picture(picture, patterns)<EOL>logger.debug("<STR_LIT>".format(i, label, picture, row))<EOL><DEDENT>labels = reversed(list(self.match_picture(self.picture(row), patterns) for row in tail_rows))<EOL>end_line = len(list(takewhile(lambda x: x == '<STR_LIT:C>' or x == '<STR_LIT:B>' or x == '<STR_LIT:H>', labels)))<EOL>if end_line:<EOL><INDENT>self.end_line = n_rows-end_line-<NUM_LIT:1><EOL><DEDENT><DEDENT>return self<EOL>
Run the intuition process
:param head_rows: A list of rows from the start of the file. Should have at least 30 rows
:param tail_rows: A list of rows from the end of the file. Optional, but should have at least 30 rows
:param n_rows: Total number of rows, if a subset was provided in head_rows
:return: