def run(args, families):
  if args.names:
    print_names(families)

  cp_to_families = collections.defaultdict(set)
  if args.each:
    def each_emit(out_cps, out_families):
      if out_families:
        out_family_str = '\n  '.join(sorted(out_families))
      else:
        out_family_str = '<no coverage>'
      print '%s:\n  %s' % (to_ranges_str(out_cps), out_family_str)

    cps = codepoints(args.each)
    print 'families that contain any of %s, by cp' % to_ranges_str(cps)
    for family in families.itervalues():
      family_cps = family.charset & cps
      for cp in family_cps:
        cp_to_families[cp].add(family.name)

    if not cp_to_families:
      print 'no family supports any codepoint'
    else:
      cp_list = sorted(cps)
      cp = cp_list[0]
      out_cps = [cp]
      out_families = cp_to_families[cp]
      for cp in cp_list[1:]:
        next_families = cp_to_families[cp]
        if out_families == next_families:
          out_cps.append(cp)
        else:
          each_emit(out_cps, out_families)
          out_cps = [cp]
          out_families = next_families
      each_emit(out_cps, out_families)

  if args.any:
    missing = set()
    result = {}
    cps = sorted(codepoints(args.any))
    print 'families that contain any of %s' % to_ranges_str(cps)
    for cp in cps:
      family_names = check_cp(families, cp)
      if family_names:
        for family in family_names:
          if family in result:
            result[family].add(cp)
          else:
            result[family] = set([cp])
      else:
        missing.add(cp)
    if result:
      for k, v in sorted(result.iteritems()):
        print '  %s: %s' % (k, to_ranges_str(v))
    if missing:
      print '  not supported: %s' % to_ranges_str(missing)

  if args.all:
    cps = sorted(codepoints(args.all))
    print 'families that contain all of %s' % to_ranges_str(cps)
    result = set([family.name for family in families.itervalues()])
    for cp in cps:
      family_names = check_cp(families, cp)
      result &= family_names
    if result:
      print '\n'.join(['  %s' % name for name in sorted(result)])
    else:
      print 'no family contains all the codepoints'
dataset/ETHPy150Open googlei18n/nototools/nototools/noto_font_coverage.py/run/original