From 9bb185c753bdffdc703ec3e57b8365e463420989 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 19:38:06 +0000 Subject: [PATCH 1/5] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.2 → v0.5.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.2...v0.5.4) - [github.com/pre-commit/mirrors-mypy: v1.10.1 → v1.11.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.1...v1.11.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c72b55fdec44..e9f57a7b746a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: auto-walrus - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.2 + rev: v0.5.4 hooks: - id: ruff - id: ruff-format @@ -47,7 +47,7 @@ repos: - id: validate-pyproject - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.10.1 + rev: v1.11.0 hooks: - id: mypy args: From 1ba9194926561d9a7fdfd5ff6fd5ae34aed07eaa Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 23 Jul 2024 10:11:20 +0200 Subject: [PATCH 2/5] ruff rule PLR1714 Consider merging multiple comparisons --- web_programming/emails_from_url.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/web_programming/emails_from_url.py b/web_programming/emails_from_url.py index 43fd78dcf5a4..93fd25d05fc5 100644 --- a/web_programming/emails_from_url.py +++ b/web_programming/emails_from_url.py @@ -31,12 +31,7 @@ def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None # Check the list of defined attributes. for name, value in attrs: # If href is defined, not empty nor # print it and not already in urls. - if ( - name == "href" - and value != "#" - and value != "" - and value not in self.urls - ): + if name == "href" and value not in set(self.urls + ["", "#"]): url = parse.urljoin(self.domain, value) self.urls.append(url) From b83848e63736d3c38c60cb93aa5566b8e30bb251 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 23 Jul 2024 10:13:39 +0200 Subject: [PATCH 3/5] ruff rule RUF005 Consider `[*self.urls, "", "#"]` instead of concatenation --- web_programming/emails_from_url.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_programming/emails_from_url.py b/web_programming/emails_from_url.py index 93fd25d05fc5..b972fa93e7c5 100644 --- a/web_programming/emails_from_url.py +++ b/web_programming/emails_from_url.py @@ -31,7 +31,7 @@ def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None # Check the list of defined attributes. for name, value in attrs: # If href is defined, not empty nor # print it and not already in urls. - if name == "href" and value not in set(self.urls + ["", "#"]): + if name == "href" and value not in set(*self.urls, "", "#"): url = parse.urljoin(self.domain, value) self.urls.append(url) From bec4206ac37c77d63367374a486bd5060c4a5b52 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 23 Jul 2024 10:17:17 +0200 Subject: [PATCH 4/5] Update emails_from_url.py --- web_programming/emails_from_url.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_programming/emails_from_url.py b/web_programming/emails_from_url.py index b972fa93e7c5..1ef7c5d3c225 100644 --- a/web_programming/emails_from_url.py +++ b/web_programming/emails_from_url.py @@ -31,7 +31,7 @@ def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None # Check the list of defined attributes. for name, value in attrs: # If href is defined, not empty nor # print it and not already in urls. - if name == "href" and value not in set(*self.urls, "", "#"): + if name == "href" and value not in set((*self.urls, "", "#")): url = parse.urljoin(self.domain, value) self.urls.append(url) From 7dab4523605106cc98bf1dca395b299dd7cbe2c0 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 23 Jul 2024 10:23:54 +0200 Subject: [PATCH 5/5] Update emails_from_url.py --- web_programming/emails_from_url.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_programming/emails_from_url.py b/web_programming/emails_from_url.py index 1ef7c5d3c225..d41dc4893608 100644 --- a/web_programming/emails_from_url.py +++ b/web_programming/emails_from_url.py @@ -31,7 +31,7 @@ def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None # Check the list of defined attributes. for name, value in attrs: # If href is defined, not empty nor # print it and not already in urls. - if name == "href" and value not in set((*self.urls, "", "#")): + if name == "href" and value not in (*self.urls, "", "#"): url = parse.urljoin(self.domain, value) self.urls.append(url)