Skip to content

Commit 1a94f63

Browse files
add type error fixing methods to hashmap
1 parent 92795fe commit 1a94f63

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pythonbpf/maps.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@ def lookup(self, key):
1010
return self.entries[key]
1111
else:
1212
return None
13-
14-
# add other supported map functions here
13+
14+
def delete(self, key):
15+
if key in self.entries:
16+
del self.entries[key]
17+
else:
18+
raise KeyError(f"Key {key} not found in map")
19+
20+
def update(self, key, value):
21+
if key in self.entries:
22+
self.entries[key] = value
23+
else:
24+
raise KeyError(f"Key {key} not found in map")

0 commit comments

Comments
 (0)