rephrase docstring and remove unused sentinel

This commit is contained in:
Eric Wolf 2023-06-11 13:56:58 +02:00
parent e683c80c75
commit ad3c890167
No known key found for this signature in database
GPG Key ID: 80D2DA428A4A537F
1 changed files with 3 additions and 4 deletions

View File

@ -2,16 +2,15 @@ from collections import OrderedDict
from collections.abc import Callable, ItemsView, Iterator, KeysView, MutableMapping, ValuesView
from typing import TypeVar
sentinel = object()
K = TypeVar("K")
V = TypeVar("V")
class LRUCache(MutableMapping[K, V]):
"""
Mapping which maintains a maximum size by dropping the least recently used value.
Items are passed to dispose before being removed and replacing an item without
removing it first is forbidden.
Mapping which maintains a maximum size by removing the least recently used value.
Items are passed to dispose before being removed and setting an item which is
already in the cache has to be done using the replace method.
"""
_cache: OrderedDict[K, V]