diff --git a/lux/__init__.py b/lux/__init__.py index 92d39840..e86c556a 100644 --- a/lux/__init__.py +++ b/lux/__init__.py @@ -23,4 +23,5 @@ actions, update_actions, config, + warning_format, ) diff --git a/lux/_config/__init__.py b/lux/_config/__init__.py index f7130949..b56ee044 100644 --- a/lux/_config/__init__.py +++ b/lux/_config/__init__.py @@ -5,4 +5,5 @@ actions, update_actions, config, + warning_format, ) diff --git a/lux/_config/config.py b/lux/_config/config.py index 93d21e1a..cf1e1f8b 100644 --- a/lux/_config/config.py +++ b/lux/_config/config.py @@ -177,3 +177,7 @@ def default_display(self, type: str) -> None: config = Config() + + +def warning_format(message, category, filename, lineno, file=None, line=None): + return "%s:%s: %s:%s\n" % (filename, lineno, category.__name__, message) diff --git a/lux/core/frame.py b/lux/core/frame.py index 20ece48a..0236cead 100644 --- a/lux/core/frame.py +++ b/lux/core/frame.py @@ -82,6 +82,7 @@ def __init__(self, *args, **kw): self.cardinality = None self._min_max = None self.pre_aggregated = None + warnings.formatwarning = lux.warning_format @property def _constructor(self): diff --git a/lux/executor/PandasExecutor.py b/lux/executor/PandasExecutor.py index a73e607b..721a36e9 100644 --- a/lux/executor/PandasExecutor.py +++ b/lux/executor/PandasExecutor.py @@ -22,6 +22,7 @@ from lux.utils.utils import check_import_lux_widget, check_if_id_like from lux.utils.date_utils import is_datetime_series import warnings +import lux class PandasExecutor(Executor): @@ -31,6 +32,7 @@ class PandasExecutor(Executor): def __init__(self): self.name = "PandasExecutor" + warnings.formatwarning = lux.warning_format def __repr__(self): return f"" diff --git a/lux/processor/Compiler.py b/lux/processor/Compiler.py index d5558f34..005e555b 100644 --- a/lux/processor/Compiler.py +++ b/lux/processor/Compiler.py @@ -21,6 +21,7 @@ import pandas as pd import numpy as np import warnings +import lux class Compiler: @@ -30,6 +31,7 @@ class Compiler: def __init__(self): self.name = "Compiler" + warnings.formatwarning = lux.warning_format def __repr__(self): return f"" diff --git a/lux/processor/Validator.py b/lux/processor/Validator.py index cb48d297..9be2f5de 100644 --- a/lux/processor/Validator.py +++ b/lux/processor/Validator.py @@ -18,6 +18,7 @@ from typing import List from lux.utils.date_utils import is_datetime_series, is_datetime_string import warnings +import lux class Validator: @@ -27,6 +28,7 @@ class Validator: def __init__(self): self.name = "Validator" + warnings.formatwarning = lux.warning_format def __repr__(self): return f"" diff --git a/lux/vis/VisList.py b/lux/vis/VisList.py index c25495d9..0f4b25a4 100644 --- a/lux/vis/VisList.py +++ b/lux/vis/VisList.py @@ -19,6 +19,7 @@ from lux.vis.Vis import Vis from lux.vis.Clause import Clause import warnings +import lux class VisList: @@ -40,6 +41,7 @@ def __init__(self, input_lst: Union[List[Vis], List[Clause]], source=None): self._intent = [] self._widget = None self.refresh_source(self._source) + warnings.formatwarning = lux.warning_format @property def intent(self):