diff options
author | Alexandre Flament <alex@al-f.net> | 2022-01-27 23:18:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-27 23:18:41 +0100 |
commit | 4f82ab36a90db39d21201c11df3f4a437188e8d0 (patch) | |
tree | 3937ca19529bf38f4d5cd551de3ee81e042bd4b3 /searx/shared/shared_uwsgi.py | |
parent | 5fc53b41f8a0c6e1e1dea02f1427100c0a760beb (diff) | |
parent | 506169f312735301c1eb3ca8d10dd715298087b3 (diff) |
Merge pull request #817 from not-my-profile/pyright-01
Pyright 01
Diffstat (limited to 'searx/shared/shared_uwsgi.py')
-rw-r--r-- | searx/shared/shared_uwsgi.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/searx/shared/shared_uwsgi.py b/searx/shared/shared_uwsgi.py index 592e24a4..4a6b0a15 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) |