示例#1
0
    def __eq__(self, other):
        if self.shape != _shape(other):
            return False

        if self.__origin__ is getattr(other, '__origin__', None):
            if self.shape != other.shape:
                return False
            return all(x == y for (x, y) in zip(self.flat, other.flat))
        else:
            return all(x == y for (x, y) in zip(self, other))
示例#2
0
    def __eq__(self, other):
        if self.shape != _shape(other):
            return False

        if self.__origin__ is getattr(other, '__origin__', None):
            if self.shape != other.shape:
                return False
            return all(x == y for (x, y) in zip(self.flat, other.flat))
        else:
            return all(x == y for (x, y) in zip(self, other))
示例#3
0
 def __abstract_new__(cls, *args, shape=None, dtype=None):
     """
     This function is called when user tries to instantiate an abstract
     type. It just finds the proper concrete type and instantiate it.
     """
     if dtype is None:
         dtype = _dtype(args)
     if shape is None:
         shape = _shape(args)
     return cls[shape + (dtype, )](*args)
示例#4
0
 def __abstract_new__(cls, *args, shape=None, dtype=None):
     """
     This function is called when user tries to instantiate an abstract
     type. It just finds the proper concrete type and instantiate it.
     """
     if dtype is None:
         dtype = _dtype(args)
     if shape is None:
         shape = _shape(args)
     return cls[shape + (dtype,)](*args)