mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-19 02:15:59 +08:00
fifth iteration
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
from django.db.models.base import Model
|
||||
@@ -29,21 +29,8 @@ class SessionBase:
|
||||
def set_test_cookie(self) -> None: ...
|
||||
def test_cookie_worked(self) -> bool: ...
|
||||
def delete_test_cookie(self) -> None: ...
|
||||
def encode(
|
||||
self,
|
||||
session_dict: Union[
|
||||
Dict[str, Union[datetime, str]],
|
||||
Dict[str, Union[int, str]],
|
||||
Dict[str, Model],
|
||||
],
|
||||
) -> str: ...
|
||||
def decode(
|
||||
self, session_data: Union[bytes, str]
|
||||
) -> Union[
|
||||
Dict[str, Union[datetime, str]],
|
||||
Dict[str, Union[int, str]],
|
||||
Dict[str, Model],
|
||||
]: ...
|
||||
def encode(self, session_dict: Dict[str, Model]) -> str: ...
|
||||
def decode(self, session_data: Union[bytes, str]) -> Dict[str, Model]: ...
|
||||
def update(self, dict_: Dict[str, int]) -> None: ...
|
||||
def has_key(self, key: Any): ...
|
||||
def keys(self): ...
|
||||
@@ -54,9 +41,7 @@ class SessionBase:
|
||||
session_key: Any = ...
|
||||
def get_expiry_age(self, **kwargs: Any) -> int: ...
|
||||
def get_expiry_date(self, **kwargs: Any) -> datetime: ...
|
||||
def set_expiry(
|
||||
self, value: Optional[Union[datetime, timedelta, int]]
|
||||
) -> None: ...
|
||||
def set_expiry(self, value: Optional[Union[datetime, int]]) -> None: ...
|
||||
def get_expire_at_browser_close(self) -> bool: ...
|
||||
def flush(self) -> None: ...
|
||||
def cycle_key(self) -> None: ...
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional, Type, Union
|
||||
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
@@ -14,19 +13,12 @@ class SessionStore(SessionBase):
|
||||
@classmethod
|
||||
def get_model_class(cls) -> Type[Session]: ...
|
||||
def model(self) -> Type[AbstractBaseSession]: ...
|
||||
def load(
|
||||
self
|
||||
) -> Union[Dict[str, Model], Dict[str, int], Dict[str, str]]: ...
|
||||
def load(self) -> Dict[str, Union[Model, int, str]]: ...
|
||||
def exists(self, session_key: Optional[str]) -> bool: ...
|
||||
modified: bool = ...
|
||||
def create(self) -> None: ...
|
||||
def create_model_instance(
|
||||
self,
|
||||
data: Union[
|
||||
Dict[str, Union[datetime, str]],
|
||||
Dict[str, Union[int, str]],
|
||||
Dict[str, Model],
|
||||
],
|
||||
self, data: Dict[str, Model]
|
||||
) -> AbstractBaseSession: ...
|
||||
def save(self, must_create: bool = ...) -> None: ...
|
||||
def delete(self, session_key: Optional[str] = ...) -> None: ...
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional, Union
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from django.core.signing import JSONSerializer as BaseJSONSerializer
|
||||
from django.db.models.base import Model
|
||||
|
||||
|
||||
class PickleSerializer:
|
||||
def dumps(
|
||||
self, obj: Union[Dict[str, Union[datetime, str]], Dict[str, Model]]
|
||||
) -> bytes: ...
|
||||
def loads(
|
||||
self, data: bytes
|
||||
) -> Union[Dict[str, Union[datetime, str]], Dict[str, Model]]: ...
|
||||
def dumps(self, obj: Dict[str, Model]) -> bytes: ...
|
||||
def loads(self, data: bytes) -> Dict[str, Model]: ...
|
||||
|
||||
JSONSerializer = BaseJSONSerializer
|
||||
|
||||
Reference in New Issue
Block a user