stubgen: Preserve simple defaults in function signatures by hamdanal · Pull Request #15355 · python/mypy

I installed the following packages

matplotlib==3.7.1
numpy==1.24.3
pandas==2.0.2
scipy==1.10.1
seaborn==0.12.2

and generated their stubs with mypy master then added defaults with stubdefaulter then compared the result with defaults added by this PR. The only differences I saw were related to the runtime vs static nature of the two tools:

  1. stubdefaulter not being able to add defaults to a file due to runtime errors, stubgen defaults were added
  2. if a default is set to a module variable, stubdefaulter uses its value as the default while stubgen ignores it

Please let me know if you have other ideas to test this change.