mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-01 18:18:31 +00:00
More type hints
This commit is contained in:
parent
12fe5ce637
commit
cecb17df03
51 changed files with 1374 additions and 957 deletions
|
@ -16,6 +16,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Radicale. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
import pickle
|
||||
import time
|
||||
|
@ -72,14 +73,10 @@ class CollectionCacheMixin:
|
|||
"item")
|
||||
content = self._item_cache_content(item, cache_hash)
|
||||
self._storage._makedirs_synced(cache_folder)
|
||||
try:
|
||||
# Race: Other processes might have created and locked the
|
||||
# file.
|
||||
with self._atomic_write(os.path.join(cache_folder, href),
|
||||
"wb") as f:
|
||||
pickle.dump(content, f)
|
||||
except PermissionError:
|
||||
pass
|
||||
# Race: Other processes might have created and locked the file.
|
||||
with contextlib.suppress(PermissionError), self._atomic_write(
|
||||
os.path.join(cache_folder, href), "wb") as f:
|
||||
pickle.dump(content, f)
|
||||
return content
|
||||
|
||||
def _load_item_cache(self, href, input_hash):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue