Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion misc/experiments/testvtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import vtk
try:
from PyQt4 import QtCore, QtGui
except:
except Exception:
from PySide import QtCore, QtGui
from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
import vtk.util.numpy_support
Expand Down
6 changes: 3 additions & 3 deletions packages/vaex-astro/vaex/astro/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
try:
import h5py
except:
except Exception:
if not on_rtd:
raise

Expand Down Expand Up @@ -65,7 +65,7 @@ def export_hdf5_v1(dataset, path, column_names=None, byteorder="=", shuffle=Fals
else:
try:
array = h5file_output.require_dataset("/data/%s" % column_name, shape=shape, dtype=dtype.newbyteorder(byteorder))
except:
except Exception:
logging.exception("error creating dataset for %r, with type %r " % (column_name, dtype))
array[0] = array[0] # make sure the array really exists
random_index_name = None
Expand Down Expand Up @@ -155,7 +155,7 @@ def export_hdf5(dataset, path, column_names=None, byteorder="=", shuffle=False,
else:
try:
array = h5column_output.require_dataset('data', shape=shape, dtype=dtype.newbyteorder(byteorder))
except:
except Exception:
logging.exception("error creating dataset for %r, with type %r " % (column_name, dtype))
array[0] = array[0] # make sure the array really exists

Expand Down
4 changes: 2 additions & 2 deletions packages/vaex-astro/vaex/astro/fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _check_null(self, table, column_name, column, i):
def _try_votable(self, table):
try:
from io import BytesIO as StringIO
except:
except Exception:
from StringIO import StringIO
if table.data is None:
return
Expand Down Expand Up @@ -140,7 +140,7 @@ def _get_column_meta_data(self, table, column_name, column, i):
unit = _try_unit(column.unit)
if unit:
self.units[column_name] = unit
except:
except Exception:
logger.exception("could not understand unit: %s" % column.unit)
else: # we may want to try ourselves
unit_header_name = "TUNIT%d" % (i+1)
Expand Down
2 changes: 1 addition & 1 deletion packages/vaex-astro/vaex/astro/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def can_open(cls, path, *args, **kwargs):
url = None
try:
url = urlparse(path)
except:
except Exception:
return False
if url.scheme:
if url.scheme.startswith("tap+http"): # will also catch https
Expand Down
8 changes: 4 additions & 4 deletions packages/vaex-core/vaex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

try:
from . import version
except:
except Exception:
import sys
print("version file not found, please run git/hooks/post-commit or git/hooks/post-checkout and/or install them as hooks (see git/README)", file=sys.stderr)
raise
Expand Down Expand Up @@ -265,7 +265,7 @@ def open(path, convert=False, progress=None, shuffle=False, fs_options={}, fs=No
if df is None:
raise IOError('Unknown error opening: {}'.format(path))
return df
except:
except Exception:
logger.exception("error opening %r" % path)
raise

Expand Down Expand Up @@ -619,7 +619,7 @@ def _read_csv_read(filename_or_buffer, copy_index, chunk_size, fs_options={}, fs
if "compression" not in kwargs:
try:
path = vaex.file.stringyfy(filename_or_buffer)
except:
except Exception:
path = None
if path:
parts = path.rsplit('.', 3)
Expand Down Expand Up @@ -703,7 +703,7 @@ def set_log_level_off():
with open(import_script) as f:
code = compile(f.read(), import_script, 'exec')
exec(code)
except:
except Exception:
import traceback
traceback.print_stack()

Expand Down
2 changes: 1 addition & 1 deletion packages/vaex-core/vaex/array_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def convert(x, type, default_type="numpy"):
else:
try:
return pa.array(x).tolist()
except:
except Exception:
return np.array(x).tolist()
elif type is None:
if isinstance(x, (list, tuple)):
Expand Down
2 changes: 1 addition & 1 deletion packages/vaex-core/vaex/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def main(argv):
if not args.quiet:
print("\noutput to %s" % os.path.abspath(args.output))
df.close()
except:
except Exception:
if not args.quiet:
print("\nfailed to write to%s" % os.path.abspath(args.output))
if args.delete:
Expand Down
30 changes: 15 additions & 15 deletions packages/vaex-core/vaex/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2012,7 +2012,7 @@ def mode(self, expression, binby=[], limits=None, shape=256, mode_shape=64, mode
try:
len(shape)
shape = tuple(shape)
except:
except Exception:
shape = len(binby) * (shape,)
shape = (mode_shape,) + shape
subspace = self(*(list(binby) + [expression]))
Expand Down Expand Up @@ -2282,7 +2282,7 @@ def data_type(self, expression, array_type=None, internal=False, axis=0):
expression = vaex.utils.valid_expression(self.get_column_names(hidden=True), expression)
try:
data = self.evaluate(expression, 0, 1, filtered=False, array_type=array_type, parallel=False)
except:
except Exception:
data = self.evaluate(expression, 0, 1, filtered=True, array_type=array_type, parallel=False)
if data_type is None:
# means we have to determine it from the data
Expand Down Expand Up @@ -2366,7 +2366,7 @@ def label(self, expression, unit=None, output_unit=None, format="latex_inline"):
if output_unit and unit: # avoid unnecessary error msg'es
output_unit.to(unit)
unit = output_unit
except:
except Exception:
logger.exception("unit error")
if unit is not None:
label = "%s (%s)" % (label, unit.to_string('latex_inline'))
Expand Down Expand Up @@ -2397,12 +2397,12 @@ def unit(self, expression, default=None):
unit = unit_or_quantity.unit if hasattr(unit_or_quantity, "unit") else unit_or_quantity
unit_types = (astropy.units.core.UnitBase, )
return unit if isinstance(unit, unit_types) else None
except:
except Exception:
# logger.exception("error evaluating unit expression: %s", expression)
# astropy doesn't add units, so we try with a quatiti
try:
return eval(expression, expression_namespace, scopes.UnitScope(self, 1.)).unit
except:
except Exception:
# logger.exception("error evaluating unit expression: %s", expression)
return default

Expand Down Expand Up @@ -2473,7 +2473,7 @@ def selections_favorite_load(self):
selections_dict = vaex.utils.read_json_or_yaml(path)
for key, value in selections_dict.items():
self.favorite_selections[key] = selections.selection_from_dict(self, value)
except:
except Exception:
logger.exception("non fatal error")

def get_private_dir(self, create=False):
Expand Down Expand Up @@ -2904,7 +2904,7 @@ def remove_virtual_meta(self):
os.remove(path)
if not os.listdir(dir):
os.rmdir(dir)
except:
except Exception:
logger.exception("error while trying to remove %s or %s", path, dir)
# def remove_meta(self):
# path = os.path.join(self.get_private_dir(create=True), "meta.yaml")
Expand Down Expand Up @@ -2948,7 +2948,7 @@ def update_virtual_meta(self):
self.descriptions.update(meta_info["descriptions"])
units = {key: astropy.units.Unit(value) for key, value in meta_info["units"].items()}
self.units.update(units)
except:
except Exception:
logger.exception("non fatal error")

@_hidden
Expand Down Expand Up @@ -2987,7 +2987,7 @@ def update_meta(self):
# self.variables.update(meta_info["variables"])
units = {key: astropy.units.Unit(value) for key, value in meta_info["units"].items()}
self.units.update(units)
except:
except Exception:
logger.exception("non fatal error, but could read/understand %s", path)

def is_local(self):
Expand Down Expand Up @@ -3858,7 +3858,7 @@ def _rename(self, old, new, rename_meta_data=False):
if isinstance(getattr(self, old), Expression):
try:
delattr(self, old)
except:
except Exception:
pass
self._save_assign_expression(new)
existing_expressions = [k() for k in self._expressions]
Expand Down Expand Up @@ -4105,12 +4105,12 @@ def table_part(k1, k2, parts):
df = self[k1:k2]
try:
values = dict(zip(column_names, df.evaluate(column_names)))
except:
except Exception:
values = {}
for i, name in enumerate(column_names):
try:
values[name] = df.evaluate(name)
except:
except Exception:
values[name] = ["error"] * (N)
logger.exception('error evaluating: %s at rows %i-%i' % (name, k1, k2))
for i in range(k2 - k1):
Expand Down Expand Up @@ -4184,7 +4184,7 @@ def table_part(k1, k2, parts):
for name in column_names:
try:
data_parts[name] = self.evaluate(name, i1=k1, i2=k2)
except:
except Exception:
data_parts[name] = ["error"] * (N)
logger.exception('error evaluating: %s at rows %i-%i' % (name, k1, k2))
for i in range(k2 - k1):
Expand Down Expand Up @@ -5490,7 +5490,7 @@ def _real_drop(self, item):
try:
if isinstance(getattr(self, name), Expression):
delattr(self, name)
except:
except Exception:
pass

@docsubst
Expand Down Expand Up @@ -6679,7 +6679,7 @@ def equal_mask(a, b):
for i in range(min(len(values1), show)):
try:
diff = values1[i] - values2[i]
except:
except Exception:
diff = "does not exists"
print("%s[%d] == %s != %s other.%s[%d] (diff = %s)" % (column_name, indices[i], values1[i], values2[i], column_name, indices[i], diff))
return different_values, missing, type_mismatch, meta_mismatch
Expand Down
4 changes: 2 additions & 2 deletions packages/vaex-core/vaex/dataframe_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,12 +585,12 @@ def get_buffers(self) -> Dict[str, Any]:
buffers["data"] = self._get_data_buffer()
try:
buffers["validity"] = self._get_validity_buffer()
except:
except Exception:
buffers["validity"] = None

try:
buffers["offsets"] = self._get_offsets_buffer()
except:
except Exception:
buffers["offsets"] = None

return buffers
Expand Down
4 changes: 2 additions & 2 deletions packages/vaex-core/vaex/dataset_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ def _try_unit(unit):
unit = astropy.units.Unit(str(unit))
if not isinstance(unit, astropy.units.UnrecognizedUnit):
return unit
except:
except Exception:
#logger.exception("could not parse unit: %r", unit)
pass
try:
unit_mangle = re.match(r".*\[(.*)\]", str(unit)).groups()[0]
unit = astropy.units.Unit(unit_mangle)
except:
except Exception:
pass#logger.exception("could not parse unit: %r", unit)
if isinstance(unit, six.string_types):
return None
Expand Down
2 changes: 1 addition & 1 deletion packages/vaex-core/vaex/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
try:
import h5py
except:
except Exception:
if not on_rtd:
raise
# from vaex.dataset import DatasetLocal
Expand Down
4 changes: 2 additions & 2 deletions packages/vaex-core/vaex/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def f(a, b):
a = self.index_values()
try:
stringy = isinstance(b, str) or b.is_string()
except:
except Exception:
# this can happen when expression is a literal, like '1' (used in propagate_unc)
# which causes the dtype to fail
stringy = False
Expand Down Expand Up @@ -1359,7 +1359,7 @@ def map(self, mapper, nan_value=None, missing_value=None, default_value=None, al
def try_nan(x):
try:
return np.isnan(x)
except:
except Exception:
return False
mapper_nan_key_mask = np.array([try_nan(k) for k in mapper_keys])
mapper_has_nan = mapper_nan_key_mask.sum() > 0
Expand Down
2 changes: 1 addition & 1 deletion packages/vaex-core/vaex/ext/bokeh.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def update_in_main_thread():
rgba = create_image(job)
if not job.cancelled:
progress.description = "Done: %.1fs" % (time.time() - t0)
except:
except Exception:
if not job.cancelled:
progress.description = "error"
raise
Expand Down
2 changes: 1 addition & 1 deletion packages/vaex-core/vaex/ext/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __call__(self):
if not self.cancelled:
try:
self.result = self.f(self, **self.kwargs)
except:
except Exception:
self.exception = True
raise

Expand Down
2 changes: 1 addition & 1 deletion packages/vaex-core/vaex/ext/ipyvolume.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _update_image(self):
if self.vcount_limits is not None:
try:
vcount_min, vcount_max = self.vcount_limits
except:
except Exception:
vcount_min = self.vcount_limits
if vcount_min is not None:
ok &= (vcount > vcount_min)
Expand Down
2 changes: 1 addition & 1 deletion packages/vaex-core/vaex/file/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
fcntl = None
try:
import fcntl
except:
except Exception:
pass
import threading
from ctypes import *
Expand Down
2 changes: 1 addition & 1 deletion packages/vaex-core/vaex/kld.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def kld_shuffled(columns, Ngrid=128, datamins=None, datamaxes=None, offset=1):
print((x, y, counts, counts_shuffled, datamins[0], datamaxes[0], datamins[1], datamaxes[1], offset))
try:
vaex.histogram.hist2d_and_shuffled(x, y, counts, counts_shuffled, datamins[0], datamaxes[0], datamins[1], datamaxes[1], offset)
except:
except Exception:
args = [x, y, counts, counts_shuffled, datamins[0], datamaxes[0], datamins[1], datamaxes[1], offset]
sig = [numba.dispatcher.typeof_pyval(a) for a in args]
print(sig)
Expand Down
2 changes: 1 addition & 1 deletion packages/vaex-core/vaex/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, df, subspace, expressions, size, limits, masked=False, weight
try:
self.size[0]
shape1 = tuple(self.size)
except:
except Exception:
pass
shape = (self.subspace.executor.thread_pool.nthreads,) + shape1
self.data = np.zeros(shape, dtype=self.dtype)
Expand Down
2 changes: 1 addition & 1 deletion packages/vaex-core/vaex/misc/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def __init__(self, var, args):
self.args = args
try:
len(self.args)
except:
except Exception:
self.args = (self.args,)

def tovar(self):
Expand Down
2 changes: 1 addition & 1 deletion packages/vaex-core/vaex/misc/parallelize.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __call__(self, *args, **kwargs):
result = None
try:
result = self.function(*args, **kwargs)
except:
except Exception:
info = "exception"
exc_info = traceback.format_exc()
return info, exc_info, result
Expand Down
4 changes: 2 additions & 2 deletions packages/vaex-core/vaex/misc/samp.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _onTableLoadVotable(self, private_key, sender_id, msg_id, mtype, params, ext
name = params["name"]
for callback in self.tableLoadCallbacks:
callback(url, table_id, name)
except:
except Exception:
logger.exception("event handler failed")

if msg_id != None: # if SAMP call, send a reply
Expand All @@ -78,6 +78,6 @@ def _onSampCall(self, private_key, sender_id, msg_id, mtype, params, extra):
try:
print(("Call:", repr(private_key), repr(sender_id), repr(msg_id), repr(mtype), repr(params), repr(extra)))
self.client.ereply(msg_id, sampy.SAMP_STATUS_OK, result = {"txt": "printed"})
except:
except Exception:
print("errrrrrrororrrr hans!")

Loading
Loading