has2k1 / plotnine

A Grammar of Graphics for Python
https://plotnine.org
MIT License
3.97k stars 212 forks source link

Wrong type hint for aes.__init__ #844

Closed nwweber closed 1 month ago

nwweber commented 1 month ago

Hey!

Issue: aes.__init(...) is type-hinted via its docstring. **kwargs is type-hinted incorrectly, viz.:

    **kwargs : dict
        Other aesthetic mappings

This type hint means 'the value of any named parameter should be of type dict'. Clearly, that is not the intention - kwargs itself is a dict, the values contained in it can be of arbitrary type.

This causes issues e.g. in PyCharm, which flags an incorrect type every single time I use aes(...) with keyword arguments.

Fix: change the docstring above to

    **kwargs : Any
        Other aesthetic mappings