Skip to content

Commit

Permalink
fix: Premature imports of optional packages (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
lawson89 authored Dec 14, 2022
1 parent 615d119 commit dd6fa02
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions explorer/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

from django.core.exceptions import ImproperlyConfigured

from explorer import app_settings

try:
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.figure import Figure
except ImportError:
from . import app_settings

if app_settings.EXPLORER_CHARTS_ENABLED:
if app_settings.EXPLORER_CHARTS_ENABLED:
try:
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.figure import Figure
except ImportError:
raise ImproperlyConfigured(
"If `EXPLORER_CHARTS_ENABLED` is enabled, `matplotlib` and `seaborn` must be installed.")

Expand Down

0 comments on commit dd6fa02

Please sign in to comment.