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
Description
Description:
Related to #8347, (partially) blocked till 3.5 is deprecated
The goal is to;
- Convert existing
name = ... # type:
comments toname: 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 inhandlers/
andrest/
#10382 (comment)) - They're getting assigned a non-container literal (
1
,b""
,""
, etc. but notNone
) - The assignment comes from a function/method call (
self.thing = hs.get_another_thing()
), given that the function signature is known and inferrable.
- They're constructing another instance (
com2ann
progress
-
tests/
(Use inline type hints intests/
#10350) -
synapse/
- Other (One last inline type hint (for the whole repo) #10418)
(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.)