def _iter_filter(root_dir, data_dict):
  root_fragment = os.path.join(root_dir, 'pex/')
  pex_fragment = '/%s/_pex/' % PEXBuilder.BOOTSTRAP_DIR

  for filename, records in data_dict.items():
    # already acceptable coverage
    if filename.startswith(root_fragment):
      yield (filename, dict((record, None) for record in records))
      continue

    # possible it's coverage from within a pex environment
    try:
      bi = filename.index(pex_fragment)
    except __HOLE__:
      continue

    # rewrite to make up for fact that each pex environment is ephemeral.
    yield (
        os.path.join(root_dir, 'pex', filename[bi + len(pex_fragment):]),
        dict((record, None) for record in records)
    )
dataset/ETHPy150Open pantsbuild/pex/scripts/combine_coverage.py/_iter_filter