forked from p15670423/monkey
small fixes
This commit is contained in:
parent
7a7729c212
commit
0d4e28b55b
|
@ -48,7 +48,7 @@ def cache(foo):
|
||||||
if type(o) in (int, float, str, unicode):
|
if type(o) in (int, float, str, unicode):
|
||||||
return o
|
return o
|
||||||
|
|
||||||
elif type(o) in (list, tuple):
|
elif type(o) in (list, tuple, set):
|
||||||
hashed = tuple([hash(x) for x in o])
|
hashed = tuple([hash(x) for x in o])
|
||||||
|
|
||||||
if "NotHashable" in hashed:
|
if "NotHashable" in hashed:
|
||||||
|
@ -75,13 +75,13 @@ def cache(foo):
|
||||||
return "PassTheHashMapSingleton"
|
return "PassTheHashMapSingleton"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
assert False, "%s of type %s is not hashable" % (repr(o), type(o))
|
||||||
return "NotHashable"
|
return "NotHashable"
|
||||||
|
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
hashed = (hash(args), hash(kwargs))
|
hashed = (hash(args), hash(kwargs))
|
||||||
|
|
||||||
if "NotHashable" in hashed:
|
if "NotHashable" in hashed:
|
||||||
print foo
|
|
||||||
return foo(*args, **kwargs)
|
return foo(*args, **kwargs)
|
||||||
|
|
||||||
if not hasattr(foo, "_mycache_"):
|
if not hasattr(foo, "_mycache_"):
|
||||||
|
@ -818,10 +818,10 @@ class PassTheHashMap(object):
|
||||||
|
|
||||||
return machines
|
return machines
|
||||||
|
|
||||||
def GetThreateningUsersByVictim(victim):
|
def GetThreateningUsersByVictim(self, victim):
|
||||||
threatening_users = set()
|
threatening_users = set()
|
||||||
|
|
||||||
for attacker in pth.GetAttackersByVictim(victim):
|
for attacker in self.GetAttackersByVictim(victim):
|
||||||
threatening_users |= (attacker.GetCachedSids() & victim.GetAdmins())
|
threatening_users |= (attacker.GetCachedSids() & victim.GetAdmins())
|
||||||
|
|
||||||
return threatening_users
|
return threatening_users
|
||||||
|
|
Loading…
Reference in New Issue