Skip to content

Commit 1da5a15

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent f69ec0e commit 1da5a15

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

data_structures/lru_cache.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@
1111
https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)
1212
"""
1313

14+
1415
class Node:
1516
"""A node in the doubly linked list."""
17+
1618
def __init__(self, key: int, val: int) -> None:
1719
self.key, self.val = key, val
1820
self.prev = self.next = None
1921

22+
2023
class LRUCache:
2124
"""
2225
A Least Recently Used (LRU) Cache data structure.
@@ -36,6 +39,7 @@ class LRUCache:
3639
>>> cache.get(4)
3740
4
3841
"""
42+
3943
def __init__(self, capacity: int) -> None:
4044
if capacity <= 0:
4145
raise ValueError("Capacity must be a positive integer.")
@@ -82,6 +86,8 @@ def put(self, key: int, value: int) -> None:
8286
self._remove(lru)
8387
del self.cache[lru.key]
8488

89+
8590
if __name__ == "__main__":
8691
import doctest
87-
doctest.testmod()
92+
93+
doctest.testmod()

0 commit comments

Comments
 (0)