class_docstr: Utility class for opening embeddings text files. Handles various compression formats,
  as well as context management.
  
  # Parameters
  
  file_uri : `str`
      It can be:
  
      * a file system path or a URL of an eventually compressed text file or a zip/tar archive
        containing a single file.
      * URI of the type `(archive_path_or_url)#file_path_inside_archive` if the text file
        is contained in a multi-file archive.
  
  encoding : `str`
  cache_dir : `str`
class_docstr_tok: ["Utility","class","for","opening","embeddings","text","files",".","Handles","various","compression","formats",",","as","well","as","context","management",".","#","Parameters","file_uri",":","`","str","`","It","can","be",":","*","a","file","system","path","or","a","URL","of","an","eventually","compressed","text","file","or","a","zip\/tar","archive","containing","a","single","file",".","*","URI","of","the","type","`","(","archive_path_or_url",")","#","file_path_inside_archive","`","if","the","text","file","is","contained","in","a","multi-file","archive",".","encoding",":","`","str","`","cache_dir",":","`","str","`"]
docstr: This function takes in input a string and if it contains 1 or 2 integers, it assumes the
  largest one it the number of tokens. Returns None if the line doesn't match that pattern.
docstr_tok: ["This","function","takes","in","input","a","string","and","if","it","contains","1","or","2","integers",",","it","assumes","the","largest","one","it","the","number","of","tokens",".","Returns","None","if","the","line","does","n't","match","that","pattern","."]
code: def _get_num_tokens_from_first_line(line: str) -> Optional[int]:
      """This function takes in input a string and if it contains 1 or 2 integers, it assumes the
      largest one it the number of tokens. Returns None if the line doesn't match that pattern.
      """
      fields = line.split(" ")
      if 1 <= len(fields) <= 2:
          try:
              int_fields = [int(x) for x in fields]
          except ValueError:
              return None
          else:
              num_tokens = max(int_fields)
              logger.info(
                  "Recognized a header line in the embedding file with number of tokens: %d",
                  num_tokens,
              )
              return num_tokens
      return None
  
imports: import io
  import itertools
  import logging
  import re
  import tarfile
  import warnings
  import zipfile
  from typing import Any, cast, Iterator, NamedTuple, Optional, Sequence, Tuple, BinaryIO
  import numpy
  import torch
  from torch.nn.functional import embedding
  from allennlp.common import Tqdm
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.file_utils import cached_path, get_file_extension, is_url_or_existing_file
  from allennlp.data.vocabulary import Vocabulary
  from allennlp.modules.time_distributed import TimeDistributed
  from allennlp.modules.token_embedders.token_embedder import TokenEmbedder
  from allennlp.nn import util
label_desc: Use image node_id 13 for calling the EmbeddingsTextFile obj's underlying member method code with example usage: obj._get_num_tokens_from_first_line(line) and returns: None, num_tokens, None