def convert(t, convstr=True):
 for (i, op) in enumerate(t.op):
  context.clear_status()
  if (op in RoundModes):
   t.cop.append(op)
   t.pop.append(op)
  elif (((not t.contextfunc) and (i == 0)) or (convstr and isinstance(op, str))):
   try:
    c = C.Decimal(op)
    cex = None
   except (TypeError, ValueError, OverflowError) as e:
    c = None
    cex = e.__class__
   try:
    p = RestrictedDecimal(op)
    pex = None
   except (TypeError, ValueError, OverflowError) as e:
    p = None
    pex = e.__class__
   t.cop.append(c)
   t.cex.append(cex)
   t.pop.append(p)
   t.pex.append(pex)
   if (cex is pex):
    if ((str(c) != str(p)) or (not context.assert_eq_status())):
     raise_error(t)
    if (cex and pex):
     return 0
   else:
    raise_error(t)
  elif isinstance(op, Context):
   t.context = op
   t.cop.append(op.c)
   t.pop.append(op.p)
  else:
   t.cop.append(op)
   t.pop.append(op)
 return 1

def convert ( t , convstr = True ) : for ( i , op ) in enumerate ( t . op ) : context . clear_status ( ) if ( op in RoundModes ) : t . cop . append ( op ) t . pop . append ( op ) elif ( ( ( not t . contextfunc ) and ( i == 0 ) ) or ( convstr and isinstance ( op , str ) ) ) : try : c = C . Decimal ( op ) cex = None except ( TypeError , ValueError , OverflowError ) as e : c = None cex = e . __class__ try : p = RestrictedDecimal ( op ) pex = None except ( TypeError , ValueError , OverflowError ) as e : p = None pex = e . __class__ t . cop . append ( c ) t . cex . append ( cex ) t . pop . append ( p ) t . pex . append ( pex ) if ( cex is pex ) : if ( ( str ( c ) != str ( p ) ) or ( not context . assert_eq_status ( ) ) ) : raise_error ( t ) if ( cex and pex ) : return 0 else : raise_error ( t ) elif isinstance ( op , Context ) : t . context = op t . cop . append ( op . c ) t . pop . append ( op . p ) else : t . cop . append ( op ) t . pop . append ( op ) return 1
convert the input to a properly typed numpy value according to the current casting policy .