Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions stdlib/http/cookies.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
from collections.abc import Iterable, Mapping
from types import GenericAlias
from typing import Any, Generic, TypeVar, overload
from typing import Any, Generic, TypedDict, TypeVar, overload, type_check_only
from typing_extensions import TypeAlias

__all__ = ["CookieError", "BaseCookie", "SimpleCookie"]
Expand All @@ -19,23 +20,50 @@

class CookieError(Exception): ...

class Morsel(dict[str, Any], Generic[_T]):
if sys.version_info >= (3, 14):
@type_check_only
class _MorselDictType(TypedDict):
expires: Any
path: Any
comment: Any
domain: Any
max_age: Any
secure: Any
httponly: Any
version: Any
samesite: Any
partitioned: Any # New in version 3.14.

else:
@type_check_only
class _MorselDictType(TypedDict):
expires: Any
path: Any
comment: Any
domain: Any
max_age: Any
secure: Any
httponly: Any
version: Any
samesite: Any

class Morsel(_MorselDictType, Generic[_T]):
@property

Check failure on line 51 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def value(self) -> str: ...
@property

Check failure on line 53 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def coded_value(self) -> _T: ...
@property

Check failure on line 55 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def key(self) -> str: ...
def __init__(self) -> None: ...

Check failure on line 57 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def set(self, key: str, val: str, coded_val: _T) -> None: ...

Check failure on line 58 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def setdefault(self, key: str, val: str | None = None) -> str: ...

Check failure on line 59 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
# The dict update can also get a keywords argument so this is incompatible
@overload # type: ignore[override]

Check failure on line 61 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def update(self, values: Mapping[str, str]) -> None: ...
@overload

Check failure on line 63 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def update(self, values: Iterable[tuple[str, str]]) -> None: ...
def isReservedKey(self, K: str) -> bool: ...

Check failure on line 65 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
def output(self, attrs: list[str] | None = None, header: str = "Set-Cookie:") -> str: ...

Check failure on line 66 in stdlib/http/cookies.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

TypedDict classes can contain only type annotations (reportGeneralTypeIssues)
__str__ = output
def js_output(self, attrs: list[str] | None = None) -> str: ...
def OutputString(self, attrs: list[str] | None = None) -> str: ...
Expand Down
Loading