mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
GitHub Action formats our code with psf/black (#1569)
* GitHub Action formats our code with psf/black @poyea Your review please. * fixup! Format Python code with psf/black push
This commit is contained in:
@@ -2,12 +2,13 @@ from abc import abstractmethod
|
||||
import sys
|
||||
from collections import deque
|
||||
|
||||
|
||||
class LRUCache:
|
||||
""" Page Replacement Algorithm, Least Recently Used (LRU) Caching."""
|
||||
|
||||
dq_store = object() # Cache store of keys
|
||||
key_reference_map = object() # References of the keys in cache
|
||||
_MAX_CAPACITY: int = 10 # Maximum capacity of cache
|
||||
dq_store = object() # Cache store of keys
|
||||
key_reference_map = object() # References of the keys in cache
|
||||
_MAX_CAPACITY: int = 10 # Maximum capacity of cache
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self, n: int):
|
||||
@@ -19,7 +20,7 @@ class LRUCache:
|
||||
if not n:
|
||||
LRUCache._MAX_CAPACITY = sys.maxsize
|
||||
elif n < 0:
|
||||
raise ValueError('n should be an integer greater than 0.')
|
||||
raise ValueError("n should be an integer greater than 0.")
|
||||
else:
|
||||
LRUCache._MAX_CAPACITY = n
|
||||
|
||||
@@ -51,6 +52,7 @@ class LRUCache:
|
||||
for k in self.dq_store:
|
||||
print(k)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
lru_cache = LRUCache(4)
|
||||
lru_cache.refer(1)
|
||||
|
||||
Reference in New Issue
Block a user