class_docstr: Structure representing a filename.
  
  Attributes:
    dataset_name: the name of the dataset, e.g. `mnist`.
    split: the split to which this file belongs, e.g. `train` or `test`.
    filetype_suffix: the suffix representing the filetype, e.g. `tfrecord`.
    shard_index: what shard this file is.
    num_shards: if known, the total number of shards.
    filename_template: the template to which this file conforms.
docstr: Factory to create a `FilenameInfo` from filename.
docstr_tok: ["Factory","to","create","a","`","FilenameInfo","`","from","filename","."]
code: def from_str(
      cls,
      filename: str,
      filename_template: Optional[ShardedFileTemplate] = None,
  ) -> "FilenameInfo":
      """Factory to create a `FilenameInfo` from filename."""
      filename_template = _get_filename_template(
          filename, filename_template
      )
      # Strip off the directory if the filename contains it.
      filename = os.path.basename(filename)
      filename_info = filename_template.parse_filename_info(filename)
      if filename_info is None:
          raise ValueError(
              f"Could not parse filename {filename} "
              f"with template {filename_template}"
          )
      return filename_info
  
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 FilenameInfo obj's underlying member method code with example usage: obj.from_str(cls, filename, filename_template) and returns: filename_info