Ejemplo n.º 1
0
Archivo: probe.py Proyecto: nengo/nengo
    def coerce(self, probe, target):
        obj = target.obj if isinstance(target, ObjView) else target
        if not hasattr(obj, 'probeable'):
            raise ValidationError("Type %r is not probeable"
                                  % type(obj).__name__,
                                  attr=self.name, obj=probe)

        # do this after; better to know that type is not Probable first
        if isinstance(obj, LearningRule):
            # TODO: this special case should be able to be removed with #1310
            return Parameter.coerce(self, probe, target)
        else:
            return super().coerce(probe, target)
Ejemplo n.º 2
0
    def coerce(self, probe, target):
        obj = target.obj if isinstance(target, ObjView) else target
        if not hasattr(obj, 'probeable'):
            raise ValidationError("Type %r is not probeable" %
                                  type(obj).__name__,
                                  attr=self.name,
                                  obj=probe)

        # do this after; better to know that type is not Probable first
        if isinstance(obj, LearningRule):
            # TODO: this special case should be able to be removed with #1310
            return Parameter.coerce(self, probe, target)
        else:
            return super().coerce(probe, target)
Ejemplo n.º 3
0
    def coerce(self, probe, target):  # pylint: disable=arguments-renamed
        obj = target.obj if isinstance(target, ObjView) else target
        if not hasattr(obj, "probeable"):
            raise ValidationError(
                f"Type '{type(obj).__name__}' is not probeable",
                attr=self.name,
                obj=probe,
            )

        # do this after; better to know that type is not Probable first
        if isinstance(obj, LearningRule):
            # TODO: this special case should be able to be removed with #1310
            return Parameter.coerce(self, probe, target)
        else:
            return super().coerce(probe, target)
Ejemplo n.º 4
0
 def coerce(self, instance, distorarray):
     if isinstance(distorarray, Distribution):
         return Parameter.coerce(self, instance, distorarray)
     return super().coerce(instance, distorarray)
Ejemplo n.º 5
0
 def coerce(self, instance, distorarray):  # pylint: disable=arguments-renamed
     if isinstance(distorarray, Distribution):
         return Parameter.coerce(self, instance, distorarray)
     return super().coerce(instance, distorarray)
Ejemplo n.º 6
0
Archivo: dists.py Proyecto: nengo/nengo
 def coerce(self, instance, distorarray):
     if isinstance(distorarray, Distribution):
         return Parameter.coerce(self, instance, distorarray)
     return super().coerce(instance, distorarray)