From f529ba8254081a7db7a73c00771d8345bb2177c4 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 1 May 2026 20:33:03 -0500 Subject: [PATCH] Squash remaining pyright warnings --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 3 ++- src/earwigbot/wiki/copyvios/parsers.py | 4 ++-- uv.lock | 35 ++++++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 88898ca..143ab3d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,11 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.8 + rev: v0.15.12 hooks: - id: ruff args: [--fix] - id: ruff-format - repo: https://github.com/RobertCraigie/pyright-python - rev: v1.1.383 + rev: v1.1.409 hooks: - id: pyright diff --git a/pyproject.toml b/pyproject.toml index c9a72f0..23daa04 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,8 @@ copyvios = [ "tldextract >= 3.1.0", # Getting domains for the multithreaded workers ] dev = [ - "pytest >= 8.3.1" + "gitpython>=3.1.49", + "pytest >= 8.3.1", ] [project.urls] diff --git a/src/earwigbot/wiki/copyvios/parsers.py b/src/earwigbot/wiki/copyvios/parsers.py index c66b9e2..124c80d 100644 --- a/src/earwigbot/wiki/copyvios/parsers.py +++ b/src/earwigbot/wiki/copyvios/parsers.py @@ -301,10 +301,10 @@ class HTMLParser(SourceParser): """Clean a BeautifulSoup tree of invisible tags.""" import bs4 - def is_comment(text: bs4.element.Tag) -> bool: + def is_comment(text: str | None) -> bool: return isinstance(text, bs4.element.Comment) - for comment in soup.find_all(text=is_comment): + for comment in soup.find_all(string=is_comment): comment.extract() for tag in self.hidden_tags: for element in soup.find_all(tag): diff --git a/uv.lock b/uv.lock index 28267ed..8e79b79 100644 --- a/uv.lock +++ b/uv.lock @@ -287,6 +287,7 @@ crypto = [ { name = "cryptography" }, ] dev = [ + { name = "gitpython" }, { name = "pytest" }, ] sql = [ @@ -298,6 +299,7 @@ requires-dist = [ { name = "beautifulsoup4", marker = "extra == 'copyvios'", specifier = ">=4.9.3" }, { name = "charset-normalizer", marker = "extra == 'copyvios'", specifier = ">=3.3.2" }, { name = "cryptography", marker = "extra == 'crypto'", specifier = ">=3.4.7" }, + { name = "gitpython", marker = "extra == 'dev'", specifier = ">=3.1.49" }, { name = "lxml", marker = "extra == 'copyvios'", specifier = ">=4.6.3" }, { name = "mwparserfromhell", specifier = ">=0.6" }, { name = "nltk", marker = "extra == 'copyvios'", specifier = ">=3.9.1" }, @@ -321,6 +323,30 @@ wheels = [ ] [[package]] +name = "gitdb" +version = "4.0.12" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "smmap" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/72/94/63b0fc47eb32792c7ba1fe1b694daec9a63620db1e313033d18140c2320a/gitdb-4.0.12.tar.gz", hash = "sha256:5ef71f855d191a3326fcfbc0d5da835f26b13fbcba60c32c21091c349ffdb571", size = 394684, upload-time = "2025-01-02T07:20:46.413Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a0/61/5c78b91c3143ed5c14207f463aecfc8f9dbb5092fb2869baf37c273b2705/gitdb-4.0.12-py3-none-any.whl", hash = "sha256:67073e15955400952c6565cc3e707c554a4eea2e428946f7a4c162fab9bd9bcf", size = 62794, upload-time = "2025-01-02T07:20:43.624Z" }, +] + +[[package]] +name = "gitpython" +version = "3.1.49" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "gitdb" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e1/63/210aaa302d6a0a78daa67c5c15bbac2cad361722841278b0209b6da20855/gitpython-3.1.49.tar.gz", hash = "sha256:42f9399c9eb33fc581014bedd76049dfbaf6375aa2a5754575966387280315e1", size = 219367, upload-time = "2026-04-29T00:31:20.478Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/fd/6f/b842bfa6f21d6f87c57f9abf7194225e55279d96d869775e19e9f7236fc5/gitpython-3.1.49-py3-none-any.whl", hash = "sha256:024b0422d7f84d15cd794844e029ffebd4c5d42a7eb9b936b458697ef550a02c", size = 212190, upload-time = "2026-04-29T00:31:18.412Z" }, +] + +[[package]] name = "idna" version = "3.13" source = { registry = "https://pypi.org/simple" } @@ -805,6 +831,15 @@ wheels = [ ] [[package]] +name = "smmap" +version = "5.0.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/1f/ea/49c993d6dfdd7338c9b1000a0f36817ed7ec84577ae2e52f890d1a4ff909/smmap-5.0.3.tar.gz", hash = "sha256:4d9debb8b99007ae47165abc08670bd74cb74b5227dda7f643eccc4e9eb5642c", size = 22506, upload-time = "2026-03-09T03:43:26.1Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c1/d4/59e74daffcb57a07668852eeeb6035af9f32cbfd7a1d2511f17d2fe6a738/smmap-5.0.3-py3-none-any.whl", hash = "sha256:c106e05d5a61449cf6ba9a1e650227ecfb141590d2a98412103ff35d89fc7b2f", size = 24390, upload-time = "2026-03-09T03:43:24.361Z" }, +] + +[[package]] name = "soupsieve" version = "2.8.3" source = { registry = "https://pypi.org/simple" }