Skip to content

Commit

Permalink
remove set class
Browse files Browse the repository at this point in the history
  • Loading branch information
noO0ob committed Jun 21, 2024
1 parent 2495582 commit e1c9227
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions lyrebird/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,9 @@ def clear(self):
def raw(self):
return {key.decode(): json.loads(value.decode()) for key, value in self.redis.hgetall(self.uuid).items()}

def __hash__(self):
return hash((self.uuid, self.host, self.port, self.db))

def __len__(self):
return len(self.redis.hkeys(self.uuid))

Expand All @@ -677,8 +680,6 @@ def _hook_value(parent, key, value):
return RedisHookedDict(parent, key, value)
elif isinstance(value, list):
return RedisHookedList(parent, key, value)
elif isinstance(value, set):
return RedisHookedSet(parent, key, value)
else:
return value

Expand Down Expand Up @@ -739,19 +740,3 @@ def append(self, value):

def __deepcopy__(self, memo):
return deepcopy(list(self), memo)

class RedisHookedSet(RedisHook, set):
def __init__(self, parent, key, value):
set.__init__(self, value)
RedisHook.__init__(self, parent, key)

def add(self, value):
set.add(self, _hook_value(self, None, value))
self.parent[self.key] = self

def remove(self, value):
set.remove(self, value)
self.parent[self.key] = self

def __deepcopy__(self, memo):
return deepcopy(set(self), memo)

0 comments on commit e1c9227

Please sign in to comment.