提交 9a11eb68 authored 作者: Iban Harlouchet's avatar Iban Harlouchet 提交者: Frederic

flake8 of theano/gof/unify.py; 3 E left

上级 a2941943
...@@ -35,10 +35,12 @@ class Variable: ...@@ -35,10 +35,12 @@ class Variable:
""" """
def __init__(self, name="?"): def __init__(self, name="?"):
self.name = name self.name = name
def __str__(self): def __str__(self):
return (self.__class__.__name__ + "(" + return (self.__class__.__name__ + "(" +
", ".join("%s=%s" % (key, value) ", ".join("%s=%s" % (key, value)
for key, value in iteritems(self.__dict__)) + ")") for key, value in iteritems(self.__dict__)) + ")")
def __repr__(self): def __repr__(self):
return str(self) return str(self)
...@@ -348,8 +350,9 @@ def unify_walk(a, b, U): ...@@ -348,8 +350,9 @@ def unify_walk(a, b, U):
Checks for the existence of the __unify_walk__ method for one of Checks for the existence of the __unify_walk__ method for one of
the objects. the objects.
""" """
if not isinstance(a, Variable) and not isinstance(b, Variable) \ if (not isinstance(a, Variable) and
and hasattr(a, "__unify_walk__"): not isinstance(b, Variable) and
hasattr(a, "__unify_walk__")):
return a.__unify_walk__(b, U) return a.__unify_walk__(b, U)
else: else:
return FALL_THROUGH return FALL_THROUGH
...@@ -430,8 +433,9 @@ def unify_merge(vs, o, U): ...@@ -430,8 +433,9 @@ def unify_merge(vs, o, U):
@comm_guard(ANY_TYPE, ANY_TYPE) @comm_guard(ANY_TYPE, ANY_TYPE)
def unify_merge(a, b, U): def unify_merge(a, b, U):
if not isinstance(a, Variable) and not isinstance(b, Variable) \ if (not isinstance(a, Variable) and
and hasattr(a, "__unify_merge__"): not isinstance(b, Variable) and
hasattr(a, "__unify_merge__")):
return a.__unify_merge__(b, U) return a.__unify_merge__(b, U)
else: else:
return FALL_THROUGH return FALL_THROUGH
...@@ -502,4 +506,3 @@ if __name__ == "__main__": ...@@ -502,4 +506,3 @@ if __name__ == "__main__":
U = unify_walk((1, 2), (va, va), Unification()) U = unify_walk((1, 2), (va, va), Unification())
print(U[va]) print(U[va])
...@@ -223,7 +223,6 @@ whitelist_flake8 = [ ...@@ -223,7 +223,6 @@ whitelist_flake8 = [
"sparse/sandbox/sp2.py", "sparse/sandbox/sp2.py",
"sparse/sandbox/truedot.py", "sparse/sandbox/truedot.py",
"sparse/sandbox/sp.py", "sparse/sandbox/sp.py",
"gof/unify.py",
"gof/__init__.py", "gof/__init__.py",
"gof/tests/test_cmodule.py", "gof/tests/test_cmodule.py",
"gof/tests/test_destroyhandler.py", "gof/tests/test_destroyhandler.py",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论