File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
tensorflow_datasets/core/data_sources Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 22
22
from typing import Any , Callable
23
23
24
24
25
- @dataclasses .dataclass
25
+ @dataclasses .dataclass ( repr = False )
26
26
class PythonDataSource (MappingView , Sequence ):
27
27
"""Python data source backed by Python objects: length and __getitem__."""
28
28
@@ -41,3 +41,6 @@ def __iter__(self):
41
41
42
42
def __getitem__ (self , i : int ) -> Any :
43
43
return self .getitem (i )
44
+
45
+ def __repr__ (self ) -> str :
46
+ return f'PythonDataSource(length={ self .length } )'
Original file line number Diff line number Diff line change @@ -54,3 +54,8 @@ def test_tree_map_structure():
54
54
tree .map_structure (func , source )
55
55
calls = [mock .call (0 ), mock .call (1 ), mock .call (2 )]
56
56
func .assert_has_calls (calls )
57
+
58
+
59
+ def test_repr ():
60
+ source = python .PythonDataSource (length = 3 , getitem = getitem )
61
+ assert repr (source ) == 'PythonDataSource(length=3)'
You can’t perform that action at this time.
0 commit comments