google / pytype

A static type analyzer for Python code
https://google.github.io/pytype
Other
4.78k stars 281 forks source link

Make merge_pyi not to overwrite existing type annotations. When we assume that the existing type annotations are correct, we should totally not overwrite it as the same thing can be named in different ways depending on how you import it. But it's not a good idea to change the way how the users have written the import already. #1784

Closed copybara-service[bot] closed 2 months ago

copybara-service[bot] commented 2 months ago

Make merge_pyi not to overwrite existing type annotations. When we assume that the existing type annotations are correct, we should totally not overwrite it as the same thing can be named in different ways depending on how you import it. But it's not a good idea to change the way how the users have written the import already.

The former change was introduced in https://github.com/google/pytype/pull/1644, but it seems that respecting the original code best suits what we think this tool should behave.