class_docstr: Raised if a yaml file does not correspond to the expected schema.
class_docstr_tok: ["Raised","if","a","yaml","file","does","not","correspond","to","the","expected","schema","."]
docstr: Get line number for a yaml path in the current content.
  
  Implemented using recursion: algorithm goes down the path navigating to the
  leaf in the YAML tree. Unfortunately, not all nodes returned from the
  ruamel yaml parser have line numbers attached (arrays have them, dicts have
  them), e.g. strings don't have attached line numbers.
  If we arrive at a node that has no line number attached, we'll return the
  line number of the parent - that is as close as it gets.
  
  Args:
      current: current content
      path: path to traverse within the content
  
  Returns:
      the line number of the path in the content.
docstr_tok: ["Get","line","number","for","a","yaml","path","in","the","current","content",".","Implemented","using","recursion",":","algorithm","goes","down","the","path","navigating","to","the","leaf","in","the","YAML","tree",".","Unfortunately",",","not","all","nodes","returned","from","the","ruamel","yaml","parser","have","line","numbers","attached","(","arrays","have","them",",","dicts","have","them",")",",","e.g",".","strings","do","n't","have","attached","line","numbers",".","If","we","arrive","at","a","node","that","has","no","line","number","attached",",","we","'ll","return","the","line","number","of","the","parent","-","that","is","as","close","as","it","gets",".","Args",":","current",":","current","content","path",":","path","to","traverse","within","the","content","Returns",":","the","line","number","of","the","path","in","the","content","."]
code: def _line_number_for_path(
      self, current: Any, path: Text
  ) -> Optional[int]:
      """Get line number for a yaml path in the current content.
  
      Implemented using recursion: algorithm goes down the path navigating to the
      leaf in the YAML tree. Unfortunately, not all nodes returned from the
      ruamel yaml parser have line numbers attached (arrays have them, dicts have
      them), e.g. strings don't have attached line numbers.
      If we arrive at a node that has no line number attached, we'll return the
      line number of the parent - that is as close as it gets.
  
      Args:
          current: current content
          path: path to traverse within the content
  
      Returns:
          the line number of the path in the content.
      """
      if not current:
          return None
  
      this_line = (
          current.lc.line + 1 if hasattr(current, "lc") else None
      )
  
      if not path:
          return this_line
  
      if "/" in path:
          head, tail = path.split("/", 1)
      else:
          head, tail = path, ""
  
      if head:
          if isinstance(current, dict) and head in current:
              return (
                  self._line_number_for_path(current[head], tail)
                  or this_line
              )
          elif isinstance(current, list) and head.isdigit():
              return (
                  self._line_number_for_path(current[int(head)], tail)
                  or this_line
              )
          else:
              return this_line
      return self._line_number_for_path(current, tail) or this_line
  
imports: import logging
  import os
  from typing import Text, Dict, List, Optional, Any
  from packaging import version
  from packaging.version import LegacyVersion
  from pykwalify.errors import SchemaError
  from ruamel.yaml.constructor import DuplicateKeyError
  import rasa.shared
  from rasa.shared.exceptions import YamlException, YamlSyntaxException, SchemaValidationError
  import rasa.shared.utils.io
  from rasa.shared.constants import DOCS_URL_TRAINING_DATA, PACKAGE_NAME, LATEST_TRAINING_DATA_FORMAT_VERSION, SCHEMA_EXTENSIONS_FILE, RESPONSES_SCHEMA_FILE
label_desc: Use image node_id 3 for calling the YamlValidationException obj's underlying member method code with example usage: obj._line_number_for_path(current, path) and returns: unknown, None, this_line, unknown, unknown, this_line