Skip to content
Snippets Groups Projects

first iteration of __isub__ method in RankingStat

Merged Leo Tsukada requested to merge offline_new-workflow-rankingstat-isub into offline_new-workflow
All threads resolved!
Files
2
@@ -254,6 +254,14 @@ class NearestLeafTree(object):
self[x] = val
return self
def __isub__(self, other):
for key, val in other.items():
if key in self:
del self[key]
else:
raise KeyError("NearestLeafTree object does not have an entry to subtract")
return self
def keys(self):
return [x for x, val in self.tree]
@@ -442,6 +450,14 @@ class HorizonHistories(dict):
self[key] = copy.deepcopy(history)
return self
def __isub__(self, other):
for key, history in other.items():
if key in self:
self[key] -= history
else:
raise KeyError("HorizonHistory object does not have a history key-ed by %s." % key)
return self
def minkey(self):
"""
Return the minimum key stored in the trees.
Loading