Skip to content

Commit

Permalink
Reformat Warnings Labels (#151)
Browse files Browse the repository at this point in the history
* add format for warnings

* fix small details

* globally defined lux

* fix formatting

* Delete similarity.py

* Rename similarity_old.py to similarity.py

* fix commit

* update master with changes to warning labels

* fix formatting

Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>
  • Loading branch information
caitlynachen and Caitlyn Chen committed Nov 23, 2020
1 parent 3543b12 commit 974079d
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions lux/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
actions,
update_actions,
config,
warning_format,
)
1 change: 1 addition & 0 deletions lux/_config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
actions,
update_actions,
config,
warning_format,
)
4 changes: 4 additions & 0 deletions lux/_config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions lux/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions lux/executor/PandasExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -31,6 +32,7 @@ class PandasExecutor(Executor):

def __init__(self):
self.name = "PandasExecutor"
warnings.formatwarning = lux.warning_format

def __repr__(self):
return f"<PandasExecutor>"
Expand Down
2 changes: 2 additions & 0 deletions lux/processor/Compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import pandas as pd
import numpy as np
import warnings
import lux


class Compiler:
Expand All @@ -30,6 +31,7 @@ class Compiler:

def __init__(self):
self.name = "Compiler"
warnings.formatwarning = lux.warning_format

def __repr__(self):
return f"<Compiler>"
Expand Down
2 changes: 2 additions & 0 deletions lux/processor/Validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -27,6 +28,7 @@ class Validator:

def __init__(self):
self.name = "Validator"
warnings.formatwarning = lux.warning_format

def __repr__(self):
return f"<Validator>"
Expand Down
2 changes: 2 additions & 0 deletions lux/vis/VisList.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from lux.vis.Vis import Vis
from lux.vis.Clause import Clause
import warnings
import lux


class VisList:
Expand All @@ -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):
Expand Down

0 comments on commit 974079d

Please sign in to comment.