class_docstr: Template to produce filenames for sharded datasets.
  
  Attributes:
    data_dir: the directory that contains the files for the shards.
    template: template of the sharded files, e.g.
      '${SPLIT}/data.${FILEFORMAT}-${SHARD_INDEX}'.
    dataset_name: the name of the dataset.
    split: the split of the dataset.
    filetype_suffix: the filetype suffix to denote the type of file. For
      example, `tfrecord`.
docstr: Parses the filename using this template.
  
  Note that when the filename doesn't specify the dataset name, split, or
  filetype suffix, but this template does, then the value in the template will
  be used.
  
  Arguments:
    filename: the filename that should be parsed.
  
  Returns:
    the FilenameInfo corresponding to the given file if it could be parsed.
    None otherwise.
docstr_tok: ["Parses","the","filename","using","this","template",".","Note","that","when","the","filename","does","n't","specify","the","dataset","name",",","split",",","or","filetype","suffix",",","but","this","template","does",",","then","the","value","in","the","template","will","be","used",".","Arguments",":","filename",":","the","filename","that","should","be","parsed",".","Returns",":","the","FilenameInfo","corresponding","to","the","given","file","if","it","could","be","parsed",".","None","otherwise","."]
code: def parse_filename_info(
      self, filename: str
  ) -> Optional[FilenameInfo]:
      """Parses the filename using this template.
  
      Note that when the filename doesn't specify the dataset name, split, or
      filetype suffix, but this template does, then the value in the template will
      be used.
  
      Arguments:
        filename: the filename that should be parsed.
  
      Returns:
        the FilenameInfo corresponding to the given file if it could be parsed.
        None otherwise.
      """
      match = self.regex.fullmatch(filename)
      if not match:
          return None
      groupdict = match.groupdict()
      shard_index = groupdict.get("shard_index")
      num_shards = groupdict.get("num_shards")
      return FilenameInfo(
          dataset_name=groupdict.get("dataset_name", self.dataset_name),
          split=groupdict.get("split", self.split),
          filetype_suffix=groupdict.get(
              "filetype_suffix", self.filetype_suffix
          ),
          shard_index=int(shard_index)
          if shard_index is not None
          else None,
          num_shards=int(num_shards)
          if num_shards is not None
          else None,
          filename_template=self,
      )
  
imports: from __future__ import annotations
  import dataclasses
  import functools
  import os
  import re
  import textwrap
  from typing import Any, Dict, List, Mapping, MutableMapping, Optional, Tuple, Union
  from absl import logging
  from etils import epath
  from tensorflow_datasets.core.utils import py_utils
  from tensorflow_datasets.core.utils import version
label_desc: Use image node_id 3 for calling the ShardedFileTemplate obj's underlying member method code with example usage: obj.parse_filename_info(filename) and returns: FilenameInfo, None