Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.0: Update django.contrib.messages.storage.cookie #2106

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
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
15 changes: 14 additions & 1 deletion django-stubs/contrib/messages/storage/cookie.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
from typing import Any
from typing import Any, Callable, Sequence

from django.contrib.messages.storage.base import BaseStorage

Expand All @@ -14,7 +14,20 @@ class MessageEncoder(json.JSONEncoder):
class MessageDecoder(json.JSONDecoder):
def process_messages(self, obj: Any) -> Any: ...

class MessagePartSerializer:
def dumps(self, obj: Any) -> Sequence[str]: ...

class MessagePartGatherSerializer:
def dumps(self, obj: Any) -> bytes: ...

class MessageSerializer:
def loads(self, data: bytes | bytearray) -> Any: ...

class CookieStorage(BaseStorage):
cookie_name: str
max_cookie_size: int
not_finished: str
not_finished_json: str

def bisect_keep_left(a: list[int], fn: Callable[[list[int]], bool]) -> int: ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it is fine not to bother with Sequence or anything in such a utility function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you :)

def bisect_keep_right(a: list[int], fn: Callable[[list[int]], bool]) -> int: ...
1 change: 0 additions & 1 deletion scripts/stubtest/allowlist_todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ django.contrib.humanize.templatetags.humanize.intword_converters
django.contrib.messages.storage.cookie.CookieStorage.key_salt
django.contrib.messages.storage.cookie.MessageDecoder.decode
django.contrib.messages.storage.cookie.MessageEncoder.default
django.contrib.messages.storage.cookie.MessageSerializer
django.contrib.postgres.fields.ArrayField.formfield
django.contrib.postgres.fields.CIText.__init__
django.contrib.postgres.fields.HStoreField.formfield
Expand Down
5 changes: 0 additions & 5 deletions scripts/stubtest/allowlist_todo_django50.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ django.contrib.gis.management
django.contrib.gis.management.commands
django.contrib.gis.management.commands.inspectdb
django.contrib.gis.management.commands.ogrinspect
django.contrib.messages.storage.cookie.CookieStorage.not_finished_json
django.contrib.messages.storage.cookie.MessagePartGatherSerializer
django.contrib.messages.storage.cookie.MessagePartSerializer
django.contrib.messages.storage.cookie.bisect_keep_left
django.contrib.messages.storage.cookie.bisect_keep_right
django.contrib.messages.test
django.db.backends.base.features.BaseDatabaseFeatures.delete_can_self_reference_subquery
django.db.backends.base.features.BaseDatabaseFeatures.insert_test_table_with_defaults
Expand Down
Loading