From 3e2ba4763fccd52bd7570e9cdeb1c0c40ef1d65b Mon Sep 17 00:00:00 2001 From: Tom Solberg Date: Fri, 2 Jun 2023 21:43:26 +0200 Subject: [PATCH] fix return type --- src/pdm/models/caches.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pdm/models/caches.py b/src/pdm/models/caches.py index 27d04cfc11..b763aa998e 100644 --- a/src/pdm/models/caches.py +++ b/src/pdm/models/caches.py @@ -3,7 +3,6 @@ import contextlib import dataclasses import hashlib -import io import json import os from functools import lru_cache @@ -273,10 +272,12 @@ def get(self, key: str) -> bytes | None: return None - def get_body(self, key) -> io.FileIO | None: + def get_body(self, key: str) -> BinaryIO | None: path = self._get_cache_path(key) with contextlib.suppress(OSError): - return open(f"{path}.body", "rb") + return cast(BinaryIO, open(f"{path}.body", "rb")) + + return None def set(self, key: str, value: bytes, expires: int | None = None) -> None: path = self._get_cache_path(key)