Exemplo n.º 1
0
 def __init__(self, arg, val, operator):
     self.tb = traceback.extract_stack()
     ValueError.__init__(
         self,
         get_error(
             "Outside range: {v} needs to be {o} {v2}".format(
                 v=format_repr(arg), o=operator, v2=format_repr(val)),
             tb=self.tb,
         ),
     )
Exemplo n.º 2
0
 def __init__(self, arg, val, operator):
     self.tb = traceback.extract_stack()
     ValueError.__init__(
         self,
         get_error(
             "Outside range: {v} needs to be {o} {v2}".format(
                 v=format_repr(arg), o=operator, v2=format_repr(val)
             ),
             tb=self.tb,
         ),
     )
Exemplo n.º 3
0
 def __init__(self, shape, dim, shape_names):
     self.tb = traceback.extract_stack()
     shape = format_repr(shape)
     dim = format_repr(dim)
     ValueError.__init__(
         self,
         get_error(
             "Shape mismatch: input {s} not compatible with {d}.".format(
                 s=shape, d=dim),
             tb=self.tb,
         ),
     )
Exemplo n.º 4
0
 def __init__(self, shape, dim, shape_names):
     self.tb = traceback.extract_stack()
     shape = format_repr(shape)
     dim = format_repr(dim)
     ValueError.__init__(
         self,
         get_error(
             "Shape mismatch: input {s} not compatible with {d}.".format(
                 s=shape, d=dim
             ),
             tb=self.tb,
         ),
     )
Exemplo n.º 5
0
 def __init__(self, bad_type, expected):
     if isinstance(expected, str):
         expected = [expected]
     self.tb = traceback.extract_stack()
     TypeError.__init__(
         self,
         get_error(
             "Expected type {e}, but got: {v} ({t})".format(
                 e="/".join(expected), v=format_repr(bad_type), t=type(bad_type)
             ),
             tb=self.tb,
             highlight=format_repr(bad_type),
         ),
     )
Exemplo n.º 6
0
 def __init__(self, bad_type, expected):
     if isinstance(expected, str):
         expected = [expected]
     self.tb = traceback.extract_stack()
     TypeError.__init__(
         self,
         get_error(
             "Expected type {e}, but got: {v} ({t})".format(
                 e="/".join(expected),
                 v=format_repr(bad_type),
                 t=type(bad_type)),
             tb=self.tb,
             highlight=format_repr(bad_type),
         ),
     )
Exemplo n.º 7
0
 def __init__(self, lengths, arg):
     self.tb = traceback.extract_stack()
     ValueError.__init__(
         self,
         get_error(
             "Values need to be equal length: {v}".format(v=format_repr(lengths)),
             tb=self.tb,
         ),
     )
Exemplo n.º 8
0
 def __init__(self, shape, axis):
     self.tb = traceback.extract_stack()
     ValueError.__init__(
         self,
         get_error(
             "Shape mismatch: input {s} has too short for axis {d}.".format(
                 s=format_repr(shape), d=axis),
             tb=self.tb,
         ),
     )
Exemplo n.º 9
0
 def __init__(self, lengths, arg):
     self.tb = traceback.extract_stack()
     ValueError.__init__(
         self,
         get_error(
             "Values need to be equal length: {v}".format(
                 v=format_repr(lengths)),
             tb=self.tb,
         ),
     )
Exemplo n.º 10
0
 def __init__(self, shape, axis):
     self.tb = traceback.extract_stack()
     ValueError.__init__(
         self,
         get_error(
             "Shape mismatch: input {s} has too short for axis {d}.".format(
                 s=format_repr(shape), d=axis
             ),
             tb=self.tb,
         ),
     )