From 99ef70668a7e5bd5915f4a9263b1d0615c1554fa Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Wed, 17 Apr 2024 15:12:39 +0200 Subject: [PATCH 1/4] chore: update pre-commit dependencies Update `black` url according to documentation: https://black.readthedocs.io/en/stable/integrations/source_version_control.html#version-control-integration --- .github/workflows/python-package.yml | 2 +- .pre-commit-config.yaml | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 44d2110c..6415d00e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -37,7 +37,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.9'] + python-version: ['3.12'] tox-job: ["linters"] steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bdcb7ee9..5a7ae4a8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,16 +1,14 @@ repos: - hooks: - id: black - language_version: python3 - repo: https://github.com/ambv/black - rev: 22.10.0 + repo: https://github.com/psf/black-pre-commit-mirror + rev: 24.4.0 - hooks: - id: isort - language_version: python3 repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 - hooks: - id: mypy additional_dependencies: [types-requests, types-mock, lxml-stubs] repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.982 + rev: v1.9.0 From 9d3ef3ce57769107a09ff195ed80c3c797bdb50a Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Wed, 17 Apr 2024 15:12:39 +0200 Subject: [PATCH 2/4] chore: remove redundant parenthesis done by `black` --- extruct/w3cmicrodata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extruct/w3cmicrodata.py b/extruct/w3cmicrodata.py index 97647271..7c61c414 100644 --- a/extruct/w3cmicrodata.py +++ b/extruct/w3cmicrodata.py @@ -136,7 +136,7 @@ def _extract_item(self, node, items_seen, base_url, itemids): properties[name].append(value) props = [] - for (name, values) in properties.items(): + for name, values in properties.items(): if not self.strict and len(values) == 1: props.append((name, values[0])) else: From e785442a7f2ee4fe89818f861cd645f1e4ccd5f9 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Wed, 17 Apr 2024 15:12:40 +0200 Subject: [PATCH 3/4] feat: add `pyupgrade` to pre-commit Avoid outdated python code / styles --- .pre-commit-config.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5a7ae4a8..fad55f9a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,3 +12,7 @@ repos: additional_dependencies: [types-requests, types-mock, lxml-stubs] repo: https://github.com/pre-commit/mirrors-mypy rev: v1.9.0 + - hooks: + - id: pyupgrade + repo: https://github.com/asottile/pyupgrade + rev: v3.15.2 From 56163a62f86cee759a3f05396fc1cff1c8b94456 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Wed, 17 Apr 2024 15:12:40 +0200 Subject: [PATCH 4/4] chore: migrate typing `Set` now a feature of python as `set` --- extruct/w3cmicrodata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extruct/w3cmicrodata.py b/extruct/w3cmicrodata.py index 7c61c414..9336d6a1 100644 --- a/extruct/w3cmicrodata.py +++ b/extruct/w3cmicrodata.py @@ -74,7 +74,7 @@ def extract(self, htmlstring, base_url=None, encoding="UTF-8"): def extract_items(self, document, base_url): itemids = self._build_itemids(document) - items_seen: Set[Any] = set() + items_seen: set[Any] = set() return [ item for item in (