Compare commits

...
Author SHA1 Message Date
Mikaël Capelle 4fa50f89a4 Fix missing optional annotation in some cases. 2023-09-23 13:21:45 +02:00
3 changed files with 9 additions and 6 deletions
+6 -3
View File
@@ -108,9 +108,12 @@ def parse_python_signature(s: str, name: str) -> tuple[PyType, list[Argument]]:
raise ValueError(f"invalid argument: {pa}, {s}")
matches = m.groupdict()
arguments.append(
Argument(matches["name"], PyType(matches["type"]), matches["value"])
)
type_ = matches["type"]
if matches["value"] == "None":
if "None" not in type_ and "MoVariant" not in type_:
type_ = type_ + " | None"
arguments.append(Argument(matches["name"], PyType(type_), matches["value"]))
return PyType(return_type), arguments
+2 -2
View File
@@ -1639,7 +1639,7 @@ class IModList:
"""
...
def allModsByProfilePriority(
self: IModList, profile: IProfile = None
self: IModList, profile: IProfile | None = None
) -> Sequence[str]:
"""
Returns:
@@ -3818,7 +3818,7 @@ class ISaveGameInfoWidget(PyQt6.QtWidgets.QWidget):
"""
def __init__(
self: ISaveGameInfoWidget, parent: PyQt6.QtWidgets.QWidget = None
self: ISaveGameInfoWidget, parent: PyQt6.QtWidgets.QWidget | None = None
) -> None:
"""
Args:
@@ -15,7 +15,7 @@ class TaskDialog:
def __init__(
self: TaskDialog,
parent: PyQt6.QtWidgets.QWidget = None,
parent: PyQt6.QtWidgets.QWidget | None = None,
title: str = "",
main: str = "",
content: str = "",