<s> def get_lines_from_file ( filepath = None , culprit_lineno = <NUM_LIT:0> ) : <EOL> pre_context , post_context , context_line = [ ] , [ ] , [ ] <EOL> file_contents = open ( filepath ) . readlines ( ) <EOL> actual_culprit_lineno = culprit_lineno - <NUM_LIT:1> <EOL> actual_culprit_lineno = <NUM_LIT:0> if actual_culprit_lineno < <NUM_LIT:0> else actual_culprit_lineno <EOL> pre_culprit_lines = actual_culprit_lineno - <NUM_LIT:5> <EOL> pre_culprit_lines = <NUM_LIT:0> if pre_culprit_lines < <NUM_LIT:0> else pre_culprit_lines <EOL> for i in range ( pre_culprit_lines , actual_culprit_lineno ) : <EOL> line = file_contents [ i ] if len ( file_contents ) > i else False <EOL> if line is not False : <EOL> pre_context . append ( ( i + <NUM_LIT:1> , line ) ) <EOL> post_culprit_lines = actual_culprit_lineno + <NUM_LIT:5> <EOL> post_culprit_index_start = actual_culprit_lineno + <NUM_LIT:1> <EOL> for i in range ( post_culprit_index_start , post_culprit_lines ) : <EOL> line = file_contents [ i ] if len ( file_contents ) > i else False <EOL> if line is not False : <EOL> post_context . append ( ( i + <NUM_LIT:1> , line ) ) <EOL> context_line_contents = file_contents [ actual_culprit_lineno ] if len ( file_contents ) > actual_culprit_lineno else False <EOL> if context_line_contents is not False : <EOL> context_line = ( culprit_lineno , context_line_contents ) <EOL> context_dict = { <EOL> '<STR_LIT>' : culprit_lineno , <EOL> '<STR_LIT>' : filepath , <EOL> '<STR_LIT>' : pre_context , <EOL> '<STR_LIT>' : context_line , <EOL> '<STR_LIT>' : post_context , <EOL> } <EOL> return context_dict </s>
