nodes: 0, module; 1, function_definition; 2, function_name:do_summary; 3, parameters; 4, block; 5, identifier:self; 6, identifier:params; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# what slice do we want?; 11, if_statement; 12, expression_statement; 13, for_statement; 14, comment:"""
  \x1b[1mNAME\x1b[0m
          summary - Prints summarized details of a path's children
  
  \x1b[1mSYNOPSIS\x1b[0m
          summary [path] [top]
  
  \x1b[1mDESCRIPTION\x1b[0m
          The results are sorted by name.
  
  \x1b[1mOPTIONS\x1b[0m
          * path: the path (default: cwd)
          * top: number of results to be displayed (0 is all) (default: 0)
  
  \x1b[1mEXAMPLES\x1b[0m
          > summary /services/registrations
          Created                    Last modified               Owner                Name
          Thu Oct 11 09:14:39 2014   Thu Oct 11 09:14:39 2014     -                   bar
          Thu Oct 16 18:54:39 2014   Thu Oct 16 18:54:39 2014     -                   foo
          Thu Oct 12 10:04:01 2014   Thu Oct 12 10:04:01 2014     0x14911e869aa0dc1   member_0000001
  
          """; 15, call; 16, assignment; 17, comparison_operator:params.top == 0; 18, block; 19, elif_clause; 20, else_clause; 21, assignment; 22, identifier:i; 23, call; 24, block; 25, attribute; 26, argument_list; 27, identifier:results; 28, call; 29, attribute; 30, integer:0; 31, expression_statement; 32, comparison_operator:params.top > 0; 33, block; 34, block; 35, identifier:offs; 36, conditional_expression:1 if params.path == "/" else len(params.path) + 1; 37, identifier:range; 38, argument_list; 39, expression_statement; 40, expression_statement; 41, identifier:self; 42, identifier:show_output; 43, string:"%s%s%s%s"; 44, call; 45, call; 46, call; 47, string:"Name"; 48, identifier:sorted; 49, argument_list; 50, identifier:params; 51, identifier:top; 52, assignment; 53, attribute; 54, integer:0; 55, expression_statement; 56, expression_statement; 57, expression_statement; 58, integer:1; 59, comparison_operator:params.path == "/"; 60, binary_operator:len(params.path) + 1; 61, identifier:start; 62, identifier:end; 63, assignment; 64, call; 65, attribute; 66, argument_list; 67, attribute; 68, argument_list; 69, attribute; 70, argument_list; 71, call; 72, pattern_list; 73, expression_list; 74, identifier:params; 75, identifier:top; 76, assignment; 77, assignment; 78, assignment; 79, attribute; 80, string:"/"; 81, call; 82, integer:1; 83, pattern_list; 84, subscript; 85, attribute; 86, argument_list; 87, string:"Created"; 88, identifier:ljust; 89, integer:32; 90, string:"Last modified"; 91, identifier:ljust; 92, integer:32; 93, string:"Owner"; 94, identifier:ljust; 95, integer:23; 96, attribute; 97, argument_list; 98, identifier:start; 99, identifier:end; 100, integer:0; 101, call; 102, pattern_list; 103, expression_list; 104, identifier:start; 105, conditional_expression:len(results) + params.top if abs(params.top) < len(results) else 0; 106, identifier:end; 107, call; 108, identifier:params; 109, identifier:path; 110, identifier:len; 111, argument_list; 112, identifier:path; 113, identifier:stat; 114, identifier:results; 115, identifier:i; 116, identifier:self; 117, identifier:show_output; 118, string:"%s%s%s%s"; 119, call; 120, call; 121, call; 122, subscript; 123, attribute; 124, identifier:stat_map; 125, attribute; 126, identifier:len; 127, argument_list; 128, identifier:start; 129, identifier:end; 130, integer:0; 131, conditional_expression:params.top if params.top < len(results) else len(results); 132, binary_operator:len(results) + params.top; 133, comparison_operator:abs(params.top) < len(results); 134, integer:0; 135, identifier:len; 136, argument_list; 137, attribute; 138, attribute; 139, argument_list; 140, attribute; 141, argument_list; 142, attribute; 143, argument_list; 144, identifier:path; 145, slice; 146, identifier:self; 147, identifier:_zk; 148, identifier:params; 149, identifier:path; 150, identifier:results; 151, attribute; 152, comparison_operator:params.top < len(results); 153, call; 154, call; 155, attribute; 156, call; 157, call; 158, identifier:results; 159, identifier:params; 160, identifier:path; 161, call; 162, identifier:ljust; 163, integer:32; 164, call; 165, identifier:ljust; 166, integer:32; 167, parenthesized_expression; 168, identifier:ljust; 169, integer:23; 170, identifier:offs; 171, identifier:params; 172, identifier:top; 173, attribute; 174, call; 175, identifier:len; 176, argument_list; 177, identifier:len; 178, argument_list; 179, identifier:params; 180, identifier:top; 181, identifier:abs; 182, argument_list; 183, identifier:len; 184, argument_list; 185, attribute; 186, argument_list; 187, attribute; 188, argument_list; 189, binary_operator:"0x%x" % stat.ephemeralOwner; 190, identifier:params; 191, identifier:top; 192, identifier:len; 193, argument_list; 194, identifier:results; 195, identifier:results; 196, attribute; 197, identifier:results; 198, identifier:time; 199, identifier:ctime; 200, attribute; 201, identifier:time; 202, identifier:ctime; 203, attribute; 204, string:"0x%x"; 205, attribute; 206, identifier:results; 207, identifier:params; 208, identifier:top; 209, identifier:stat; 210, identifier:created; 211, identifier:stat; 212, identifier:last_modified; 213, identifier:stat; 214, identifier:ephemeralOwner
code: def do_summary(self, params):
          """
  \x1b[1mNAME\x1b[0m
          summary - Prints summarized details of a path's children
  
  \x1b[1mSYNOPSIS\x1b[0m
          summary [path] [top]
  
  \x1b[1mDESCRIPTION\x1b[0m
          The results are sorted by name.
  
  \x1b[1mOPTIONS\x1b[0m
          * path: the path (default: cwd)
          * top: number of results to be displayed (0 is all) (default: 0)
  
  \x1b[1mEXAMPLES\x1b[0m
          > summary /services/registrations
          Created                    Last modified               Owner                Name
          Thu Oct 11 09:14:39 2014   Thu Oct 11 09:14:39 2014     -                   bar
          Thu Oct 16 18:54:39 2014   Thu Oct 16 18:54:39 2014     -                   foo
          Thu Oct 12 10:04:01 2014   Thu Oct 12 10:04:01 2014     0x14911e869aa0dc1   member_0000001
  
          """
  
          self.show_output("%s%s%s%s",
                           "Created".ljust(32),
                           "Last modified".ljust(32),
                           "Owner".ljust(23),
                           "Name")
  
          results = sorted(self._zk.stat_map(params.path))
  
          # what slice do we want?
          if params.top == 0:
              start, end = 0, len(results)
          elif params.top > 0:
              start, end = 0, params.top if params.top < len(results) else len(results)
          else:
              start = len(results) + params.top if abs(params.top) < len(results) else 0
              end = len(results)
  
          offs = 1 if params.path == "/" else len(params.path) + 1
          for i in range(start, end):
              path, stat = results[i]
  
              self.show_output(
                  "%s%s%s%s",
                  time.ctime(stat.created).ljust(32),
                  time.ctime(stat.last_modified).ljust(32),
                  ("0x%x" % stat.ephemeralOwner).ljust(23),
                  path[offs:]
              )