class_docstr: PairedSpans operator.
docstr: PairedSpans Operator.
  
  This is similiar to the unnest operator, but will provide a list of paired
  artifacts by span and version over each key of the input dict. Pseudo code
  example where matching subscripts indicate matching span number and version
  number.
  
  Notation here is {artifact}_(span, version)
  
    PairedSpans({x: [x_(0,0), x_(0,1), x_(1,0), x_(2,0)],
                 y: [y_(0,0), y_(0,1), y_(1,0)]})
      = [{x: [x_(0,0)], y: [y_(0,0)]},
         {x: [x_(0,1)], y: [y_(0,1)]},
         {x: [x_(1,0)], y: [y_(1,0)]}]
  
    PairedSpans({x: [x_(0,0), x_(0,1), x_(1,0), x_(2,0)],
                 y: [y_(0,0), y_(0,1), y_(1,0)]},
                 keep_all_versions=False)
      = [{x: [x_(0,1)], y: [y_(0,1)]},
         {x: [x_(1,0)], y: [y_(1,0)]}]
  
  
  
  Args:
    input_dict: A dictionary of artifacts.
  Returns:
    List of dicts of paired input elements with the same span and version.
code: def apply(self, input_dict: typing_utils.ArtifactMultiMap):
      """PairedSpans Operator.
  
      This is similiar to the unnest operator, but will provide a list of paired
      artifacts by span and version over each key of the input dict. Pseudo code
      example where matching subscripts indicate matching span number and version
      number.
  
      Notation here is {artifact}_(span, version)
  
        PairedSpans({x: [x_(0,0), x_(0,1), x_(1,0), x_(2,0)],
                     y: [y_(0,0), y_(0,1), y_(1,0)]})
          = [{x: [x_(0,0)], y: [y_(0,0)]},
             {x: [x_(0,1)], y: [y_(0,1)]},
             {x: [x_(1,0)], y: [y_(1,0)]}]
  
        PairedSpans({x: [x_(0,0), x_(0,1), x_(1,0), x_(2,0)],
                     y: [y_(0,0), y_(0,1), y_(1,0)]},
                     keep_all_versions=False)
          = [{x: [x_(0,1)], y: [y_(0,1)]},
             {x: [x_(1,0)], y: [y_(1,0)]}]
  
  
  
      Args:
        input_dict: A dictionary of artifacts.
      Returns:
        List of dicts of paired input elements with the same span and version.
      """
      indexed_latest_artifacts = {
          k: self._get_artifacts(v) for k, v in input_dict.items()
      }
      if not indexed_latest_artifacts:
          return []
  
      if len(indexed_latest_artifacts) < 2:
          return []
      # Intersect all sets of keys.
      common_keys = functools.reduce(
          lambda x, y: x & y,
          [set(x.keys()) for x in indexed_latest_artifacts.values()],
      )
  
      return [
          {ak: [av[ck]] for ak, av in indexed_latest_artifacts.items()}
          for ck in sorted(common_keys)
      ]
  
file_path: tfx/tfx/dsl/input_resolution/ops/paired_spans_op.py
imports: import functools
  from typing import Dict, Sequence, Tuple
  from tfx import types
  from tfx.dsl.input_resolution import resolver_op
  from tfx.dsl.input_resolution.ops import ops_utils
  from tfx.utils import typing_utils
label_desc: Use image node_id 2 for calling the PairedSpans obj's underlying member method code with example usage: obj.apply(input_dict) and returns: unknown, list, list