mirror of
https://github.com/3b1b/manim.git
synced 2025-07-28 04:23:16 +08:00
Refactor LabelledString and relevant classes
This commit is contained in:
@ -135,10 +135,14 @@ def make_even(
|
||||
|
||||
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()))))
|
||||
return hash(tuple(sorted([
|
||||
(hash_obj(k), hash_obj(v)) for k, v in obj.items()
|
||||
])))
|
||||
|
||||
if isinstance(obj, (set, tuple, list)):
|
||||
if isinstance(obj, set):
|
||||
return hash(tuple(sorted(hash_obj(e) for e in obj)))
|
||||
|
||||
if isinstance(obj, (tuple, list)):
|
||||
return hash(tuple(hash_obj(e) for e in obj))
|
||||
|
||||
if isinstance(obj, Color):
|
||||
|
Reference in New Issue
Block a user