From 4ffd89f8974a73e06bc3480a39a8c4874e85774c Mon Sep 17 00:00:00 2001 From: EugeneTorap Date: Fri, 28 Apr 2023 11:31:06 +0300 Subject: [PATCH] fix lint errors --- superset/reports/notifications/email.py | 2 ++ superset/utils/core.py | 1 + tests/unit_tests/notifications/email_tests.py | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/superset/reports/notifications/email.py b/superset/reports/notifications/email.py index ed59fd930041..10a76e757387 100644 --- a/superset/reports/notifications/email.py +++ b/superset/reports/notifications/email.py @@ -109,6 +109,7 @@ def _get_content(self) -> EmailContent: } # Strip any malicious HTML from the description + # pylint: disable=no-member description = nh3.clean( self._content.description or "", tags=ALLOWED_TAGS, @@ -118,6 +119,7 @@ def _get_content(self) -> EmailContent: # Strip malicious HTML from embedded data, allowing only table elements if self._content.embedded_data is not None: df = self._content.embedded_data + # pylint: disable=no-member html_table = nh3.clean( df.to_html(na_rep="", index=True, escape=True), # pandas will escape the HTML in cells already, so passing diff --git a/superset/utils/core.py b/superset/utils/core.py index a7fe75ff8969..5da7e61ac3d2 100644 --- a/superset/utils/core.py +++ b/superset/utils/core.py @@ -703,6 +703,7 @@ def markdown(raw: str, markup_wrap: Optional[bool] = False) -> str: "markdown.extensions.codehilite", ], ) + # pylint: disable=no-member safe = nh3.clean(safe, tags=safe_markdown_tags, attributes=safe_markdown_attrs) if markup_wrap: safe = Markup(safe) diff --git a/tests/unit_tests/notifications/email_tests.py b/tests/unit_tests/notifications/email_tests.py index 8615a90affc4..697a9bac40c8 100644 --- a/tests/unit_tests/notifications/email_tests.py +++ b/tests/unit_tests/notifications/email_tests.py @@ -50,5 +50,8 @@ def test_render_description_with_html() -> None: ._get_content() .body ) - assert '

This is a test alert


' in email_body + assert ( + '

This is a test alert


' + in email_body + ) assert '<a href="http://www.example.com">333</a>' in email_body