tobgu / pyrsistent

Persistent/Immutable/Functional data structures for Python
MIT License
2.03k stars 147 forks source link

Missing positional argument "stop" in call to "delete" of "PVector" #244

Closed dscrofts closed 2 years ago

dscrofts commented 2 years ago

When using pyrsistent.typing and PVector, mypy (version 0.931) gives the following error:

Missing positional argument "stop" in call to "delete" of "PVector"

Here is a minimal example to reproduce the issue:

from pyrsistent import pvector
from pyrsistent.typing import PVector

p1: PVector = pvector([1, 2, 3])
p2: PVector = p1.delete(0)  # Missing positional argument "stop" in call to "delete" of "PVector"

Changing line 71 in typing.pyi to have a default optional argument of None seems to fix the error:

71: -   def delete(self, index: int, stop: Optional[int]) -> PVector[T]: ...
71: +   def delete(self, index: int, stop: Optional[int] = None) -> PVector[T]: ...
tobgu commented 2 years ago

OK! Do you want to put up a tiny PR for it or should I go ahead and make the change Seems reasonable to me. Sorry for the delay in responding...

dscrofts commented 2 years ago

OK! Do you want to put up a tiny PR for it or should I go ahead and make the change Seems reasonable to me. Sorry for the delay in responding...

Done!