Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Type-annotate all function arguments and internal variables #8351

Closed
@ShadowJonathan

Description

@ShadowJonathan

Description:

Related to #8347, (partially) blocked till 3.5 is deprecated

The goal is to;

  • Convert existing name = ... # type: comments to name: type = .... (see "com2ann progress" below)
  • Put type annotations on every function's parameters and return type.
  • Put name: type annotations on;
    • Every class variable.
    • Every instance variable (declared in __init__() functions), unless;
      • They're constructing another instance (self.thing = Thing()) (dubious, see Use inline type hints in handlers/ and rest/ #10382 (comment))
      • They're getting assigned a non-container literal (1, b"", "", etc. but not None)
      • The assignment comes from a function/method call (self.thing = hs.get_another_thing()), given that the function signature is known and inferrable.

com2ann progress

(com2ann changes comment type annotations to inline type annotations, name = ... # type: to name: type = ..., this is possible since python 3.6, and standard across the python ecosystem.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-TaskRefactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions