diff --git a/src/mo2/stubs/generator/parser.py b/src/mo2/stubs/generator/parser.py index e42c17a..f4eb4db 100644 --- a/src/mo2/stubs/generator/parser.py +++ b/src/mo2/stubs/generator/parser.py @@ -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 diff --git a/stubs/2.5.0/mobase-stubs/__init__.pyi b/stubs/2.5.0/mobase-stubs/__init__.pyi index 8281ad4..1c10d44 100644 --- a/stubs/2.5.0/mobase-stubs/__init__.pyi +++ b/stubs/2.5.0/mobase-stubs/__init__.pyi @@ -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: diff --git a/stubs/2.5.0/mobase-stubs/widgets/__init__.pyi b/stubs/2.5.0/mobase-stubs/widgets/__init__.pyi index 73f1cda..f745484 100644 --- a/stubs/2.5.0/mobase-stubs/widgets/__init__.pyi +++ b/stubs/2.5.0/mobase-stubs/widgets/__init__.pyi @@ -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 = "",