`pygit2.remote.RemoteCollection` should implement `__contains__()` to match with valid remote names
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 58/100
Research direction
Start at pygit2.remote.RemoteCollection and inspect its existing getitem() behavior. Reproduce the issue's 'origin' membership example, then verify that membership matches valid remote names and rejects invalid ones after the collection supports contains().
Written by the indexing model from the issue text.
Description
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!
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 408
- Avg merge
- 2d 57m
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from libgit2/pygit2
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Similar issues
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DiamondLightSource/dodal#2211 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
openml/openml-python#1749 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sipyourdrink-ltd/bernstein#6191 ·