typeshed
typeshed copied to clipboard
psutil: Type `ad_value` as `object`
After #14063, calls to psutil.process_iter and psutil.Process.as_dict are being reported by Pyright, as the ad_value parameter is untyped.
However, given that (from the documentation) this is just a placeholder value to use when an error is raised while fetching some attribute, I think that typing it as object is appropriate.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
Considering that the supplied type influenced the result type (but we can't express that relation properly)
Can't we? Wouldn't be possible to create a (fake) Process subclass that include the info field as a generic TypedDict and use overload to see if we have to return that subclass or the normal class?