mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Finish slumber annotations (#9237)
This commit is contained in:
@@ -64,7 +64,6 @@
|
||||
"stubs/redis",
|
||||
"stubs/requests",
|
||||
"stubs/setuptools",
|
||||
"stubs/slumber",
|
||||
"stubs/SQLAlchemy",
|
||||
"stubs/stripe",
|
||||
"stubs/tqdm",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
version = "0.7.*"
|
||||
requires = ["types-requests"]
|
||||
|
||||
[tool.stubtest]
|
||||
ignore_missing_stub = false
|
||||
|
||||
@@ -1,30 +1,39 @@
|
||||
from _typeshed import Self
|
||||
from typing import Any
|
||||
|
||||
from requests import Response, Session
|
||||
from requests.sessions import _Auth, _Data, _Files
|
||||
|
||||
from .serialize import Serializer
|
||||
|
||||
__all__ = ["Resource", "API"]
|
||||
|
||||
class ResourceAttributesMixin:
|
||||
def __getattr__(self, item): ...
|
||||
# Exists at runtime:
|
||||
def __getattr__(self, item: str) -> Any: ...
|
||||
|
||||
class Resource(ResourceAttributesMixin):
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def __call__(self, id: Any | None = ..., format: Any | None = ..., url_override: Any | None = ...): ...
|
||||
def as_raw(self): ...
|
||||
def get(self, **kwargs): ...
|
||||
def options(self, **kwargs): ...
|
||||
def head(self, **kwargs): ...
|
||||
def post(self, data: Any | None = ..., files: Any | None = ..., **kwargs): ...
|
||||
def patch(self, data: Any | None = ..., files: Any | None = ..., **kwargs): ...
|
||||
def put(self, data: Any | None = ..., files: Any | None = ..., **kwargs): ...
|
||||
def delete(self, **kwargs): ...
|
||||
def url(self): ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def __call__(self: Self, id: str | None = ..., format: str | None = ..., url_override: str | None = ...) -> Self: ...
|
||||
def as_raw(self: Self) -> Self: ...
|
||||
def get(self, **kwargs: Any) -> Response: ...
|
||||
def options(self, **kwargs: Any) -> Response: ...
|
||||
def head(self, **kwargs: Any) -> Response: ...
|
||||
def post(self, data: _Data | None = ..., files: _Files | None = ..., **kwargs: Any) -> Response: ...
|
||||
def patch(self, data: _Data | None = ..., files: _Files | None = ..., **kwargs: Any) -> Response: ...
|
||||
def put(self, data: _Data | None = ..., files: _Files | None = ..., **kwargs: Any) -> Response: ...
|
||||
def delete(self, **kwargs: Any) -> Response: ...
|
||||
def url(self) -> str: ...
|
||||
|
||||
class API(ResourceAttributesMixin):
|
||||
resource_class: Any
|
||||
resource_class: type[Resource]
|
||||
def __init__(
|
||||
self,
|
||||
base_url: Any | None = ...,
|
||||
auth: Any | None = ...,
|
||||
format: Any | None = ...,
|
||||
base_url: str | None = ...,
|
||||
auth: _Auth | None = ...,
|
||||
format: str | None = ...,
|
||||
append_slash: bool = ...,
|
||||
session: Any | None = ...,
|
||||
serializer: Any | None = ...,
|
||||
session: Session | None = ...,
|
||||
serializer: Serializer | None = ...,
|
||||
raw: bool = ...,
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from typing import Any
|
||||
|
||||
class SlumberBaseException(Exception): ...
|
||||
|
||||
class SlumberHttpBaseException(SlumberBaseException):
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
class HttpClientError(SlumberHttpBaseException): ...
|
||||
class HttpNotFoundError(HttpClientError): ...
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_Data: TypeAlias = str | bytes | bytearray
|
||||
|
||||
class BaseSerializer:
|
||||
content_types: Any
|
||||
key: Any
|
||||
def get_content_type(self): ...
|
||||
def loads(self, data) -> None: ...
|
||||
def dumps(self, data) -> None: ...
|
||||
content_types: list[str] | None
|
||||
key: str | None
|
||||
def get_content_type(self) -> str: ...
|
||||
def loads(self, data: _Data) -> Any: ...
|
||||
def dumps(self, data: _Data) -> Any: ...
|
||||
|
||||
class JsonSerializer(BaseSerializer):
|
||||
content_types: Any
|
||||
content_types: list[str]
|
||||
key: str
|
||||
def loads(self, data): ...
|
||||
def dumps(self, data): ...
|
||||
|
||||
class YamlSerializer(BaseSerializer):
|
||||
content_types: Any
|
||||
content_types: list[str]
|
||||
key: str
|
||||
def loads(self, data): ...
|
||||
def dumps(self, data): ...
|
||||
|
||||
class Serializer:
|
||||
serializers: Any
|
||||
default: Any
|
||||
def __init__(self, default: Any | None = ..., serializers: Any | None = ...) -> None: ...
|
||||
def get_serializer(self, name: Any | None = ..., content_type: Any | None = ...): ...
|
||||
def loads(self, data, format: Any | None = ...): ...
|
||||
def dumps(self, data, format: Any | None = ...): ...
|
||||
def get_content_type(self, format: Any | None = ...): ...
|
||||
serializers: list[BaseSerializer]
|
||||
default: str
|
||||
def __init__(self, default: str | None = ..., serializers: list[BaseSerializer] | None = ...) -> None: ...
|
||||
def get_serializer(self, name: str | None = ..., content_type: str | None = ...) -> BaseSerializer: ...
|
||||
def loads(self, data: _Data, format: str | None = ...) -> Any: ...
|
||||
def dumps(self, data: _Data, format: str | None = ...) -> Any: ...
|
||||
def get_content_type(self, format: str | None = ...) -> str: ...
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
def url_join(base, *args): ...
|
||||
def copy_kwargs(dictionary): ...
|
||||
def iterator(d): ...
|
||||
from collections.abc import ItemsView, Mapping, MutableMapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
_VT_co = TypeVar("_VT_co", covariant=True)
|
||||
_MM = TypeVar("_MM", bound=MutableMapping[Any, Any])
|
||||
|
||||
def url_join(base: str, *args: str) -> str: ...
|
||||
def copy_kwargs(dictionary: _MM) -> _MM: ...
|
||||
def iterator(d: Mapping[_KT, _VT_co]) -> ItemsView[_KT, _VT_co]: ...
|
||||
|
||||
Reference in New Issue
Block a user