Files
mlx/python/mlx/_reprlib_fix.py

17 lines
321 B
Python
Raw Normal View History

2023-11-30 11:12:53 -08:00
# Copyright © 2023 Apple Inc.
2023-11-29 10:30:41 -08:00
import array
import reprlib
2024-09-16 13:21:04 -07:00
_old_repr_array = reprlib.Repr.repr_array
2023-11-29 10:30:41 -08:00
2024-09-16 13:21:04 -07:00
def repr_array(self, x, maxlevel):
if isinstance(x, array.array):
return _old_repr_array(self, x, maxlevel)
else:
return self.repr_instance(x, maxlevel)
2023-11-29 10:30:41 -08:00
2024-09-16 13:21:04 -07:00
reprlib.Repr.repr_array = repr_array