def _chk_truncate(self):
from pandas.core.reshape.concat import concat<EOL>max_cols = self.max_cols<EOL>max_rows = self.max_rows<EOL>if max_cols == <NUM_LIT:0> or max_rows == <NUM_LIT:0>:  <EOL><INDENT>(w, h) = get_terminal_size()<EOL>self.w = w<EOL>self.h = h<EOL>if self.max_rows == <NUM_LIT:0>:<EOL><INDENT>dot_row = <NUM_LIT:1><EOL>prompt_row = <NUM_LIT:1><EOL>if self.show_dimensions:<EOL><INDENT>show_dimension_rows = <NUM_LIT:3><EOL><DEDENT>n_add_rows = (self.header + dot_row + show_dimension_rows +<EOL>prompt_row)<EOL>max_rows_adj = self.h - n_add_rows<EOL>self.max_rows_adj = max_rows_adj<EOL><DEDENT>if max_cols == <NUM_LIT:0> and len(self.frame.columns) > w:<EOL><INDENT>max_cols = w<EOL><DEDENT>if max_rows == <NUM_LIT:0> and len(self.frame) > h:<EOL><INDENT>max_rows = h<EOL><DEDENT><DEDENT>if not hasattr(self, '<STR_LIT>'):<EOL><INDENT>self.max_rows_adj = max_rows<EOL><DEDENT>if not hasattr(self, '<STR_LIT>'):<EOL><INDENT>self.max_cols_adj = max_cols<EOL><DEDENT>max_cols_adj = self.max_cols_adj<EOL>max_rows_adj = self.max_rows_adj<EOL>truncate_h = max_cols_adj and (len(self.columns) > max_cols_adj)<EOL>truncate_v = max_rows_adj and (len(self.frame) > max_rows_adj)<EOL>frame = self.frame<EOL>if truncate_h:<EOL><INDENT>if max_cols_adj == <NUM_LIT:0>:<EOL><INDENT>col_num = len(frame.columns)<EOL><DEDENT>elif max_cols_adj == <NUM_LIT:1>:<EOL><INDENT>frame = frame.iloc[:, :max_cols]<EOL>col_num = max_cols<EOL><DEDENT>else:<EOL><INDENT>col_num = (max_cols_adj // <NUM_LIT:2>)<EOL>frame = concat((frame.iloc[:, :col_num],<EOL>frame.iloc[:, -col_num:]), axis=<NUM_LIT:1>)<EOL><DEDENT>self.tr_col_num = col_num<EOL><DEDENT>if truncate_v:<EOL><INDENT>if max_rows_adj == <NUM_LIT:1>:<EOL><INDENT>row_num = max_rows<EOL>frame = frame.iloc[:max_rows, :]<EOL><DEDENT>else:<EOL><INDENT>row_num = max_rows_adj // <NUM_LIT:2><EOL>frame = concat((frame.iloc[:row_num, :],<EOL>frame.iloc[-row_num:, :]))<EOL><DEDENT>self.tr_row_num = row_num<EOL><DEDENT>self.tr_frame = frame<EOL>self.truncate_h = truncate_h<EOL>self.truncate_v = truncate_v<EOL>self.is_truncated = self.truncate_h or self.truncate_v<EOL>
Checks whether the frame should be truncated. If so, slices
the frame up.