limits 5.5.0__py3-none-any.whl → 5.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- limits/__init__.py +1 -1
- limits/_version.py +29 -16
- limits/_version.pyi +1 -0
- limits/storage/mongodb.py +29 -29
- {limits-5.5.0.dist-info → limits-5.7.0.dist-info}/METADATA +27 -46
- {limits-5.5.0.dist-info → limits-5.7.0.dist-info}/RECORD +8 -9
- {limits-5.5.0.dist-info → limits-5.7.0.dist-info}/WHEEL +1 -2
- limits/version.py +0 -3
- limits-5.5.0.dist-info/top_level.txt +0 -1
- {limits-5.5.0.dist-info → limits-5.7.0.dist-info}/licenses/LICENSE.txt +0 -0
limits/__init__.py
CHANGED
limits/_version.py
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
1
3
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
TYPE_CHECKING = False
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
from typing import Union
|
|
8
17
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"full-revisionid": "a5d3f81d1ead51586a42b8c843884603cb19bb7f",
|
|
15
|
-
"version": "5.5.0"
|
|
16
|
-
}
|
|
17
|
-
''' # END VERSION_JSON
|
|
18
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
20
|
+
else:
|
|
21
|
+
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
18
23
|
|
|
24
|
+
version: str
|
|
25
|
+
__version__: str
|
|
26
|
+
__version_tuple__: VERSION_TUPLE
|
|
27
|
+
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
19
30
|
|
|
20
|
-
|
|
21
|
-
|
|
31
|
+
__version__ = version = '5.7.0'
|
|
32
|
+
__version_tuple__ = version_tuple = (5, 7, 0)
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = None
|
limits/_version.pyi
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__: str
|
limits/storage/mongodb.py
CHANGED
|
@@ -156,34 +156,34 @@ class MongoDBStorageBase(
|
|
|
156
156
|
seconds=expiry
|
|
157
157
|
)
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
{
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"$
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
"
|
|
173
|
-
"$
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
159
|
+
if response := self.counters.find_one_and_update(
|
|
160
|
+
{"_id": key},
|
|
161
|
+
[
|
|
162
|
+
{
|
|
163
|
+
"$set": {
|
|
164
|
+
"count": {
|
|
165
|
+
"$cond": {
|
|
166
|
+
"if": {"$lt": ["$expireAt", "$$NOW"]},
|
|
167
|
+
"then": amount,
|
|
168
|
+
"else": {"$add": ["$count", amount]},
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"expireAt": {
|
|
172
|
+
"$cond": {
|
|
173
|
+
"if": {"$lt": ["$expireAt", "$$NOW"]},
|
|
174
|
+
"then": expiration,
|
|
175
|
+
"else": "$expireAt",
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
upsert=True,
|
|
182
|
+
projection=["count"],
|
|
183
|
+
return_document=self.lib.ReturnDocument.AFTER,
|
|
184
|
+
):
|
|
185
|
+
return int(response["count"])
|
|
186
|
+
return 0
|
|
187
187
|
|
|
188
188
|
def check(self) -> bool:
|
|
189
189
|
"""
|
|
@@ -468,7 +468,7 @@ class MongoDBStorageBase(
|
|
|
468
468
|
return_document=self.lib.ReturnDocument.AFTER,
|
|
469
469
|
upsert=True,
|
|
470
470
|
)
|
|
471
|
-
return cast(bool, result["_acquired"])
|
|
471
|
+
return cast(bool, result["_acquired"] if result else False)
|
|
472
472
|
|
|
473
473
|
def clear_sliding_window(self, key: str, expiry: int) -> None:
|
|
474
474
|
return self.clear(key)
|
|
@@ -1,69 +1,50 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: limits
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.7.0
|
|
4
4
|
Summary: Rate limiting utilities
|
|
5
|
-
|
|
6
|
-
Author: Ali-Akber Saifee
|
|
7
|
-
Author-email: ali@indydevs.org
|
|
8
|
-
License: MIT
|
|
5
|
+
Project-URL: Homepage, https://limits.readthedocs.org
|
|
9
6
|
Project-URL: Source, https://github.com/alisaifee/limits
|
|
7
|
+
Project-URL: Documentation, https://limits.readthedocs.org
|
|
8
|
+
Author-email: Ali-Akber Saifee <ali@indydevs.org>
|
|
9
|
+
Maintainer-email: Ali-Akber Saifee <ali@indydevs.org>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE.txt
|
|
10
12
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
13
|
Classifier: Intended Audience :: Developers
|
|
12
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
15
|
Classifier: Operating System :: MacOS
|
|
14
|
-
Classifier: Operating System :: POSIX :: Linux
|
|
15
16
|
Classifier: Operating System :: OS Independent
|
|
16
|
-
Classifier:
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
18
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
19
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
21
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
23
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
25
|
Requires-Python: >=3.10
|
|
23
|
-
License-File: LICENSE.txt
|
|
24
26
|
Requires-Dist: deprecated>=1.2
|
|
25
27
|
Requires-Dist: packaging>=21
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Provides-Extra: redis
|
|
28
|
-
Requires-Dist: redis!=4.5.2,!=4.5.3,<7.0.0,>3; extra == "redis"
|
|
29
|
-
Provides-Extra: rediscluster
|
|
30
|
-
Requires-Dist: redis!=4.5.2,!=4.5.3,>=4.2.0; extra == "rediscluster"
|
|
31
|
-
Provides-Extra: memcached
|
|
32
|
-
Requires-Dist: pymemcache<5.0.0,>3; extra == "memcached"
|
|
33
|
-
Provides-Extra: mongodb
|
|
34
|
-
Requires-Dist: pymongo<5,>4.1; extra == "mongodb"
|
|
35
|
-
Provides-Extra: valkey
|
|
36
|
-
Requires-Dist: valkey>=6; extra == "valkey"
|
|
37
|
-
Provides-Extra: async-redis
|
|
38
|
-
Requires-Dist: coredis<6,>=3.4.0; extra == "async-redis"
|
|
28
|
+
Requires-Dist: typing-extensions
|
|
39
29
|
Provides-Extra: async-memcached
|
|
40
|
-
Requires-Dist: memcachio>=0.3; extra ==
|
|
30
|
+
Requires-Dist: memcachio>=0.3; extra == 'async-memcached'
|
|
41
31
|
Provides-Extra: async-mongodb
|
|
42
|
-
Requires-Dist: motor<4,>=3; extra ==
|
|
32
|
+
Requires-Dist: motor<4,>=3; extra == 'async-mongodb'
|
|
33
|
+
Provides-Extra: async-redis
|
|
34
|
+
Requires-Dist: coredis<6,>=3.4.0; extra == 'async-redis'
|
|
43
35
|
Provides-Extra: async-valkey
|
|
44
|
-
Requires-Dist: valkey>=6; extra ==
|
|
45
|
-
Provides-Extra:
|
|
46
|
-
Requires-Dist:
|
|
47
|
-
|
|
48
|
-
Requires-Dist:
|
|
49
|
-
|
|
50
|
-
Requires-Dist:
|
|
51
|
-
|
|
52
|
-
Requires-Dist:
|
|
53
|
-
|
|
54
|
-
Requires-Dist: valkey>=6; extra ==
|
|
55
|
-
|
|
56
|
-
Dynamic: author-email
|
|
57
|
-
Dynamic: classifier
|
|
58
|
-
Dynamic: description
|
|
59
|
-
Dynamic: home-page
|
|
60
|
-
Dynamic: license
|
|
61
|
-
Dynamic: license-file
|
|
62
|
-
Dynamic: project-url
|
|
63
|
-
Dynamic: provides-extra
|
|
64
|
-
Dynamic: requires-dist
|
|
65
|
-
Dynamic: requires-python
|
|
66
|
-
Dynamic: summary
|
|
36
|
+
Requires-Dist: valkey>=6; extra == 'async-valkey'
|
|
37
|
+
Provides-Extra: memcached
|
|
38
|
+
Requires-Dist: pymemcache<5.0.0,>3; extra == 'memcached'
|
|
39
|
+
Provides-Extra: mongodb
|
|
40
|
+
Requires-Dist: pymongo<5,>4.1; extra == 'mongodb'
|
|
41
|
+
Provides-Extra: redis
|
|
42
|
+
Requires-Dist: redis!=4.5.2,!=4.5.3,<8.0.0,>3; extra == 'redis'
|
|
43
|
+
Provides-Extra: rediscluster
|
|
44
|
+
Requires-Dist: redis!=4.5.2,!=4.5.3,>=4.2.0; extra == 'rediscluster'
|
|
45
|
+
Provides-Extra: valkey
|
|
46
|
+
Requires-Dist: valkey>=6; extra == 'valkey'
|
|
47
|
+
Description-Content-Type: text/x-rst
|
|
67
48
|
|
|
68
49
|
.. |ci| image:: https://github.com/alisaifee/limits/actions/workflows/main.yml/badge.svg?branch=master
|
|
69
50
|
:target: https://github.com/alisaifee/limits/actions?query=branch%3Amaster+workflow%3ACI
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
limits/__init__.py,sha256=
|
|
2
|
-
limits/_version.py,sha256=
|
|
1
|
+
limits/__init__.py,sha256=o797RFCrvTx-9XGu8tsQYH5ZOtX-UVh6xwq_eatc_AU,734
|
|
2
|
+
limits/_version.py,sha256=k_RD_hW7ZrSTC0fqTWaif1G2YcUxmgQW3auzaKG5Wdg,704
|
|
3
|
+
limits/_version.pyi,sha256=Y25n44pyE3vp92MiABKrcK3IWRyQ1JG1rZ4Ufqy2nC0,17
|
|
3
4
|
limits/errors.py,sha256=s1el9Vg0ly-z92guvnvYNgKi3_aVqpiw_sufemiLLTI,662
|
|
4
5
|
limits/limits.py,sha256=EztiGCXBVwIqNtps77HiW6vLlMO93wCh7mu5W7BuhwI,5011
|
|
5
6
|
limits/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
7
|
limits/strategies.py,sha256=Q03NTAyADtwMalhRkOSdk6UE1gVfVt5n258xVyA481o,10732
|
|
7
8
|
limits/typing.py,sha256=pVt5D23MhQSUGqi0MBG5FCSqDwta2ygu18BpKvJFxow,3283
|
|
8
9
|
limits/util.py,sha256=283O2aXnN7DmaqjTeTiF-KYn5wVbnpXJ8vb-6LvY5lY,5983
|
|
9
|
-
limits/version.py,sha256=YwkF3dtq1KGzvmL3iVGctA8NNtGlK_0arrzZkZGVjUs,47
|
|
10
10
|
limits/aio/__init__.py,sha256=yxvWb_ZmV245Hg2LqD365WC5IDllcGDMw6udJ1jNp1g,118
|
|
11
11
|
limits/aio/strategies.py,sha256=ip7NJ_6FvEtICr90tesayaXcsqrmpG7VlC3PwxbfiVQ,10736
|
|
12
12
|
limits/aio/storage/__init__.py,sha256=vKeArUnN1ld_0mQOBBZPCjaQgM5xI1GBPM7_F2Ydz5c,646
|
|
@@ -32,13 +32,12 @@ limits/storage/__init__.py,sha256=9iNxIlwzLQw2d54EcMa2LBJ47wiWCPOnHgn6ddqKkDI,26
|
|
|
32
32
|
limits/storage/base.py,sha256=QFVhOS8VdR7PDhaYMSc77SLg8yaGm0PCNNrMu4ZamfY,7264
|
|
33
33
|
limits/storage/memcached.py,sha256=AzT3vz-MnkFxS0mF3C0QjGPzCnmUt29qTnuOKhKVKYI,10455
|
|
34
34
|
limits/storage/memory.py,sha256=4W8hWIEzwQpoh1z0LcfwuP6DqeFoVuOEM2u8WpZkfdQ,8957
|
|
35
|
-
limits/storage/mongodb.py,sha256=
|
|
35
|
+
limits/storage/mongodb.py,sha256=a-KX1H-0DafEwWzwTmcqJ9YuMyAwg1R-JfkTEiBJ0pQ,18123
|
|
36
36
|
limits/storage/redis.py,sha256=zTwxV5qosxGBTrkZmD4UWQdvavDbWpYHXY7H3hXH-Sw,10791
|
|
37
37
|
limits/storage/redis_cluster.py,sha256=GkL8GCQFfxDriMzsPMkaj6pMEX5FvQXYpUtXLY5q8fQ,4621
|
|
38
38
|
limits/storage/redis_sentinel.py,sha256=OSb61DxgUxMgXSIjaM_pF5-entD8XntD56xt0rFu89k,4479
|
|
39
39
|
limits/storage/registry.py,sha256=CxSaDBGR5aBJPFAIsfX9axCnbcThN3Bu-EH4wHrXtu8,650
|
|
40
|
-
limits-5.
|
|
41
|
-
limits-5.
|
|
42
|
-
limits-5.
|
|
43
|
-
limits-5.
|
|
44
|
-
limits-5.5.0.dist-info/RECORD,,
|
|
40
|
+
limits-5.7.0.dist-info/METADATA,sha256=UxFo4RjIABUC1vbmniJlq8wc3xX1PIMot3rVbgYm6h0,10408
|
|
41
|
+
limits-5.7.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
42
|
+
limits-5.7.0.dist-info/licenses/LICENSE.txt,sha256=T6i7kq7F5gIPfcno9FCxU5Hcwm22Bjq0uHZV3ElcjsQ,1061
|
|
43
|
+
limits-5.7.0.dist-info/RECORD,,
|
limits/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
limits
|
|
File without changes
|