diff options
| author | Jordan Cook <jordan.cook.git@proton.me> | 2022-12-11 22:28:55 -0600 |
|---|---|---|
| committer | Jordan Cook <jordan.cook.git@proton.me> | 2022-12-13 16:27:49 -0600 |
| commit | f7281895698f33b9c41239b5be3a961fd1691b99 (patch) | |
| tree | 233d6439c5f5a9b770a4206aed8fbe26e60d3a94 /requests_cache/backends/sqlite.py | |
| parent | ca26b146592e08ff237cf9b6cccdba56eb2af484 (diff) | |
| download | requests-cache-f7281895698f33b9c41239b5be3a961fd1691b99.tar.gz | |
Update type hints to appease Pylance and stricter mypy settings
Diffstat (limited to 'requests_cache/backends/sqlite.py')
| -rw-r--r-- | requests_cache/backends/sqlite.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/requests_cache/backends/sqlite.py b/requests_cache/backends/sqlite.py index f936a77..7a99a39 100644 --- a/requests_cache/backends/sqlite.py +++ b/requests_cache/backends/sqlite.py @@ -13,7 +13,7 @@ from os.path import getsize, isfile from pathlib import Path from tempfile import gettempdir from time import time -from typing import Collection, Iterator, List, Tuple, Type, Union +from typing import Collection, Iterator, List, Optional, Tuple, Type, Union from platformdirs import user_cache_dir @@ -143,7 +143,7 @@ class SQLiteCache(BaseCache): self, key: str = 'expires', reversed: bool = False, - limit: int = None, + limit: Optional[int] = None, expired: bool = True, ) -> Iterator[CachedResponse]: """Get cached responses, with sorting and other query options. @@ -334,7 +334,11 @@ class SQLiteDict(BaseStorage): return page_count * page_size def sorted( - self, key: str = 'expires', reversed: bool = False, limit: int = None, expired: bool = True + self, + key: str = 'expires', + reversed: bool = False, + limit: Optional[int] = None, + expired: bool = True, ) -> Iterator[CachedResponse]: """Get cache values in sorted order; see :py:meth:`.SQLiteCache.sorted` for usage details""" # Get sort key, direction, and limit @@ -420,9 +424,9 @@ def get_cache_path(db_path: AnyPath, use_cache_dir: bool = False, use_temp: bool def sqlite_template( timeout: float = 5.0, detect_types: int = 0, - isolation_level: str = None, + isolation_level: Optional[str] = None, check_same_thread: bool = True, - factory: Type = None, + factory: Optional[Type] = None, cached_statements: int = 100, uri: bool = False, ): |
