madpah / requirements-parser

A Pip requirements file parser.
https://requirements-parser.readthedocs.io
Apache License 2.0
125 stars 41 forks source link

Type members of Requirement as Optional #65

Open jenshnielsen opened 2 years ago

jenshnielsen commented 2 years ago

This both gives better types for end users of the class as all the members previously inferred as NoneType and allows us to remove a significant amount of ignore comments.

We ran into this issue in https://github.com/QCoDeS/Qcodes/pull/3848 where we expect the name to be a str but the type is inferred as None

In that code we are using Requirement.name which has a type of None in 0.4.0 and 0.5.0

With some rearranging of the code it may be possible to remove the optional from some of the members but for now this makes the types more correct.

madpah commented 2 years ago

Hi @jenshnielsen - thanks for the PR - can you please look to address the failing checks?

jenshnielsen commented 2 years ago

Not sure where that import came from must have been a "helpful" ide importing an incomplete symbol should be fixed now