Skip to content

Commit

Permalink
Merge pull request #1608 from materialsproject/dev
Browse files Browse the repository at this point in the history
check df.plot attrs
  • Loading branch information
tschaume authored Aug 4, 2023
2 parents 532f89d + 92928ed commit 741b919
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mpcontribs-client/mpcontribs/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import logging
import datetime

from inspect import getfullargspec
from math import isclose
from semantic_version import Version
from requests.exceptions import RequestException
Expand Down Expand Up @@ -55,6 +56,7 @@
from pint.converters import ScaleConverter
from pint.errors import DimensionalityError
from tempfile import gettempdir
from plotly.express._chart_types import line as line_chart

RETRIES = 3
MAX_WORKERS = 3
Expand Down Expand Up @@ -307,8 +309,9 @@ def display(self):
"""Display a plotly graph for the table if in IPython/Jupyter"""
if _in_ipython():
try:
# TODO make sure that attrs only contains valid kwargs
return self.plot(**self.attrs)
allowed_kwargs = getfullargspec(line_chart).args
attrs = {k: v for k, v in self.attrs.items() if k in allowed_kwargs}
return self.plot(**attrs)
except Exception as e:
logger.error(f"Can't display table: {e}")

Expand Down

0 comments on commit 741b919

Please sign in to comment.