pygit2 icon indicating copy to clipboard operation
pygit2 copied to clipboard

`pygit2.remote.RemoteCollection` should implement `__contains__()` to match with valid remote names

Open imbuedhope opened this issue 4 years ago • 0 comments

As it stands the following happens

>>> import os, pygit2
>>> r = pygit2.Repository(os.getcwd())
>>> 'origin' in r.remotes
False

Whereas looping over the names results in a match

>>> import os, pygit2
>>> r = pygit2.Repository(os.getcwd())
>>> 'origin' in [remote.name for remote in r.remotes]
True

This behavior seems unpythonic since remote.RemoteCollection implements __getitem__() and in doesn't match with a valid key in the collection.

If this change makes sense I can to try fix it when I have time, lmk!

imbuedhope avatar Jun 22 '21 23:06 imbuedhope