Skip to content

Commit

Permalink
fix: Partially revert 5e9cc0c, which globally reconfigured Python war…
Browse files Browse the repository at this point in the history
…nings, closes #87
  • Loading branch information
jpmckinney committed Oct 23, 2023
1 parent 1a2733c commit bd452a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
5 changes: 3 additions & 2 deletions leather/chart.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import warnings
import xml.etree.ElementTree as ET

import leather.svg as svg
Expand All @@ -8,7 +9,7 @@
from leather.scales import Linear, Scale, Temporal
from leather.series import CategorySeries, Series
from leather.shapes import Bars, Columns, Dots, Line
from leather.utils import DIMENSION_NAMES, Box, IPythonSVG, X, Y, warn
from leather.utils import DIMENSION_NAMES, Box, IPythonSVG, X, Y


class Chart:
Expand Down Expand Up @@ -185,7 +186,7 @@ def _validate_dimension(self, dimension):
for series, shape in self._layers:
if not scale.contains(series.min(dimension)) or not scale.contains(series.max(dimension)):
d = DIMENSION_NAMES[dimension]
warn(
warnings.warn(
'Data contains values outside %s scale domain. '
'All data points may not be visible on the chart.' % d
)
Expand Down
10 changes: 0 additions & 10 deletions leather/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import warnings
from collections import namedtuple
from datetime import date, datetime, timedelta
from decimal import Decimal
Expand Down Expand Up @@ -37,15 +36,6 @@ def IPythonSVG(x):
DummySeries = namedtuple('DummySeries', ['name'])


formatwarning_orig = warnings.formatwarning
warnings.formatwarning = lambda message, category, filename, lineno, line=None: \
formatwarning_orig(message, category, filename, lineno, line='')

warn = warnings.warn
warnings.resetwarnings()
warnings.simplefilter('always')


def to_year_count(d):
"""
date > n years
Expand Down

0 comments on commit bd452a7

Please sign in to comment.