mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-16 00:37:11 +08:00
better stubs
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
# Stubs for django.contrib.sessions.backends.base (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
from django.db.models.base import Model
|
||||
from typing import Dict, Optional, Union
|
||||
|
||||
VALID_KEY_CHARS: Any
|
||||
|
||||
@@ -16,49 +11,43 @@ class UpdateError(Exception): ...
|
||||
class SessionBase:
|
||||
TEST_COOKIE_NAME: str = ...
|
||||
TEST_COOKIE_VALUE: str = ...
|
||||
__not_given: Any = ...
|
||||
_session_key: Any = ...
|
||||
accessed: bool = ...
|
||||
modified: bool = ...
|
||||
serializer: Any = ...
|
||||
def __init__(self, session_key: Optional[str] = ...) -> None: ...
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
def __getitem__(self, key: str) -> Union[str, Model, int]: ...
|
||||
def __setitem__(self, key: str, value: Union[str, datetime, int]) -> None: ...
|
||||
def __setitem__(
|
||||
self, key: str, value: Union[str, datetime, Model, int]
|
||||
) -> None: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
def get(
|
||||
self, key: str, default: Optional[str] = ...
|
||||
) -> Optional[Union[str, datetime, int]]: ...
|
||||
def pop(self, key: str, default: object = ...) -> Union[str, int]: ...
|
||||
) -> Optional[Union[str, int, datetime]]: ...
|
||||
def pop(self, key: str, default: Any = ...) -> Union[str, int]: ...
|
||||
def setdefault(self, key: str, value: str) -> str: ...
|
||||
def set_test_cookie(self) -> None: ...
|
||||
def test_cookie_worked(self) -> bool: ...
|
||||
def delete_test_cookie(self) -> None: ...
|
||||
def _hash(self, value: bytes) -> str: ...
|
||||
def encode(self, session_dict: Dict[str, Union[str, int, datetime]]) -> str: ...
|
||||
def decode(self, session_data: Union[str, bytes]) -> Dict[str, Union[str, int]]: ...
|
||||
def encode(
|
||||
self, session_dict: Dict[str, Union[str, int, Model, datetime]]
|
||||
) -> str: ...
|
||||
def decode(
|
||||
self, session_data: Union[str, bytes]
|
||||
) -> Dict[str, Union[str, int, Model, datetime]]: ...
|
||||
def update(self, dict_: Dict[str, int]) -> None: ...
|
||||
def has_key(self, key: Any): ...
|
||||
def keys(self): ...
|
||||
def values(self): ...
|
||||
def items(self): ...
|
||||
_session_cache: Any = ...
|
||||
def clear(self) -> None: ...
|
||||
def is_empty(self) -> bool: ...
|
||||
def _get_new_session_key(self) -> str: ...
|
||||
def _get_or_create_session_key(self) -> str: ...
|
||||
def _validate_session_key(self, key: Optional[str]) -> Optional[Union[str, bool]]: ...
|
||||
def _get_session_key(self) -> Optional[str]: ...
|
||||
__session_key: Any = ...
|
||||
def _set_session_key(self, value: Optional[str]) -> None: ...
|
||||
session_key: Any = ...
|
||||
def _get_session(
|
||||
self, no_load: bool = ...
|
||||
) -> Dict[str, Union[str, int, datetime, Model]]: ...
|
||||
_session: 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, int, timedelta]]) -> None: ...
|
||||
def set_expiry(
|
||||
self, value: Optional[Union[datetime, int, timedelta]]
|
||||
) -> None: ...
|
||||
def get_expire_at_browser_close(self) -> bool: ...
|
||||
def flush(self) -> None: ...
|
||||
def cycle_key(self) -> None: ...
|
||||
|
||||
@@ -1,22 +1,17 @@
|
||||
# Stubs for django.contrib.sessions.backends.cache (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
from typing import Any, Optional
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
KEY_PREFIX: str
|
||||
|
||||
class SessionStore(SessionBase):
|
||||
accessed: bool
|
||||
serializer: Type[django.core.signing.JSONSerializer]
|
||||
cache_key_prefix: Any = ...
|
||||
_cache: Any = ...
|
||||
def __init__(self, session_key: None = ...) -> None: ...
|
||||
def __init__(self, session_key: Optional[str] = ...) -> None: ...
|
||||
@property
|
||||
def cache_key(self) -> str: ...
|
||||
_session_key: Any = ...
|
||||
def load(self) -> Dict[Any, Any]: ...
|
||||
def load(self) -> Dict[str, str]: ...
|
||||
modified: bool = ...
|
||||
def create(self) -> None: ...
|
||||
def save(self, must_create: bool = ...) -> None: ...
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
# Stubs for django.contrib.sessions.backends.cached_db (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from django.contrib.sessions.backends.db import SessionStore as DBStore
|
||||
from typing import Any, Optional
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
KEY_PREFIX: str
|
||||
|
||||
class SessionStore(DBStore):
|
||||
accessed: bool
|
||||
modified: bool
|
||||
serializer: Type[django.core.signing.JSONSerializer]
|
||||
cache_key_prefix: Any = ...
|
||||
_cache: Any = ...
|
||||
def __init__(self, session_key: Optional[str] = ...) -> None: ...
|
||||
@property
|
||||
def cache_key(self) -> str: ...
|
||||
def load(self) -> Dict[Any, Any]: ...
|
||||
def exists(self, session_key: str) -> bool: ...
|
||||
def load(self) -> Dict[str, str]: ...
|
||||
def exists(self, session_key: Optional[str]) -> bool: ...
|
||||
def save(self, must_create: bool = ...) -> None: ...
|
||||
def delete(self, session_key: Optional[str] = ...) -> None: ...
|
||||
_session_key: Any = ...
|
||||
def flush(self) -> None: ...
|
||||
|
||||
@@ -1,28 +1,25 @@
|
||||
# Stubs for django.contrib.sessions.backends.db (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional, Type, Union
|
||||
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
from typing import Any, Optional
|
||||
|
||||
from datetime import datetime
|
||||
from django.contrib.sessions.base_session import AbstractBaseSession
|
||||
from django.contrib.sessions.models import Session
|
||||
from typing import Dict, Optional, Type, Union
|
||||
from django.db.models.base import Model
|
||||
|
||||
|
||||
class SessionStore(SessionBase):
|
||||
accessed: bool
|
||||
serializer: Type[django.core.signing.JSONSerializer]
|
||||
def __init__(self, session_key: Optional[str] = ...) -> None: ...
|
||||
@classmethod
|
||||
def get_model_class(cls) -> Type[Session]: ...
|
||||
def model(self) -> Type[AbstractBaseSession]: ...
|
||||
_session_key: Any = ...
|
||||
def _get_session_from_db(self) -> Optional[AbstractBaseSession]: ...
|
||||
def load(self) -> Dict[str, Union[str, int]]: ...
|
||||
def load(self) -> Dict[str, Union[Model, str, int]]: ...
|
||||
def exists(self, session_key: Optional[str]) -> bool: ...
|
||||
modified: bool = ...
|
||||
def create(self) -> None: ...
|
||||
def create_model_instance(
|
||||
self, data: Dict[str, Union[str, int, datetime]]
|
||||
self, data: Dict[str, Union[int, str, Model, datetime]]
|
||||
) -> AbstractBaseSession: ...
|
||||
def save(self, must_create: bool = ...) -> None: ...
|
||||
def delete(self, session_key: Optional[str] = ...) -> None: ...
|
||||
|
||||
@@ -1,23 +1,15 @@
|
||||
# Stubs for django.contrib.sessions.backends.file (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
from typing import Any, Optional
|
||||
|
||||
from typing import Dict, Optional
|
||||
|
||||
class SessionStore(SessionBase):
|
||||
storage_path: Any = ...
|
||||
file_prefix: Any = ...
|
||||
accessed: bool
|
||||
serializer: Type[django.core.signing.JSONSerializer]
|
||||
storage_path: str = ...
|
||||
file_prefix: str = ...
|
||||
def __init__(self, session_key: Optional[str] = ...) -> None: ...
|
||||
@classmethod
|
||||
def _get_storage_path(cls) -> str: ...
|
||||
def _key_to_file(self, session_key: Optional[str] = ...) -> str: ...
|
||||
def _last_modification(self): ...
|
||||
def _expiry_date(self, session_data: Any): ...
|
||||
_session_key: Any = ...
|
||||
def load(self) -> Dict[str, str]: ...
|
||||
def load(self) -> Dict[str, Union[str, int]]: ...
|
||||
modified: bool = ...
|
||||
def create(self) -> None: ...
|
||||
def save(self, must_create: bool = ...) -> None: ...
|
||||
|
||||
@@ -1,23 +1,18 @@
|
||||
# Stubs for django.contrib.sessions.backends.signed_cookies (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
from typing import Any, Optional
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Dict, Optional, Union
|
||||
|
||||
class SessionStore(SessionBase):
|
||||
accessed: bool
|
||||
serializer: Type[django.core.signing.JSONSerializer]
|
||||
def load(self) -> Dict[str, Union[str, datetime]]: ...
|
||||
modified: bool = ...
|
||||
def create(self) -> None: ...
|
||||
_session_key: Any = ...
|
||||
def save(self, must_create: bool = ...) -> None: ...
|
||||
def exists(self, session_key: str = ...) -> bool: ...
|
||||
_session_cache: Any = ...
|
||||
def exists(self, session_key: Optional[str] = ...) -> bool: ...
|
||||
def delete(self, session_key: Optional[str] = ...) -> None: ...
|
||||
def cycle_key(self) -> None: ...
|
||||
def _get_session_key(self) -> str: ...
|
||||
@classmethod
|
||||
def clear_expired(cls) -> None: ...
|
||||
|
||||
@@ -1,5 +1,30 @@
|
||||
from typing import Dict
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
class AbstractBaseSession:
|
||||
def __str__(self) -> str: ...
|
||||
from django.db import models
|
||||
|
||||
|
||||
class BaseSessionManager(models.Manager):
|
||||
creation_counter: int
|
||||
model: None
|
||||
name: None
|
||||
def encode(self, session_dict: Dict[str, int]) -> str: ...
|
||||
def save(
|
||||
self,
|
||||
session_key: str,
|
||||
session_dict: Dict[str, int],
|
||||
expire_date: datetime,
|
||||
) -> AbstractBaseSession: ...
|
||||
|
||||
class AbstractBaseSession(models.Model):
|
||||
session_key: Any = ...
|
||||
session_data: Any = ...
|
||||
expire_date: Any = ...
|
||||
objects: Any = ...
|
||||
class Meta:
|
||||
abstract: bool = ...
|
||||
verbose_name: Any = ...
|
||||
verbose_name_plural: Any = ...
|
||||
@classmethod
|
||||
def get_session_store_class(cls) -> None: ...
|
||||
def get_decoded(self) -> Dict[str, int]: ...
|
||||
|
||||
@@ -1,2 +1,11 @@
|
||||
class Command:
|
||||
def handle(self, **options) -> None: ...
|
||||
from typing import Any, Optional
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
stderr: django.core.management.base.OutputWrapper
|
||||
stdout: django.core.management.base.OutputWrapper
|
||||
style: django.core.management.color.Style
|
||||
help: str = ...
|
||||
def handle(self, **options: Any) -> None: ...
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
# Stubs for django.contrib.sessions.middleware (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from django.utils.deprecation import MiddlewareMixin
|
||||
from typing import Any, Optional
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponseBase
|
||||
from typing import Callable, Optional
|
||||
from django.utils.deprecation import MiddlewareMixin
|
||||
|
||||
|
||||
class SessionMiddleware(MiddlewareMixin):
|
||||
get_response: Any = ...
|
||||
SessionStore: Any = ...
|
||||
get_response: Callable = ...
|
||||
SessionStore: Type[django.contrib.sessions.backends.db.SessionStore] = ...
|
||||
def __init__(self, get_response: Optional[Callable] = ...) -> None: ...
|
||||
def process_request(self, request: WSGIRequest) -> None: ...
|
||||
def process_request(self, request: HttpRequest) -> None: ...
|
||||
def process_response(
|
||||
self, request: WSGIRequest, response: HttpResponseBase
|
||||
) -> HttpResponseBase: ...
|
||||
|
||||
@@ -1,6 +1,22 @@
|
||||
from django.contrib.sessions.backends.db import SessionStore
|
||||
from typing import Type
|
||||
from typing import Any, Optional, Type
|
||||
|
||||
class Session:
|
||||
from django.contrib.sessions.backends.db import SessionStore
|
||||
from django.contrib.sessions.base_session import (AbstractBaseSession,
|
||||
BaseSessionManager)
|
||||
|
||||
|
||||
class SessionManager(BaseSessionManager):
|
||||
creation_counter: int
|
||||
model: None
|
||||
name: None
|
||||
use_in_migrations: bool = ...
|
||||
|
||||
class Session(AbstractBaseSession):
|
||||
expire_date: datetime.datetime
|
||||
session_data: str
|
||||
session_key: str
|
||||
objects: Any = ...
|
||||
@classmethod
|
||||
def get_session_store_class(cls) -> Type[SessionStore]: ...
|
||||
class Meta(AbstractBaseSession.Meta):
|
||||
db_table: str = ...
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
# Stubs for django.contrib.sessions.serializers (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
from django.core.signing import JSONSerializer as BaseJSONSerializer
|
||||
from typing import Any
|
||||
|
||||
from datetime import datetime
|
||||
from django.db.models.base import Model
|
||||
from typing import Dict, Union
|
||||
|
||||
|
||||
class PickleSerializer:
|
||||
def dumps(self, obj: Dict[str, Union[str, datetime]]) -> bytes: ...
|
||||
def loads(self, data: bytes) -> Dict[str, Model]: ...
|
||||
def dumps(self, obj: Dict[str, Union[Model, str, datetime]]) -> bytes: ...
|
||||
def loads(self, data: bytes) -> Dict[str, Union[Model, str, datetime]]: ...
|
||||
|
||||
JSONSerializer = BaseJSONSerializer
|
||||
|
||||
Reference in New Issue
Block a user