Optional type args are mistyped in help
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 45/100
Rechercherichtung
Beginne damit, die beiden Beispiele über fire.Fire(main) zu reproduzieren und die erzeugte --help-Ausgabe zu prüfen. Verfolge, wie die Optional-Annotation in den angezeigten Typ umgewandelt wird, und überprüfe anschließend, dass beide Standardwerte die erwartete Formulierung Optional[str] erzeugen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Type annotations that use typing.Optional are incorrectly documented when showing help.
Example 1
from typing import Optional
import fire
def main(arg: Optional[str] = 'something'):
"""Do something with arg."""
if __name__ == '__main__':
fire.Fire(main)
The corresponding help output is:
INFO: Showing help with the command 'firetest.py -- --help'.
NAME
firetest.py - Do something with arg.
SYNOPSIS
firetest.py <flags>
DESCRIPTION
Do something with arg.
FLAGS
-a, --arg=ARG
Type: Optional
Default: 'something'
Here, Type: Optional is totally incorrect. It should be Optional[str]. My use of str is just an example and it can be anything.
Example 2
from typing import Optional
import fire
def main(arg: Optional[str] = None):
"""Do something with arg."""
if __name__ == '__main__':
fire.Fire(main)
The corresponding help output is:
INFO: Showing help with the command 'firetest.py -- --help'.
NAME
firetest.py - Do something with arg.
SYNOPSIS
firetest.py <flags>
DESCRIPTION
Do something with arg.
FLAGS
-a, --arg=ARG
Type: Optional[Optional]
Default: None
Here, Type: Optional[Optional] is even more incorrect. It should be Optional[str]. My use of str is just an example and it can be anything.
- Vorherrschende Sprache
- Python
- Sterne
- 28.2k
- Forks
- 1.5k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus google/python-fire
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
google/python-fire#693 ·
-
Release 0.7.2? Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 38/100
google/python-fire#698 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 58/100
google/python-fire#672 · 5 Kommentare ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
google/python-fire#665 · 2 Kommentare ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
google/python-fire#659 · 1 Kommentar ·
Alle Issues in google/python-fire
Ähnliche Issues
-
essnmx good first issue
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 95/100
-
[Feature] 奇物选择添加优先级 Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
syfoud/Simulated_Scepter#174 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Giskard-AI/giskard-oss#2840 · 1 Kommentar ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Offenarea: repo bug perceived difficulty: 2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
yeti-platform/yeti#1380 ·