Incorrect result type for `returns.curry.partial` with keyword arguments for positional parameters
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 45/100
Rechercherichtung
Beginne am Einstiegspunkt returns.curry.partial und reproduziere das Problem anhand des foo-Beispiels mit Python 3.13.4, returns 0.25.0 und mypy 1.15.0. Die Arbeit ist abgeschlossen, wenn ein teilweise per Keyword angewendeter Positionsparameter einen Typ für den verbleibenden Keyword-only-Parameter erzeugt und die Verwendung als Positionsparameter durch die Typprüfung abgelehnt wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Bug report
What's wrong
When using returns.curry.partial, if you partially apply a positional parameter using a keyword argument, the resulting type is incorrect. Result type of callable allows passing the remaining arguments as positional, but this leads to a runtime error.
Example
def foo(x: int, y: int) -> None:
...
bar = returns.curry.partial(foo, x=1)
reveal_type(bar)
# => Mypy: "def (y: builtins.int)"
# => Expected: "def (*, y: builtins.int)"
bar(2)
# No errors from mypy, but got runtime error
# TypeError: foo() got multiple values for argument 'x'
How is that should be
In this scenario, the remaining parameters should be strictly keyword-only. The resulting type should reflect this restriction, and passing a positional argument should be flagged as an error at type checking time.
System information
pythonversion:3.13.4returnsversion:0.25.0mypyversion:1.15.0
- Vorherrschende Sprache
- Python
- Sterne
- 4.4k
- Forks
- 155
- Ø Merge
- 2 Std. 13 Min.
- Gemergte PRs (30 T.)
- 20
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
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 dry-python/returns
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
dry-python/returns#2394 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 52/100
dry-python/returns#2365 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
dry-python/returns#2355 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
dry-python/returns#2295 · 4 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
dry-python/returns#2253 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in dry-python/returns
Ähnliche Issues
-
Action calls retired claude-3-5-haiku-20241022, generating failing API requests for every userOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 91/100
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 92/100
-
enhancement P2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Toloka/tolokaforge#1776 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
TencentCloud/Octop#1622 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[arch] gate_sync.sh: stale remote tmp files on install failure; overlapping cron runs unguardedOffenarch area:fleet priority:p3 severity:low track:hosted-product
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag