mirror of
https://github.com/3b1b/manim.git
synced 2025-08-02 11:03:03 +08:00
resolve conflict and add type hints for it
This commit is contained in:
@ -155,3 +155,14 @@ def remove_nones(sequence: Iterable) -> list:
|
||||
|
||||
def concatenate_lists(*list_of_lists):
|
||||
return [item for l in list_of_lists for item in l]
|
||||
|
||||
|
||||
def hash_obj(obj: object) -> int:
|
||||
if isinstance(obj, dict):
|
||||
new_obj = {k: hash_obj(v) for k, v in obj.items()}
|
||||
return hash(tuple(frozenset(sorted(new_obj.items()))))
|
||||
|
||||
if isinstance(obj, (set, tuple, list)):
|
||||
return hash(tuple(hash_obj(e) for e in obj))
|
||||
|
||||
return hash(obj)
|
||||
|
Reference in New Issue
Block a user