Improve repr of pygit2.hash
Offen
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 1.7k
- Forks
- 408
- Ø Merge
- 2 T. 57 Min.
- Gemergte PRs (30 T.)
- 7
Beschreibung
At present hash and pygit2.hash have the same repr. We can tell them apart by looking at the __module__ attribute. But not their type.
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygit2
>>> hash, pygit2.hash
(<built-in function hash>, <built-in function hash>)
>>> id(hash) - id(pygit2.hash)
2918112
>>> pygit2.hash.__module__
'pygit2._pygit2'
>>> hash.__module__
'builtins'
>>> type(hash), type(pygit2.hash)
(<class 'builtin_function_or_method'>, <class 'builtin_function_or_method'>)
>>>
This will confuse anyone who relies on repr to check that they are using the correct hash function.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das Python REPL-Beispiel aus dem Issue zu reproduzieren, und untersuche die Implementierung hinter pygit2.hash. Ermittle, wie seine repr derzeit mit dem built-in hash übereinstimmt, ändere dann die Darstellung so, dass die beiden Funktionen unterschieden werden, und überprüfe die überarbeitete Ausgabe in Python.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- devtools
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100