class_docstr: StaticSpanRange operator.
docstr: Returns artifacts with spans in [start_span, end_span] inclusive.
  
  If start_span is not specified, then the smallest span among the artifacts
  in input_list is chosen. Similarly, if end_span is not specified, then the
  largest span among the artifacts in input_list is chosen.
  
  If multiple artifacts have the same span, then the span with the latest
  version is chosen.
  
  This ResolverOp corresponds to StaticRange in TFX.
  
  Args:
    input_list: A list of artifacts.
docstr_tok: ["Returns","artifacts","with","spans","in","[","start_span",",","end_span","]","inclusive",".","If","start_span","is","not","specified",",","then","the","smallest","span","among","the","artifacts","in","input_list","is","chosen",".","Similarly",",","if","end_span","is","not","specified",",","then","the","largest","span","among","the","artifacts","in","input_list","is","chosen",".","If","multiple","artifacts","have","the","same","span",",","then","the","span","with","the","latest","version","is","chosen",".","This","ResolverOp","corresponds","to","StaticRange","in","TFX",".","Args",":","input_list",":","A","list","of","artifacts","."]
code: def apply(
      self, input_list: Sequence[types.Artifact]
  ) -> Sequence[types.Artifact]:
      """Returns artifacts with spans in [start_span, end_span] inclusive.
  
      If start_span is not specified, then the smallest span among the artifacts
      in input_list is chosen. Similarly, if end_span is not specified, then the
      largest span among the artifacts in input_list is chosen.
  
      If multiple artifacts have the same span, then the span with the latest
      version is chosen.
  
      This ResolverOp corresponds to StaticRange in TFX.
  
      Args:
        input_list: A list of artifacts.
      """
      valid_artifacts = ops_utils.get_valid_artifacts(
          input_list, ops_utils.SPAN_AND_VERSION_PROPERTIES
      )
      if not valid_artifacts:
          return []
  
      if self.start_span < 0:
          self.start_span = min(
              valid_artifacts, key=lambda a: a.span
          ).span
  
      if self.end_span < 0:
          self.end_span = max(
              valid_artifacts, key=lambda a: a.span
          ).span
  
      # Sort the artifacts by span and then by version, in ascending order.
      valid_artifacts.sort(
          key=lambda a: (  # pylint: disable=g-long-lambda
              a.span,
              a.version,
              a.mlmd_artifact.create_time_since_epoch,
              a.id,
          )
      )  # pytype: disable=attribute-error
  
      # Only consider artifacts with spans are in [start_span, end_span]
      # inclusive.
      span_artifact_map = {}
      for artifact in valid_artifacts:
          if self.start_span <= artifact.span <= self.end_span:
              span_artifact_map.setdefault(artifact.span, []).append(
                  artifact
              )
  
      result = []
      for artifacts in span_artifact_map.values():
          if self.keep_all_versions:
              result.extend(sorted(artifacts, key=lambda a: a.version))
          else:
              # If keep_all_versions is False we take the artifact with the latest
              # (largest) version.
              result.append(max(artifacts, key=lambda a: a.version))
      return result
  
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 StaticSpanRange obj's underlying member method code with example usage: obj.apply(input_list) and returns: result, list