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 2222from typing import Any , Callable
2323
2424
25- @dataclasses .dataclass
25+ @dataclasses .dataclass ( repr = False )
2626class PythonDataSource (MappingView , Sequence ):
2727 """Python data source backed by Python objects: length and __getitem__."""
2828
@@ -41,3 +41,6 @@ def __iter__(self):
4141
4242 def __getitem__ (self , i : int ) -> Any :
4343 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():
5454 tree .map_structure (func , source )
5555 calls = [mock .call (0 ), mock .call (1 ), mock .call (2 )]
5656 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