nodes: 0, module; 1, function_definition; 2, function_name:get_sorted_graph; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, with_statement; 14, if_statement; 15, return_statement; 16, identifier:start; 17, integer:0; 18, identifier:stop; 19, integer:100; 20, identifier:slices; 21, integer:100; 22, identifier:include_inf; 23, False; 24, identifier:exact; 25, False; 26, comment:""" Returns a graph of the distribution of jobs in a sorted set """; 27, not_operator; 28, block; 29, with_clause; 30, block; 31, identifier:include_inf; 32, block; 33, identifier:data; 34, attribute; 35, raise_statement; 36, with_item; 37, expression_statement; 38, for_statement; 39, if_statement; 40, expression_statement; 41, return_statement; 42, identifier:self; 43, identifier:is_sorted; 44, call; 45, as_pattern; 46, assignment; 47, identifier:i; 48, call; 49, block; 50, identifier:include_inf; 51, block; 52, assignment; 53, binary_operator:data[-1:] + data[:-1]; 54, identifier:Exception; 55, argument_list; 56, call; 57, as_pattern_target; 58, identifier:interval; 59, call; 60, identifier:range; 61, argument_list; 62, expression_statement; 63, expression_statement; 64, expression_statement; 65, identifier:data; 66, call; 67, subscript; 68, subscript; 69, string:"Not a sorted queue"; 70, attribute; 71, argument_list; 72, identifier:pipe; 73, identifier:old_div; 74, argument_list; 75, integer:0; 76, identifier:slices; 77, call; 78, call; 79, call; 80, attribute; 81, argument_list; 82, identifier:data; 83, slice; 84, identifier:data; 85, slice; 86, attribute; 87, identifier:pipeline; 88, keyword_argument; 89, call; 90, identifier:slices; 91, attribute; 92, argument_list; 93, attribute; 94, argument_list; 95, attribute; 96, argument_list; 97, identifier:pipe; 98, identifier:execute; 99, unary_operator; 100, unary_operator; 101, attribute; 102, identifier:redis; 103, identifier:transaction; 104, identifier:exact; 105, identifier:float; 106, argument_list; 107, identifier:pipe; 108, identifier:zcount; 109, attribute; 110, parenthesized_expression; 111, binary_operator:"(%s" % (start + (i + 1) * interval); 112, identifier:pipe; 113, identifier:zcount; 114, attribute; 115, identifier:stop; 116, string:"+inf"; 117, identifier:pipe; 118, identifier:zcount; 119, attribute; 120, string:"-inf"; 121, binary_operator:"(%s" % start; 122, integer:1; 123, integer:1; 124, identifier:context; 125, identifier:connections; 126, binary_operator:stop - start; 127, identifier:self; 128, identifier:redis_key; 129, binary_operator:start + i * interval; 130, string:"(%s"; 131, parenthesized_expression; 132, identifier:self; 133, identifier:redis_key; 134, identifier:self; 135, identifier:redis_key; 136, string:"(%s"; 137, identifier:start; 138, identifier:stop; 139, identifier:start; 140, identifier:start; 141, binary_operator:i * interval; 142, binary_operator:start + (i + 1) * interval; 143, identifier:i; 144, identifier:interval; 145, identifier:start; 146, binary_operator:(i + 1) * interval; 147, parenthesized_expression; 148, identifier:interval; 149, binary_operator:i + 1; 150, identifier:i; 151, integer:1
code: def get_sorted_graph(
              self,
              start=0,
              stop=100,
              slices=100,
              include_inf=False,
              exact=False):
          """ Returns a graph of the distribution of jobs in a sorted set """
  
          if not self.is_sorted:
              raise Exception("Not a sorted queue")
  
          with context.connections.redis.pipeline(transaction=exact) as pipe:
              interval = old_div(float(stop - start), slices)
              for i in range(0, slices):
                  pipe.zcount(self.redis_key,
                              (start + i * interval),
                              "(%s" % (start + (i + 1) * interval))
              if include_inf:
                  pipe.zcount(self.redis_key, stop, "+inf")
                  pipe.zcount(self.redis_key, "-inf", "(%s" % start)
              data = pipe.execute()
  
          if include_inf:
              return data[-1:] + data[:-1]
  
          return data