Fixed #61 : SheerkaDebugManager: Add get_value()
Fixed #60 : Hash error when ReturnValue is a list of list Fixed #59 : Implement smart_get() Fixed #58 : SheerkaPromptCompleter: Cannot parse concept token Fixed #57 : SheerkaPrompt: Add concept autocompletion Fixed #56 : automatically backup command Fixed #54 : I can record execution status Fixed #53 : ConceptManager: modify_concept fails
This commit is contained in:
@@ -777,6 +777,14 @@ def escape_str(x):
|
||||
return x
|
||||
|
||||
|
||||
def new_array(size):
|
||||
res = []
|
||||
for _ in range(size):
|
||||
res.append(0)
|
||||
|
||||
return res
|
||||
|
||||
|
||||
class NextIdManager:
|
||||
"""
|
||||
solely return the next integer
|
||||
@@ -788,3 +796,16 @@ class NextIdManager:
|
||||
def get_next_id(self):
|
||||
self.id += 1
|
||||
return self.id
|
||||
|
||||
|
||||
def compute_hash(obj):
|
||||
if isinstance(obj, list):
|
||||
return hash(tuple([compute_hash(o) for o in obj]))
|
||||
|
||||
if isinstance(obj, set):
|
||||
return hash(tuple([compute_hash(o) for o in sorted(list(obj))]))
|
||||
|
||||
if isinstance(obj, dict):
|
||||
return hash(repr(obj))
|
||||
|
||||
return hash(obj)
|
||||
|
||||
Reference in New Issue
Block a user