Skip to content

Commit

Permalink
Merge branch 'master' into bug/fixup-debug-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ADBond authored Oct 30, 2024
2 parents a8d33ec + 2c0fde2 commit c035ea0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest_duckdb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Run tests with coverage
run: |
poetry add pytest-cov
poetry add "pytest-cov>=5.0.0"
poetry run pytest -v --durations=0 -m "duckdb_only or core" --cov=splink --cov-report=xml --cov-report=term tests/
- name: Upload coverage report
Expand Down
24 changes: 5 additions & 19 deletions splink/internals/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,17 @@
import json
import math
import os
from typing import TYPE_CHECKING, Any, Dict, Union
from typing import Any, Dict, Union

import numpy as np
import pandas as pd
from altair import Chart, SchemaBase

from splink.internals.misc import read_resource
from splink.internals.waterfall_chart import records_to_waterfall_data

altair_installed = True

try:
import altair as alt
except ImportError:
altair_installed = False

if TYPE_CHECKING:
import altair as alt

# type alias:
ChartReturnType = Union[Dict[Any, Any], alt.core.SchemaBase]
ChartReturnType = Union[Dict[Any, Any], SchemaBase]


def load_chart_definition(filename):
Expand All @@ -42,13 +33,8 @@ def _load_external_libs():
def altair_or_json(
chart_dict: dict[Any, Any], as_dict: bool = False
) -> ChartReturnType:
if altair_installed:
if not as_dict:
try:
return alt.Chart.from_dict(chart_dict)

except ModuleNotFoundError:
return chart_dict
if not as_dict:
return Chart.from_dict(chart_dict)

return chart_dict

Expand Down

0 comments on commit c035ea0

Please sign in to comment.