Fix dict KeyError (#152)
This commit is contained in:
parent
fb6624215a
commit
e50e2007f6
@ -84,7 +84,7 @@
|
|||||||
" \n",
|
" \n",
|
||||||
" Accessing a node updates its position to the front of the LRU list.\n",
|
" Accessing a node updates its position to the front of the LRU list.\n",
|
||||||
" \"\"\"\n",
|
" \"\"\"\n",
|
||||||
" node = self.lookup[query]\n",
|
" node = self.lookup.get(query)\n",
|
||||||
" if node is None:\n",
|
" if node is None:\n",
|
||||||
" return None\n",
|
" return None\n",
|
||||||
" self.linked_list.move_to_front(node)\n",
|
" self.linked_list.move_to_front(node)\n",
|
||||||
@ -97,7 +97,7 @@
|
|||||||
" If the entry is new and the cache is at capacity, removes the oldest entry\n",
|
" If the entry is new and the cache is at capacity, removes the oldest entry\n",
|
||||||
" before the new entry is added.\n",
|
" before the new entry is added.\n",
|
||||||
" \"\"\"\n",
|
" \"\"\"\n",
|
||||||
" node = self.lookup[query]\n",
|
" node = self.lookup.get(query)\n",
|
||||||
" if node is not None:\n",
|
" if node is not None:\n",
|
||||||
" # Key exists in cache, update the value\n",
|
" # Key exists in cache, update the value\n",
|
||||||
" node.results = results\n",
|
" node.results = results\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user