Skip to content

Commit f5aac0e

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

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
@@ -1,12 +1,15 @@
11
from __future__ import annotations
22

3+
34
class Node:
45
"""A node in the doubly linked list."""
6+
57
def __init__(self, key: int, val: int) -> None:
68
self.key, self.val = key, val
79
self.prev: Node | None = None
810
self.next: Node | None = None
911

12+
1013
class LRUCache:
1114
"""
1215
A Least Recently Used (LRU) Cache data structure.
@@ -26,6 +29,7 @@ class LRUCache:
2629
>>> cache.get(4)
2730
4
2831
"""
32+
2933
def __init__(self, capacity: int) -> None:
3034
if capacity <= 0:
3135
raise ValueError("Capacity must be a positive integer.")
@@ -83,6 +87,8 @@ def put(self, key: int, value: int) -> None:
8387
self._remove(lru)
8488
del self.cache[lru.key]
8589

90+
8691
if __name__ == "__main__":
8792
import doctest
88-
doctest.testmod()
93+
94+
doctest.testmod()

0 commit comments

Comments
 (0)