class_docstr: LatestSpan operator.
docstr: Returns artifacts with the n latest spans.
  
  For example, if n=2, then only 2 artifacts with the latest 2 spans and
  latest versions are returned. If n=2 and all_versions=True, then all
  artifacts with the latest 2 spans but with all versions are included.
  
  Spans that are < min_span will be ignored. Additionally, the last
  skip_last_n number of spans will be ignored. For example, if min_span=2,
  skip_last_n=1, and the spans are [1, 2, 3, 4], then only spans [2, 3] will
  be kept.
  
  min_span and skip_last_n correspond to start_span_num and
  skip_num_recent_spans in the TFX RollingRange proto.
  
  Args:
    input_list: The list of Artifacts to parse.
  
  Returns:
    Artifacts with the n latest spans, all versions included.
docstr_tok: ["Returns","artifacts","with","the","n","latest","spans",".","For","example",",","if","n=2",",","then","only","2","artifacts","with","the","latest","2","spans","and","latest","versions","are","returned",".","If","n=2","and","all_versions=True",",","then","all","artifacts","with","the","latest","2","spans","but","with","all","versions","are","included",".","Spans","that","are","<","min_span","will","be","ignored",".","Additionally",",","the","last","skip_last_n","number","of","spans","will","be","ignored",".","For","example",",","if","min_span=2",",","skip_last_n=1",",","and","the","spans","are","[","1",",","2",",","3",",","4","]",",","then","only","spans","[","2",",","3","]","will","be","kept",".","min_span","and","skip_last_n","correspond","to","start_span_num","and","skip_num_recent_spans","in","the","TFX","RollingRange","proto",".","Args",":","input_list",":","The","list","of","Artifacts","to","parse",".","Returns",":","Artifacts","with","the","n","latest","spans",",","all","versions","included","."]
code: def apply(
      self, input_list: Sequence[types.Artifact]
  ) -> Sequence[types.Artifact]:
      """Returns artifacts with the n latest spans.
  
      For example, if n=2, then only 2 artifacts with the latest 2 spans and
      latest versions are returned. If n=2 and all_versions=True, then all
      artifacts with the latest 2 spans but with all versions are included.
  
      Spans that are < min_span will be ignored. Additionally, the last
      skip_last_n number of spans will be ignored. For example, if min_span=2,
      skip_last_n=1, and the spans are [1, 2, 3, 4], then only spans [2, 3] will
      be kept.
  
      min_span and skip_last_n correspond to start_span_num and
      skip_num_recent_spans in the TFX RollingRange proto.
  
      Args:
        input_list: The list of Artifacts to parse.
  
      Returns:
        Artifacts with the n latest spans, all versions included.
      """
      # Verify that min_span and skip_last_n are >= to their minimum values.
      if self.skip_last_n < 0:
          raise ValueError(
              f"skip_last_n must be >= 0, but was set to "
              f"{self.skip_last_n}."
          )
  
      if self.min_span < 0:
          raise ValueError(
              f"min_span must be >= 0, but was set to "
              f"{self.min_span}."
          )
  
      valid_artifacts = ops_utils.get_valid_artifacts(
          input_list, ops_utils.SPAN_AND_VERSION_PROPERTIES
      )
      if not valid_artifacts:
          return []
  
      return ops_utils.filter_artifacts_by_span(
          artifacts=valid_artifacts,
          span_descending=True,
          n=self.n,
          min_span=self.min_span,
          skip_last_n=self.skip_last_n,
          keep_all_versions=self.keep_all_versions,
      )
  
imports: from typing import Sequence
  from tfx import types
  from tfx.dsl.input_resolution import resolver_op
  from tfx.dsl.input_resolution.ops import ops_utils
label_desc: Use image node_id 1 for calling the LatestSpan obj's underlying member method code with example usage: obj.apply(input_list) and returns: ops_utils, list