Skip to content

Commit

Permalink
Progress on pandas-dev#18419
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronCritchley committed Sep 6, 2018
1 parent 8b67c1f commit 1a9d3f9
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 27 deletions.
6 changes: 3 additions & 3 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,19 +565,19 @@ def linkcode_resolve(domain, info):
for part in fullname.split('.'):
try:
obj = getattr(obj, part)
except:
except AttributeError:
return None

try:
fn = inspect.getsourcefile(obj)
except:
except TypeError:
fn = None
if not fn:
return None

try:
source, lineno = inspect.getsourcelines(obj)
except:
except OSError:
lineno = None

if lineno:
Expand Down
24 changes: 10 additions & 14 deletions pandas/compat/pickle_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def load_reduce(self):
cls = args[0]
stack[-1] = object.__new__(cls)
return
except:
except Exception:
pass

# try to re-encode the arguments
Expand All @@ -44,7 +44,7 @@ def load_reduce(self):
try:
stack[-1] = func(*args)
return
except:
except Exception:
pass

# unknown exception, re-raise
Expand Down Expand Up @@ -182,7 +182,7 @@ def load_newobj_ex(self):

try:
Unpickler.dispatch[pkl.NEWOBJ_EX[0]] = load_newobj_ex
except:
except Exception:
pass


Expand All @@ -200,15 +200,11 @@ def load(fh, encoding=None, compat=False, is_verbose=False):
compat: provide Series compatibility mode, boolean, default False
is_verbose: show exception output
"""
fh.seek(0)
if encoding is not None:
up = Unpickler(fh, encoding=encoding)
else:
up = Unpickler(fh)
up.is_verbose = is_verbose

try:
fh.seek(0)
if encoding is not None:
up = Unpickler(fh, encoding=encoding)
else:
up = Unpickler(fh)
up.is_verbose = is_verbose

return up.load()
except:
raise
return up.load()
4 changes: 2 additions & 2 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3187,7 +3187,7 @@ def _ensure_valid_index(self, value):
if not len(self.index) and is_list_like(value):
try:
value = Series(value)
except:
except ValueError:
raise ValueError('Cannot set a frame with no defined index '
'and a value that cannot be converted to a '
'Series')
Expand Down Expand Up @@ -7621,7 +7621,7 @@ def convert(v):
values = np.array([convert(v) for v in values])
else:
values = convert(values)
except:
except Exception:
values = convert(values)

else:
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2146,7 +2146,7 @@ def _getitem_tuple(self, tup):
self._has_valid_tuple(tup)
try:
return self._getitem_lowerdim(tup)
except:
except IndexingError:
pass

retval = self.obj
Expand Down Expand Up @@ -2705,13 +2705,13 @@ def maybe_droplevels(index, key):
for _ in key:
try:
index = index.droplevel(0)
except:
except ValueError:
# we have dropped too much, so back out
return original_index
else:
try:
index = index.droplevel(0)
except:
except ValueError:
pass

return index
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/nanops.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def reduction(values, axis=None, skipna=True):
try:
result = getattr(values, meth)(axis, dtype=dtype_max)
result.fill(np.nan)
except:
except AttributeError:
result = np.nan
else:
result = getattr(values, meth)(axis)
Expand Down
6 changes: 3 additions & 3 deletions pandas/util/_print_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_sys_info():
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
so, serr = pipe.communicate()
except:
except ValueError:
pass
else:
if pipe.returncode == 0:
Expand Down Expand Up @@ -50,7 +50,7 @@ def get_sys_info():
("LANG", "{lang}".format(lang=os.environ.get('LANG', "None"))),
("LOCALE", '.'.join(map(str, locale.getlocale()))),
])
except:
except Exception:
pass

return blob
Expand Down Expand Up @@ -108,7 +108,7 @@ def show_versions(as_json=False):
mod = importlib.import_module(modname)
ver = ver_f(mod)
deps_blob.append((modname, ver))
except:
except Exception:
deps_blob.append((modname, None))

if (as_json):
Expand Down
2 changes: 1 addition & 1 deletion pandas/util/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _check_for_default_values(fname, arg_val_dict, compat_args):

# could not compare them directly, so try comparison
# using the 'is' operator
except:
except Exception:
match = (arg_val_dict[key] is compat_args[key])

if not match:
Expand Down

0 comments on commit 1a9d3f9

Please sign in to comment.