Skip to content

Commit

Permalink
fix(linting): code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
azory-ydata authored and portellaa committed Oct 15, 2024
1 parent e4814fd commit 938a601
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
8 changes: 5 additions & 3 deletions src/ydata_profiling/model/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,18 @@ def anchor_id(self) -> Optional[str]:

def fmt(self) -> str:
# TODO: render in template
style = self._styles.get(self.alert_type.name.lower(), 'secondary')
hint = ''
style = self._styles.get(self.alert_type.name.lower(), "secondary")
hint = ""

if self.alert_type == AlertType.HIGH_CORRELATION and self.values is not None:
num = len(self.values["fields"])
title = ", ".join(self.values["fields"])
corr = self.values["corr"]
hint = f'data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="This variable has a high {corr} correlation with {num} fields: {title}"'

return f'<span class="badge text-bg-{style}" {hint}>{self.alert_type_name}</span>'
return (
f'<span class="badge text-bg-{style}" {hint}>{self.alert_type_name}</span>'
)

def _get_description(self) -> str:
"""Return a human level description of the alert.
Expand Down
4 changes: 1 addition & 3 deletions src/ydata_profiling/profile_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ def __init__(
if len(kwargs) > 0:
shorthands, kwargs = Config.shorthands(kwargs)
report_config = report_config.update(
Settings()
.update(shorthands)
.dict(exclude_defaults=True)
Settings().update(shorthands).dict(exclude_defaults=True)
)

if kwargs:
Expand Down
6 changes: 5 additions & 1 deletion src/ydata_profiling/report/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,8 @@ def help(title: str, url: Optional[str] = None) -> str:

@list_args
def fmt_badge(value: str) -> str:
return re.sub(r"\((\d+)\)", r'<span class="badge text-bg-secondary align-text-top">\1</span>', value)
return re.sub(
r"\((\d+)\)",
r'<span class="badge text-bg-secondary align-text-top">\1</span>',
value,
)
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def render(self) -> widgets.GridBox:
)

style_name = styles[type_name]
if style_name not in ('primary', 'success', 'info', 'warning', 'danger'):
style_name = ''
if style_name not in ("primary", "success", "info", "warning", "danger"):
style_name = ""

items.append(
Button(
Expand Down
8 changes: 2 additions & 6 deletions tests/unit/test_time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,14 @@ def test_timeseries_identification(html_profile: str):


def test_timeseries_autocorrelation_tab(html_profile: str):
assert (
">Autocorrelation<" in html_profile
), "TimeSeries not detected"
assert ">Autocorrelation<" in html_profile, "TimeSeries not detected"
assert (
html_profile.count(">Autocorrelation<") == 8
), "TimeSeries autocorrelation tabs incorrectly generated"


def test_timeseries_seasonality(html_profile: str):
assert (
">Seasonal<" in html_profile
), "Seasonality incorrectly identified"
assert ">Seasonal<" in html_profile, "Seasonality incorrectly identified"
assert (
html_profile.count(">Seasonal<") == 4
), "Seasonality warning incorrectly identified"

0 comments on commit 938a601

Please sign in to comment.