Skip to content

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Aug 29, 2024

This is a backport of PR #12744 as merged into main (c947145).

Fixes #11916 (comment)

Importing Self from typing breaks the return type on Python 3.9 and under. You should be using from typing_extension import Self instead.

For example, the following code:

def pytest_collect_file(file_path: pathlib.Path, parent: Node) -> CheckdocsItem | None: if file_path.name not in project_files: return None return CheckdocsItem.from_parent(parent, name='project')

Will error with Returning Any from function declared to return "CheckdocsItem | None" [no-any-return] on 3.8 & 3.9, but pass on 3.10+ Which can only be worked around by disabling the error entirely in mypy, or doing:

def pytest_collect_file(file_path: pathlib.Path, parent: Node) -> CheckdocsItem | None: if file_path.name not in project_files: return None if sys.version_info >= (3, 10): return CheckdocsItem.from_parent(parent, name='project') else: return cast(CheckdocsItem, CheckdocsItem.from_parent(parent, name='project'))
Fix incorrect Self import from typing instead of typing_extensions. --------- Co-authored-by: Bruno Oliveira <bruno@soliv.dev> (cherry picked from commit c947145)
pre-commit-ci bot and others added 8 commits August 29, 2024 09:08
updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.2 → v0.5.4](astral-sh/ruff-pre-commit@v0.5.2...v0.5.4) - [github.com/pre-commit/mirrors-mypy: v1.10.1 → v1.11.0](pre-commit/mirrors-mypy@v1.10.1...v1.11.0)
updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.4 → v0.5.5](astral-sh/ruff-pre-commit@v0.5.4...v0.5.5) - [github.com/asottile/pyupgrade: v3.16.0 → v3.17.0](asottile/pyupgrade@v3.16.0...v3.17.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.5 → v0.5.6](astral-sh/ruff-pre-commit@v0.5.5...v0.5.6) - [github.com/pre-commit/mirrors-mypy: v1.11.0 → v1.11.1](pre-commit/mirrors-mypy@v1.11.0...v1.11.1) - [github.com/tox-dev/pyproject-fmt: 2.1.4 → 2.2.1](tox-dev/pyproject-fmt@2.1.4...2.2.1)
According to https://pypi.org/project/types-pkg-resources/#history, that package has been supplanted by `types-setuptools`.
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.6 → v0.5.7](astral-sh/ruff-pre-commit@v0.5.6...v0.5.7) * Apply pyupgrade latest changes Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.7 → v0.6.1](astral-sh/ruff-pre-commit@v0.5.7...v0.6.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.1 → v0.6.2](astral-sh/ruff-pre-commit@v0.6.1...v0.6.2) - [github.com/pre-commit/mirrors-mypy: v1.11.1 → v1.11.2](pre-commit/mirrors-mypy@v1.11.1...v1.11.2) * Fix sphinx with a more robust fix Until sphinx-contrib/sphinxcontrib-towncrier#92 is resolved. Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
@nicoddemus
Copy link
Member

I had to cherry-pick several commits regarding pre-commit version updates and type-checking fixes.

@nicoddemus
Copy link
Member

I will not merge myself, would like a second set of eyes to take a look and merge. 👍

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, everything is either automated or a cherry-picking it seems (so if the CI is green there's probably no issues with it). Not sure if I we should merge or squash though.

@nicoddemus
Copy link
Member

In this case I think merging is appropriate, so the cherry-picked commits are preserved. 👍

@nicoddemus nicoddemus merged commit e22c188 into 8.3.x Aug 29, 2024
27 checks passed
@nicoddemus nicoddemus deleted the patchback/backports/8.3.x/c947145fbb4aeec810a259b19f70fcb52fd53ad4/pr-12744 branch August 29, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants