Skip to content

Commit 9737bd7

Browse files
Nolan MillerThe TensorFlow Datasets Authors
authored andcommitted
Changes isinstance check to match for isinstance of Sequence rather than not isinstance of int. This seems more robust and the previous check was causing issues for numpy.int64 typed keys.
PiperOrigin-RevId: 627850725
1 parent 2083a47 commit 9737bd7

File tree

1 file changed

+1
-1
lines changed
  • tensorflow_datasets/core/data_sources

1 file changed

+1
-1
lines changed

tensorflow_datasets/core/data_sources/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class BaseDataSource(MappingView, Sequence):
7777
data_source: DataSource[Any] = dataclasses.field(init=False)
7878

7979
def __getitem__(self, record_key: int) -> Any:
80-
if not isinstance(record_key, int):
80+
if isinstance(record_key, Sequence):
8181
logging.error(
8282
'Calling DataSource.__getitem__() with sequence '
8383
'of record keys (%s) is deprecated. Either pass a single '

0 commit comments

Comments
 (0)