提交 4f3e520f authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Make raise_op pass flake8 + spread the gospel of __props__

上级 66dc1578
"""Symbolic Op for raising an exception."""
from theano import gof
__authors__ = "James Bergstra"
__copyright__ = "(c) 2011, Universite de Montreal"
__license__ = "3-clause BSD License"
__contact__ = "theano-dev <theano-dev@googlegroups.com>"
__docformat__ = "restructuredtext en"
from theano import gof
class Raise(gof.Op):
"""Op whose perform() raises an exception.
"""
__props__ = ('msg', 'exc')
def __init__(self, msg="", exc=NotImplementedError):
"""
msg - the argument to the exception
......@@ -20,16 +23,6 @@ class Raise(gof.Op):
self.msg = msg
self.exc = exc
def __eq__(self, other):
# Note: the msg does not technically have to be in the hash and eq
# because it doesn't affect the return value.
return (type(self) == type(other)
and self.msg == other.msg
and self.exc == other.exc)
def __hash__(self):
return hash((type(self), self.msg, self.exc))
def __str__(self):
return "Raise{%s(%s)}" % (self.exc, self.msg)
......
......@@ -323,7 +323,6 @@ whitelist_flake8 = [
"gof/sandbox/equilibrium.py",
"sandbox/cuda/opt_util.py",
"gof/tests/test_utils.py",
"raise_op.py",
"tests/test_flake8.py",
"misc/pkl_utils.py",
"sandbox/cuda/tests/test_cula.py",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论