MCPcopy Create free account
hub / github.com/Jack-Lee-Hiter/AlgorithmsByPython / get

Method get

Hash.py:62–77  ·  view source on GitHub ↗
(self, key)

Source from the content-addressed store, hash-verified

60 return (oldhash+1)%size
61
62 def get(self, key):
63 startslot = self.hashfunction(key, len(self.slots))
64
65 data = None
66 stop = False
67 found = False
68 position = startslot
69 while self.slots[position] != None and not found and not stop:
70 if self.slots[position] == key:
71 found = True
72 data = self.data[position]
73 else:
74 position = self.rehash(position, len(self.slots))
75 if position == startslot:
76 stop = True
77 return data
78
79 def __getitem__(self, key):
80 return self.get(key)

Callers 3

__getitem__Method · 0.95
getdataFunction · 0.45
re练习.pyFile · 0.45

Calls 2

hashfunctionMethod · 0.95
rehashMethod · 0.95

Tested by

no test coverage detected