| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
This is inconsistent with what we're doing elsewhere in typeshed. That said, I can see us using that now that we include defaults in stubs. But if we do it we should do it consistently in typeshed, enforced by flake8-pyi. |
Sorry, something went wrong.
|
Not everywhere, but mostly Incomplete | None = None yeah. For comparison: Some stubs might also use it in select places specifically to pass pyrightconfig.stricter.json That being said, my opinion here is similar to #13765 and I would prefer this form. Anyway, for now my motivation is mainly to reduce accidental changes of : Incomplete | None = None <--> =None as I am copying over (and validating) microsoft's definitions used in pylance. And felt that the form =None was both easier to standardize to and had more benefits. |
Sorry, something went wrong.
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Sorry, something went wrong.
That's what I meant.
That's not a valid reason to use Incomplete in my opinion. (I also have a long term plan to get rid of the stricter config and generate it automatically on the fly from METADATA.toml fields, which ties into this.)
I agree, this form is more succinct and obviously equivalent. |
Sorry, something went wrong.
|
This change appears to have led to the following new error: error: Call to untyped function "add_edge" in typed context [no-untyped-call] I'm not well-versed in the state of these stubs, as it does appear quite a few annotations are missing, but the above seems somewhat worse (i.e. always an error) than the prior state. |
Sorry, something went wrong.
It is "worse", because it is accurate. Your type checker is now warning you that by using this method, you are forgoing static type safety, because no one validated which type you should be able to pass in. From here, you have two approaches:
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Replaced : Incomplete | None = None with =None.
Being consistent there will help reducing possible changes from merging https://github.com/microsoft/python-type-stubs/tree/main/stubs/networkx
This is still interpreted as Any | None by mypy. And now more correctly interpreted as Unknown | None by pyright.