Skip to content

Commit 50f9c6d

Browse files
committed
Respond to code review
1 parent 4e66956 commit 50f9c6d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Diff for: fsspec/dircache.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22

33
import time
44
from functools import lru_cache
5-
from typing import Any, Iterator, List, MutableMapping, TypedDict
5+
from typing import Any, Iterator, MutableMapping, TypedDict, TypeAlias, TYPE_CHECKING
66

7+
if TYPE_CHECKING:
8+
# TODO: consider a more-precise type using TypedDict
9+
DirEntry: TypeAlias = dict[str, Any]
710

8-
class DirEntry(TypedDict):
9-
name: str
10-
size: int
11-
type: str
1211

13-
14-
class DirCache(MutableMapping[str, List[DirEntry]]):
12+
class DirCache(MutableMapping[str, list[DirEntry]]):
1513
"""
1614
Caching of directory listings, in a structure like::
1715
@@ -91,7 +89,7 @@ def __setitem__(self, key: str, value: List[DirEntry]) -> None:
9189
if self.listings_expiry_time is not None:
9290
self._times[key] = time.time()
9391

94-
def __delitem__(self, key) -> None:
92+
def __delitem__(self, key: str) -> None:
9593
del self._cache[key]
9694

9795
def __iter__(self) -> Iterator[str]:

0 commit comments

Comments
 (0)