From 938a60153201dcb5cac2abeb0d71c6fc1d592c8d Mon Sep 17 00:00:00 2001 From: Azory YData Bot Date: Tue, 15 Oct 2024 15:06:37 +0000 Subject: [PATCH] fix(linting): code formatting --- src/ydata_profiling/model/alerts.py | 8 +++++--- src/ydata_profiling/profile_report.py | 4 +--- src/ydata_profiling/report/formatters.py | 6 +++++- .../report/presentation/flavours/widget/alerts.py | 4 ++-- tests/unit/test_time_series.py | 8 ++------ 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ydata_profiling/model/alerts.py b/src/ydata_profiling/model/alerts.py index 6f41894dc..3c2c4fee9 100644 --- a/src/ydata_profiling/model/alerts.py +++ b/src/ydata_profiling/model/alerts.py @@ -120,8 +120,8 @@ 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"]) @@ -129,7 +129,9 @@ def fmt(self) -> str: 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'{self.alert_type_name}' + return ( + f'{self.alert_type_name}' + ) def _get_description(self) -> str: """Return a human level description of the alert. diff --git a/src/ydata_profiling/profile_report.py b/src/ydata_profiling/profile_report.py index e3f4d1601..08ee64a0d 100644 --- a/src/ydata_profiling/profile_report.py +++ b/src/ydata_profiling/profile_report.py @@ -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: diff --git a/src/ydata_profiling/report/formatters.py b/src/ydata_profiling/report/formatters.py index 051299da7..d2c4657e0 100644 --- a/src/ydata_profiling/report/formatters.py +++ b/src/ydata_profiling/report/formatters.py @@ -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'\1', value) + return re.sub( + r"\((\d+)\)", + r'\1', + value, + ) diff --git a/src/ydata_profiling/report/presentation/flavours/widget/alerts.py b/src/ydata_profiling/report/presentation/flavours/widget/alerts.py index 87356a784..6032ea8a5 100644 --- a/src/ydata_profiling/report/presentation/flavours/widget/alerts.py +++ b/src/ydata_profiling/report/presentation/flavours/widget/alerts.py @@ -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( diff --git a/tests/unit/test_time_series.py b/tests/unit/test_time_series.py index 6113fe0c6..9a87da274 100644 --- a/tests/unit/test_time_series.py +++ b/tests/unit/test_time_series.py @@ -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"