Instagram / Instagram/LibCST

`ApplyTypeAnnotationsVisitor` does not respect `overwrite_existing_annotations` for attributes

Open
#1,159 0 comments 0 reactions 0 assignees View on GitHub
bug codemod
Dominant language
Python
Stars
1.9k
Forks
229
PR merge metrics
No merged PRs in 30d

Description

Consider this example:

```py
class X:
x: int
```

used to patch:

```py
class X:
x: str
```

`ApplyTypeAnnotationsVisitor` will *not* change the type annotation on `X.x` to `int` even if you set `overwrite_existing_annotations` to True. This is the case even if you change it to be an assign (as in `x: str = "a"`.)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.