Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCons: Integrate annotations where relevant #99640

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Repiteo
Copy link
Contributor

@Repiteo Repiteo commented Nov 24, 2024

In hindsight, applying a static boilerplate to all Python files was far too excessive. It turns out there is full support for gradually integrating modern type-hint syntax via FA1 instead. As such, this PR only integrates from __future__ import annotations on the files that can take immediate advantage of it:

# Before
from typing import List, Optional, Tuple, Union

def some_function(env: "ForwardDeclaredType") -> Optional[Tuple[List[str], Union[int, float]]]:

# After
from __future__ import annotations

def some_function(env: ForwardDeclaredType) -> tuple[list[str], int | float]] | None:

Footnotes

  1. https://docs.astral.sh/ruff/rules/#flake8-future-annotations-fa

• Expand Ruff linter to catch & upgrade legacy type-hint syntax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant