提交 8ad24e96 authored 作者: Frederic Bastien's avatar Frederic Bastien

Fix newer flake8 error

上级 f914681f
...@@ -130,7 +130,7 @@ def maybe_add_to_os_environ_pathlist(var, newpath): ...@@ -130,7 +130,7 @@ def maybe_add_to_os_environ_pathlist(var, newpath):
if newpath not in oldpaths: if newpath not in oldpaths:
newpaths = os.pathsep.join([newpath] + oldpaths) newpaths = os.pathsep.join([newpath] + oldpaths)
os.environ[var] = newpaths os.environ[var] = newpaths
except: except Exception:
pass pass
__all__ += ['maybe_add_to_os_environ_pathlist'] __all__ += ['maybe_add_to_os_environ_pathlist']
...@@ -124,7 +124,7 @@ class change_flags(object): ...@@ -124,7 +124,7 @@ class change_flags(object):
try: try:
for k, v in iteritems(self.confs): for k, v in iteritems(self.confs):
v.__set__(None, self.new_vals[k]) v.__set__(None, self.new_vals[k])
except: except Exception:
self.__exit__() self.__exit__()
raise raise
......
...@@ -245,7 +245,7 @@ class Loop(VM): ...@@ -245,7 +245,7 @@ class Loop(VM):
t1 = time.time() t1 = time.time()
self.call_counts[i] += 1 self.call_counts[i] += 1
self.call_times[i] += t1 - t0 self.call_times[i] += t1 - t0
except: except Exception:
link.raise_with_op(node, thunk) link.raise_with_op(node, thunk)
else: else:
for cont in self.pre_call_clear: for cont in self.pre_call_clear:
...@@ -253,7 +253,7 @@ class Loop(VM): ...@@ -253,7 +253,7 @@ class Loop(VM):
try: try:
for thunk, node in zip(self.thunks, self.nodes): for thunk, node in zip(self.thunks, self.nodes):
thunk() thunk()
except: except Exception:
link.raise_with_op(node, thunk) link.raise_with_op(node, thunk)
...@@ -289,7 +289,7 @@ class LoopGC(VM): ...@@ -289,7 +289,7 @@ class LoopGC(VM):
for old_s in old_storage: for old_s in old_storage:
old_s[0] = None old_s[0] = None
i += 1 i += 1
except: except Exception:
link.raise_with_op(node, thunk) link.raise_with_op(node, thunk)
else: else:
for cont in self.pre_call_clear: for cont in self.pre_call_clear:
...@@ -300,7 +300,7 @@ class LoopGC(VM): ...@@ -300,7 +300,7 @@ class LoopGC(VM):
thunk() thunk()
for old_s in old_storage: for old_s in old_storage:
old_s[0] = None old_s[0] = None
except: except Exception:
link.raise_with_op(node, thunk) link.raise_with_op(node, thunk)
......
...@@ -1007,7 +1007,7 @@ class ScanInplaceOptimizer(Optimizer): ...@@ -1007,7 +1007,7 @@ class ScanInplaceOptimizer(Optimizer):
try: try:
alloc_ops += (theano.gpuarray.GpuAlloc, alloc_ops += (theano.gpuarray.GpuAlloc,
theano.gpuarray.GpuAllocEmpty) theano.gpuarray.GpuAllocEmpty)
except: except Exception:
pass pass
nodes = fgraph.toposort()[::-1] nodes = fgraph.toposort()[::-1]
......
...@@ -3838,7 +3838,7 @@ class Split(Op): ...@@ -3838,7 +3838,7 @@ class Split(Op):
try: try:
len_along_axis = x.shape[axis] len_along_axis = x.shape[axis]
except: except Exception:
raise ValueError('Split.perform() with axis=(%s) is invalid' raise ValueError('Split.perform() with axis=(%s) is invalid'
' for x.shape==(%s)' ' for x.shape==(%s)'
% (axis, x.shape)) % (axis, x.shape))
......
...@@ -104,7 +104,7 @@ class PdbBreakpoint(Op): ...@@ -104,7 +104,7 @@ class PdbBreakpoint(Op):
if condition: if condition:
try: try:
monitored = [np.asarray(inp) for inp in inputs[1:]] monitored = [np.asarray(inp) for inp in inputs[1:]]
except: except Exception:
raise ValueError("Some of the inputs to the PdbBreakpoint op " raise ValueError("Some of the inputs to the PdbBreakpoint op "
"'%s' could not be casted to NumPy arrays" % "'%s' could not be casted to NumPy arrays" %
self.name) self.name)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论