Skip to content

Commit

Permalink
Respond to code review
Browse files Browse the repository at this point in the history
  • Loading branch information
alanhdu committed Nov 10, 2023
1 parent 4e66956 commit 50f9c6d
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions fsspec/dircache.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

import time
from functools import lru_cache
from typing import Any, Iterator, List, MutableMapping, TypedDict
from typing import Any, Iterator, MutableMapping, TypedDict, TypeAlias, TYPE_CHECKING

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

class DirEntry(TypedDict):
name: str
size: int
type: str


class DirCache(MutableMapping[str, List[DirEntry]]):
class DirCache(MutableMapping[str, list[DirEntry]]):
"""
Caching of directory listings, in a structure like::
Expand Down Expand Up @@ -91,7 +89,7 @@ def __setitem__(self, key: str, value: List[DirEntry]) -> None:
if self.listings_expiry_time is not None:
self._times[key] = time.time()

def __delitem__(self, key) -> None:
def __delitem__(self, key: str) -> None:
del self._cache[key]

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

0 comments on commit 50f9c6d

Please sign in to comment.