diff --git a/tensorflow_datasets/core/utils/py_utils.py b/tensorflow_datasets/core/utils/py_utils.py index c659c98c4c1..778056c1492 100644 --- a/tensorflow_datasets/core/utils/py_utils.py +++ b/tensorflow_datasets/core/utils/py_utils.py @@ -354,12 +354,8 @@ def incomplete_files( def is_incomplete_file(path: epath.Path) -> bool: """Returns whether the given filename suggests that it's incomplete.""" - return bool( - re.search( - rf'^{re.escape(constants.INCOMPLETE_PREFIX)}[0-9a-fA-F]{{32}}\..+$', - path.name, - ) - ) + regex = rf'{re.escape(constants.INCOMPLETE_PREFIX)}[0-9a-fA-F]{{32}}\..+' + return bool(re.search(rf'^{regex}$', path.name)) @contextlib.contextmanager diff --git a/tensorflow_datasets/core/utils/py_utils_test.py b/tensorflow_datasets/core/utils/py_utils_test.py index 8333da994f8..efc5aeca586 100644 --- a/tensorflow_datasets/core/utils/py_utils_test.py +++ b/tensorflow_datasets/core/utils/py_utils_test.py @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for py_utils.""" - import collections import pathlib