def compute_sequence_shape(context, builder, ndim, seqty, seq):
 intp_t = context.get_value_type(types.intp)
 zero = Constant.int(intp_t, 0)
 def get_first_item(seqty, seq):
  if isinstance(seqty, types.BaseTuple):
   if (len(seqty) == 0):
    return (None, None)
   else:
    return (seqty[0], builder.extract_value(seq, 0))
  else:
   getitem_impl = _get_borrowing_getitem(context, seqty)
   return (seqty.dtype, getitem_impl(builder, (seq, zero)))
 shapes = []
 (innerty, inner) = (seqty, seq)
 for i in range(ndim):
  shapes.append(_get_seq_size(context, builder, innerty, inner))
  (innerty, inner) = get_first_item(innerty, inner)
 return tuple(shapes)

def compute_sequence_shape ( context , builder , ndim , seqty , seq ) : intp_t = context . get_value_type ( types . intp ) zero = Constant . int ( intp_t , 0 ) def get_first_item ( seqty , seq ) : if isinstance ( seqty , types . BaseTuple ) : if ( len ( seqty ) == 0 ) : return ( None , None ) else : return ( seqty [ 0 ] , builder . extract_value ( seq , 0 ) ) else : getitem_impl = _get_borrowing_getitem ( context , seqty ) return ( seqty . dtype , getitem_impl ( builder , ( seq , zero ) ) ) shapes = [ ] ( innerty , inner ) = ( seqty , seq ) for i in range ( ndim ) : shapes . append ( _get_seq_size ( context , builder , innerty , inner ) ) ( innerty , inner ) = get_first_item ( innerty , inner ) return tuple ( shapes )
compute the likely shape of a nested sequence .