summaryrefslogtreecommitdiff
path: root/searx/shared/shared_uwsgi.py
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2022-01-24 09:46:32 +0100
committerMartin Fischer <martin@push-f.com>2022-01-27 22:07:12 +0100
commit640c404844e3b06482402c53fdce8a2295772d42 (patch)
tree773c7f309634d29e4260b96f07840cea4fee19b3 /searx/shared/shared_uwsgi.py
parent8aef66b365b5faeb42362e2da7fdf93517136d88 (diff)
[pyright:strict] searx.search.checker.background
Diffstat (limited to 'searx/shared/shared_uwsgi.py')
-rw-r--r--searx/shared/shared_uwsgi.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/searx/shared/shared_uwsgi.py b/searx/shared/shared_uwsgi.py
index 592e24a4b..4a6b0a155 100644
--- a/searx/shared/shared_uwsgi.py
+++ b/searx/shared/shared_uwsgi.py
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
import time
+from typing import Optional
import uwsgi # pylint: disable=E0401
from . import shared_abstract
@@ -9,25 +10,25 @@ _last_signal = 10
class UwsgiCacheSharedDict(shared_abstract.SharedDict):
- def get_int(self, key):
+ def get_int(self, key: str) -> Optional[int]:
value = uwsgi.cache_get(key)
if value is None:
return value
else:
return int.from_bytes(value, 'big')
- def set_int(self, key, value):
+ def set_int(self, key: str, value: int):
b = value.to_bytes(4, 'big')
uwsgi.cache_update(key, b)
- def get_str(self, key):
+ def get_str(self, key: str) -> Optional[str]:
value = uwsgi.cache_get(key)
if value is None:
return value
else:
return value.decode('utf-8')
- def set_str(self, key, value):
+ def set_str(self, key: str, value: str):
b = value.encode('utf-8')
uwsgi.cache_update(key, b)