Skip to content

Add from __future__ import annotations in more rules #19359

Open
@ntBre

Description

@ntBre

#19100 added support for importing future annotations for TC001, TC002, TC003, UP037, and RUF013 as a proof of concept, but other rules could also be affected. In particular,

all currently rely on future-rewritable-type-annotation (FA100) for similar behavior, but they could just add the import themselves. This would likely mean deprecating FA100 eventually.

Similarly, runtime-import-in-type-checking-block (TC004) uses much of the same infrastructure as TC001-003. Adding a future import could be another option instead of Action::Quote in its implementation (the whole Action enum can likely be replaced by the new TypingReference enum).

runtime-string-union (TC010) could also offer a fix by unquoting the flagged annotation and adding the future import.

Status

  • UP006
  • UP007
  • UP045
  • TC004
  • TC010

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleImplementing or modifying a lint ruletrackingA "meta" issue that tracks completion of a bigger task via a list of smaller scoped issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions