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

update CacheControl stubs #599

Merged
merged 1 commit into from
Sep 13, 2022
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
4 changes: 2 additions & 2 deletions mypy-stubs/cachecontrol/cache.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class BaseCache:
def get(self, key: str) -> str | None: ...
def set(self, key: str, value: str) -> None: ...
def get(self, key: str) -> bytes | None: ...
def set(self, key: str, value: bytes, expires: int | None = None) -> None: ...
def delete(self, key: str) -> None: ...
def close(self) -> None: ...
12 changes: 6 additions & 6 deletions mypy-stubs/cachecontrol/caches/file_cache.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ class _LockClass:
_lock_class = ContextManager[_LockClass]

class FileCache(BaseCache):
directory: str | PathLike[str]
directory: str
forever: bool
filemode: str
dirmode: str
lock_class: _lock_class
filemode: int
dirmode: int
lock_class: _lock_class | None = None
def __init__(
self,
directory: str | PathLike[str],
Expand All @@ -26,6 +26,6 @@ class FileCache(BaseCache):
) -> None: ...
@staticmethod
def encode(x: str) -> str: ...
def get(self, key: str) -> None | str: ...
def set(self, key: str, value: str) -> None: ...
def get(self, key: str) -> None | bytes: ...
def set(self, key: str, value: bytes, expires: int | None = None) -> None: ...
def delete(self, key: str) -> None: ...
19 changes: 10 additions & 9 deletions mypy-stubs/cachecontrol/controller.pyi
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
from typing import Collection

from _typeshed import Incomplete

logger: Incomplete
URI: Incomplete
from .cache import BaseCache

class CacheController:
cache: Incomplete
cache_etags: Incomplete
cache: BaseCache
cache_etags: bool
serializer: Incomplete
cacheable_status_codes: Incomplete
cacheable_status_codes: Collection[int] | None = None
def __init__(
self,
cache: Incomplete | None = ...,
cache_etags: bool = ...,
serializer: Incomplete | None = ...,
status_codes: Incomplete | None = ...,
cache: BaseCache | None = None,
cache_etags: bool = True,
serializer: Incomplete | None = None,
status_codes: Collection[int] | None = None,
) -> None: ...
19 changes: 12 additions & 7 deletions mypy-stubs/cachecontrol/wrapper.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
from typing import Collection, Type

from _typeshed import Incomplete
from requests import Session

from .cache import BaseCache
from .controller import CacheController

def CacheControl(
sess: Session,
cache: Incomplete | None = ...,
cache_etags: bool = ...,
serializer: Incomplete | None = ...,
heuristic: Incomplete | None = ...,
controller_class: Incomplete | None = ...,
adapter_class: Incomplete | None = ...,
cacheable_methods: Incomplete | None = ...,
cache: BaseCache | None = None,
cache_etags: bool = True,
serializer: Incomplete | None = None,
heuristic: Incomplete | None = None,
controller_class: Type[CacheController] | None = None,
adapter_class: Incomplete | None = None,
cacheable_methods: Collection[str] | None = None,
) -> Session: ...