nodes: 0, module; 1, function_definition; 2, function_name:_draw_banner; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, expression_statement; 16, expression_statement; 17, if_statement; 18, expression_statement; 19, comment:"""
          Draw the banner with sorting options at the top of the page
          """; 20, assignment; 21, assignment; 22, call; 23, call; 24, assignment; 25, assignment; 26, assignment; 27, assignment; 28, assignment; 29, call; 30, comparison_operator:self.content.order is not None; 31, block; 32, augmented_assignment; 33, pattern_list; 34, call; 35, identifier:window; 36, call; 37, attribute; 38, argument_list; 39, attribute; 40, argument_list; 41, identifier:banner; 42, conditional_expression:docs.BANNER_SEARCH if self.content.query else self.BANNER; 43, identifier:items; 44, call; 45, identifier:distance; 46, binary_operator:(n_cols - sum(len(t) for t in items) - 1) / (len(items) - 1); 47, identifier:spacing; 48, binary_operator:max(1, int(distance)) * ' '; 49, identifier:text; 50, call; 51, attribute; 52, argument_list; 53, attribute; 54, None; 55, expression_statement; 56, expression_statement; 57, expression_statement; 58, expression_statement; 59, attribute; 60, integer:1; 61, identifier:n_rows; 62, identifier:n_cols; 63, attribute; 64, argument_list; 65, attribute; 66, argument_list; 67, identifier:window; 68, identifier:erase; 69, identifier:window; 70, identifier:bkgd; 71, call; 72, call; 73, attribute; 74, attribute; 75, attribute; 76, attribute; 77, argument_list; 78, parenthesized_expression; 79, parenthesized_expression; 80, call; 81, string; 82, attribute; 83, argument_list; 84, attribute; 85, identifier:add_line; 86, identifier:window; 87, identifier:text; 88, integer:0; 89, integer:0; 90, attribute; 91, identifier:order; 92, assignment; 93, assignment; 94, assignment; 95, call; 96, identifier:self; 97, identifier:_row; 98, attribute; 99, identifier:getmaxyx; 100, attribute; 101, identifier:derwin; 102, integer:1; 103, identifier:n_cols; 104, attribute; 105, integer:0; 106, identifier:str; 107, argument_list; 108, attribute; 109, argument_list; 110, identifier:docs; 111, identifier:BANNER_SEARCH; 112, attribute; 113, identifier:query; 114, identifier:self; 115, identifier:BANNER; 116, call; 117, identifier:split; 118, string; 119, binary_operator:n_cols - sum(len(t) for t in items) - 1; 120, binary_operator:len(items) - 1; 121, identifier:max; 122, argument_list; 123, string_content:; 124, identifier:spacing; 125, identifier:join; 126, identifier:items; 127, identifier:self; 128, identifier:term; 129, identifier:self; 130, identifier:content; 131, identifier:order; 132, subscript; 133, identifier:col; 134, binary_operator:text.find(order) - 3; 135, identifier:attr; 136, call; 137, attribute; 138, argument_list; 139, attribute; 140, identifier:stdscr; 141, attribute; 142, identifier:stdscr; 143, identifier:self; 144, identifier:_row; 145, string; 146, attribute; 147, identifier:attr; 148, string; 149, identifier:self; 150, identifier:content; 151, attribute; 152, argument_list; 153, string_content:; 154, binary_operator:n_cols - sum(len(t) for t in items); 155, integer:1; 156, call; 157, integer:1; 158, integer:1; 159, call; 160, call; 161, integer:0; 162, call; 163, integer:3; 164, attribute; 165, argument_list; 166, identifier:window; 167, identifier:chgat; 168, integer:0; 169, identifier:col; 170, integer:3; 171, identifier:attr; 172, identifier:self; 173, identifier:term; 174, identifier:self; 175, identifier:term; 176, string_content:; 177, identifier:self; 178, identifier:term; 179, string_content:OrderBar; 180, identifier:banner; 181, identifier:strip; 182, identifier:n_cols; 183, call; 184, identifier:len; 185, argument_list; 186, identifier:int; 187, argument_list; 188, attribute; 189, argument_list; 190, attribute; 191, argument_list; 192, attribute; 193, identifier:attr; 194, string; 195, identifier:sum; 196, generator_expression; 197, identifier:items; 198, identifier:distance; 199, attribute; 200, identifier:split; 201, string; 202, identifier:text; 203, identifier:find; 204, identifier:order; 205, identifier:self; 206, identifier:term; 207, string_content:OrderBarHighlight; 208, call; 209, for_in_clause; 210, attribute; 211, identifier:order; 212, string_content:-; 213, identifier:len; 214, argument_list; 215, identifier:t; 216, identifier:items; 217, identifier:self; 218, identifier:content; 219, identifier:t
code: def _draw_banner(self):
          """
          Draw the banner with sorting options at the top of the page
          """
          n_rows, n_cols = self.term.stdscr.getmaxyx()
          window = self.term.stdscr.derwin(1, n_cols, self._row, 0)
          window.erase()
          window.bkgd(str(' '), self.term.attr('OrderBar'))
  
          banner = docs.BANNER_SEARCH if self.content.query else self.BANNER
          items = banner.strip().split(' ')
  
          distance = (n_cols - sum(len(t) for t in items) - 1) / (len(items) - 1)
          spacing = max(1, int(distance)) * ' '
          text = spacing.join(items)
          self.term.add_line(window, text, 0, 0)
          if self.content.order is not None:
              order = self.content.order.split('-')[0]
              col = text.find(order) - 3
              attr = self.term.attr('OrderBarHighlight')
              window.chgat(0, col, 3, attr)
  
          self._row += 1