Skip to content

Commit 3d65665

Browse files
authored
Merge pull request #11367 from pymedusa/release/release-1.0.17
Release/release 1.0.17
2 parents e98773f + 8039506 commit 3d65665

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+4003
-3817
lines changed

.github/workflows/node-frontend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
node-version: [14.x]
10+
node-version: [16.x]
1111

1212
steps:
1313
- uses: actions/checkout@v2

.gitignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,18 @@ pymedusa.egg-info
8686
.cache
8787
htmlcov
8888
xo-errors.log
89-
yarn-error.log
9089

9190
# Contrib #
9291
######################
9392
/contrib/
93+
94+
# Yarn #
95+
######################
96+
.pnp.*
97+
.yarn/*
98+
!.yarn/patches
99+
!.yarn/plugins
100+
!.yarn/releases
101+
!.yarn/sdks
102+
!.yarn/versions
103+
yarn-error.log

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## 1.0.17 (29-06-2023)
2+
3+
#### New Features
4+
- Add TheOldSchool torrent provider (Thanks to @IamMika23)
5+
6+
#### Improvements
7+
- Update IPTorrents default domain
8+
- Update many dependencies
9+
10+
#### Fixes
11+
- Fix saving order of various tables
12+
13+
-----
14+
115
## 1.0.16 (27-05-2023)
216

317
#### Improvements

ext/cachecontrol/__init__.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,21 @@
88
"""
99
__author__ = "Eric Larson"
1010
__email__ = "[email protected]"
11-
__version__ = "0.12.11"
11+
__version__ = "0.13.1"
1212

13-
from .wrapper import CacheControl
14-
from .adapter import CacheControlAdapter
15-
from .controller import CacheController
13+
from cachecontrol.adapter import CacheControlAdapter
14+
from cachecontrol.controller import CacheController
15+
from cachecontrol.wrapper import CacheControl
16+
17+
__all__ = [
18+
"__author__",
19+
"__email__",
20+
"__version__",
21+
"CacheControlAdapter",
22+
"CacheController",
23+
"CacheControl",
24+
]
1625

1726
import logging
27+
1828
logging.getLogger(__name__).addHandler(logging.NullHandler())

ext/cachecontrol/_cmd.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,49 @@
11
# SPDX-FileCopyrightText: 2015 Eric Larson
22
#
33
# SPDX-License-Identifier: Apache-2.0
4+
from __future__ import annotations
45

56
import logging
7+
from argparse import ArgumentParser
8+
from typing import TYPE_CHECKING
69

710
import requests
811

912
from cachecontrol.adapter import CacheControlAdapter
1013
from cachecontrol.cache import DictCache
1114
from cachecontrol.controller import logger
1215

13-
from argparse import ArgumentParser
16+
if TYPE_CHECKING:
17+
from argparse import Namespace
1418

19+
from cachecontrol.controller import CacheController
1520

16-
def setup_logging():
21+
22+
def setup_logging() -> None:
1723
logger.setLevel(logging.DEBUG)
1824
handler = logging.StreamHandler()
1925
logger.addHandler(handler)
2026

2127

22-
def get_session():
28+
def get_session() -> requests.Session:
2329
adapter = CacheControlAdapter(
2430
DictCache(), cache_etags=True, serializer=None, heuristic=None
2531
)
2632
sess = requests.Session()
2733
sess.mount("http://", adapter)
2834
sess.mount("https://", adapter)
2935

30-
sess.cache_controller = adapter.controller
36+
sess.cache_controller = adapter.controller # type: ignore[attr-defined]
3137
return sess
3238

3339

34-
def get_args():
40+
def get_args() -> Namespace:
3541
parser = ArgumentParser()
3642
parser.add_argument("url", help="The URL to try and cache")
3743
return parser.parse_args()
3844

3945

40-
def main(args=None):
46+
def main() -> None:
4147
args = get_args()
4248
sess = get_session()
4349

@@ -48,10 +54,13 @@ def main(args=None):
4854
setup_logging()
4955

5056
# try setting the cache
51-
sess.cache_controller.cache_response(resp.request, resp.raw)
57+
cache_controller: CacheController = (
58+
sess.cache_controller # type: ignore[attr-defined]
59+
)
60+
cache_controller.cache_response(resp.request, resp.raw)
5261

5362
# Now try to get it
54-
if sess.cache_controller.cached_request(resp.request):
63+
if cache_controller.cached_request(resp.request):
5564
print("Cached!")
5665
else:
5766
print("Not cached :(")

ext/cachecontrol/adapter.py

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,43 @@
11
# SPDX-FileCopyrightText: 2015 Eric Larson
22
#
33
# SPDX-License-Identifier: Apache-2.0
4+
from __future__ import annotations
45

5-
import types
66
import functools
7+
import types
78
import zlib
9+
from typing import TYPE_CHECKING, Any, Collection, Mapping
810

911
from requests.adapters import HTTPAdapter
1012

11-
from .controller import CacheController, PERMANENT_REDIRECT_STATUSES
12-
from .cache import DictCache
13-
from .filewrapper import CallbackFileWrapper
13+
from cachecontrol.cache import DictCache
14+
from cachecontrol.controller import PERMANENT_REDIRECT_STATUSES, CacheController
15+
from cachecontrol.filewrapper import CallbackFileWrapper
16+
17+
if TYPE_CHECKING:
18+
from requests import PreparedRequest, Response
19+
from urllib3 import HTTPResponse
20+
21+
from cachecontrol.cache import BaseCache
22+
from cachecontrol.heuristics import BaseHeuristic
23+
from cachecontrol.serialize import Serializer
1424

1525

1626
class CacheControlAdapter(HTTPAdapter):
1727
invalidating_methods = {"PUT", "PATCH", "DELETE"}
1828

1929
def __init__(
2030
self,
21-
cache=None,
22-
cache_etags=True,
23-
controller_class=None,
24-
serializer=None,
25-
heuristic=None,
26-
cacheable_methods=None,
27-
*args,
28-
**kw
29-
):
30-
super(CacheControlAdapter, self).__init__(*args, **kw)
31+
cache: BaseCache | None = None,
32+
cache_etags: bool = True,
33+
controller_class: type[CacheController] | None = None,
34+
serializer: Serializer | None = None,
35+
heuristic: BaseHeuristic | None = None,
36+
cacheable_methods: Collection[str] | None = None,
37+
*args: Any,
38+
**kw: Any,
39+
) -> None:
40+
super().__init__(*args, **kw)
3141
self.cache = DictCache() if cache is None else cache
3242
self.heuristic = heuristic
3343
self.cacheable_methods = cacheable_methods or ("GET",)
@@ -37,7 +47,16 @@ def __init__(
3747
self.cache, cache_etags=cache_etags, serializer=serializer
3848
)
3949

40-
def send(self, request, cacheable_methods=None, **kw):
50+
def send(
51+
self,
52+
request: PreparedRequest,
53+
stream: bool = False,
54+
timeout: None | float | tuple[float, float] | tuple[float, None] = None,
55+
verify: bool | str = True,
56+
cert: (None | bytes | str | tuple[bytes | str, bytes | str]) = None,
57+
proxies: Mapping[str, str] | None = None,
58+
cacheable_methods: Collection[str] | None = None,
59+
) -> Response:
4160
"""
4261
Send a request. Use the request information to see if it
4362
exists in the cache and cache the response if we need to and can.
@@ -54,13 +73,17 @@ def send(self, request, cacheable_methods=None, **kw):
5473
# check for etags and add headers if appropriate
5574
request.headers.update(self.controller.conditional_headers(request))
5675

57-
resp = super(CacheControlAdapter, self).send(request, **kw)
76+
resp = super().send(request, stream, timeout, verify, cert, proxies)
5877

5978
return resp
6079

6180
def build_response(
62-
self, request, response, from_cache=False, cacheable_methods=None
63-
):
81+
self,
82+
request: PreparedRequest,
83+
response: HTTPResponse,
84+
from_cache: bool = False,
85+
cacheable_methods: Collection[str] | None = None,
86+
) -> Response:
6487
"""
6588
Build a response by making a request or using the cache.
6689
@@ -102,36 +125,37 @@ def build_response(
102125
else:
103126
# Wrap the response file with a wrapper that will cache the
104127
# response when the stream has been consumed.
105-
response._fp = CallbackFileWrapper(
106-
response._fp,
128+
response._fp = CallbackFileWrapper( # type: ignore[attr-defined]
129+
response._fp, # type: ignore[attr-defined]
107130
functools.partial(
108131
self.controller.cache_response, request, response
109132
),
110133
)
111134
if response.chunked:
112-
super_update_chunk_length = response._update_chunk_length
135+
super_update_chunk_length = response._update_chunk_length # type: ignore[attr-defined]
113136

114-
def _update_chunk_length(self):
137+
def _update_chunk_length(self: HTTPResponse) -> None:
115138
super_update_chunk_length()
116139
if self.chunk_left == 0:
117-
self._fp._close()
140+
self._fp._close() # type: ignore[attr-defined]
118141

119-
response._update_chunk_length = types.MethodType(
142+
response._update_chunk_length = types.MethodType( # type: ignore[attr-defined]
120143
_update_chunk_length, response
121144
)
122145

123-
resp = super(CacheControlAdapter, self).build_response(request, response)
146+
resp: Response = super().build_response(request, response) # type: ignore[no-untyped-call]
124147

125148
# See if we should invalidate the cache.
126149
if request.method in self.invalidating_methods and resp.ok:
150+
assert request.url is not None
127151
cache_url = self.controller.cache_url(request.url)
128152
self.cache.delete(cache_url)
129153

130154
# Give the request a from_cache attr to let people use it
131-
resp.from_cache = from_cache
155+
resp.from_cache = from_cache # type: ignore[attr-defined]
132156

133157
return resp
134158

135-
def close(self):
159+
def close(self) -> None:
136160
self.cache.close()
137-
super(CacheControlAdapter, self).close()
161+
super().close() # type: ignore[no-untyped-call]

ext/cachecontrol/cache.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,46 @@
66
The cache object API for implementing caches. The default is a thread
77
safe in-memory dictionary.
88
"""
9+
from __future__ import annotations
10+
911
from threading import Lock
12+
from typing import IO, TYPE_CHECKING, MutableMapping
1013

14+
if TYPE_CHECKING:
15+
from datetime import datetime
1116

12-
class BaseCache(object):
1317

14-
def get(self, key):
18+
class BaseCache:
19+
def get(self, key: str) -> bytes | None:
1520
raise NotImplementedError()
1621

17-
def set(self, key, value, expires=None):
22+
def set(
23+
self, key: str, value: bytes, expires: int | datetime | None = None
24+
) -> None:
1825
raise NotImplementedError()
1926

20-
def delete(self, key):
27+
def delete(self, key: str) -> None:
2128
raise NotImplementedError()
2229

23-
def close(self):
30+
def close(self) -> None:
2431
pass
2532

2633

2734
class DictCache(BaseCache):
28-
29-
def __init__(self, init_dict=None):
35+
def __init__(self, init_dict: MutableMapping[str, bytes] | None = None) -> None:
3036
self.lock = Lock()
3137
self.data = init_dict or {}
3238

33-
def get(self, key):
39+
def get(self, key: str) -> bytes | None:
3440
return self.data.get(key, None)
3541

36-
def set(self, key, value, expires=None):
42+
def set(
43+
self, key: str, value: bytes, expires: int | datetime | None = None
44+
) -> None:
3745
with self.lock:
3846
self.data.update({key: value})
3947

40-
def delete(self, key):
48+
def delete(self, key: str) -> None:
4149
with self.lock:
4250
if key in self.data:
4351
self.data.pop(key)
@@ -55,10 +63,11 @@ class SeparateBodyBaseCache(BaseCache):
5563
5664
Similarly, the body should be loaded separately via ``get_body()``.
5765
"""
58-
def set_body(self, key, body):
66+
67+
def set_body(self, key: str, body: bytes) -> None:
5968
raise NotImplementedError()
6069

61-
def get_body(self, key):
70+
def get_body(self, key: str) -> IO[bytes] | None:
6271
"""
6372
Return the body as file-like object.
6473
"""

ext/cachecontrol/caches/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
from .file_cache import FileCache, SeparateBodyFileCache
6-
from .redis_cache import RedisCache
7-
5+
from cachecontrol.caches.file_cache import FileCache, SeparateBodyFileCache
6+
from cachecontrol.caches.redis_cache import RedisCache
87

98
__all__ = ["FileCache", "SeparateBodyFileCache", "RedisCache"]

0 commit comments

Comments
 (0)