parameters: (shard, *filespecs)
return_statement: return [master_num_shards] + [resolve_one(spec) for spec in filespecs]
docstring: Transforms potentially sharded filespecs into their paths for single shard.
  
    This function takes a shard number and a varargs of potentially-sharded
    filespecs, and returns a list where the filespecs have been resolved into
    concrete file paths for a single shard.
  
    This function has a concept of a master filespec, which is used to constrain
    and check the validity of other filespecs. The first filespec is considered
    the master, and it cannot be None. For example, if master is not sharded, none
    of the other specs can be sharded, and vice versa. They must all also have a
    consistent sharding (e.g., master is @10, then all others must be @10).
  
    Note that filespecs (except the master) may be None or any other False value,
    which are returned as-is in the output list.
  
    Args:
      shard: int >= 0. Our shard number.
      *filespecs: list[str]. Contains all of the filespecs we want to resolve into
        shard-specific file paths.
  
    Returns:
      A list. The first element is the number of shards, which is an int >= 1 when
      filespecs contains sharded paths and 0 if none do. All subsequent
      returned values follow the shard-specific paths for each filespec, in order.
  
    Raises:
      ValueError: if any filespecs are inconsistent.
docstring_summary: Transforms potentially sharded filespecs into their paths for single shard.
docstring_tokens: Transforms potentially sharded filespecs into their paths for single shard .
function: def resolve_filespecs(shard, *filespecs):
    """Transforms potentially sharded filespecs into their paths for single shard.
  
    This function takes a shard number and a varargs of potentially-sharded
    filespecs, and returns a list where the filespecs have been resolved into
    concrete file paths for a single shard.
  
    This function has a concept of a master filespec, which is used to constrain
    and check the validity of other filespecs. The first filespec is considered
    the master, and it cannot be None. For example, if master is not sharded, none
    of the other specs can be sharded, and vice versa. They must all also have a
    consistent sharding (e.g., master is @10, then all others must be @10).
  
    Note that filespecs (except the master) may be None or any other False value,
    which are returned as-is in the output list.
  
    Args:
      shard: int >= 0. Our shard number.
      *filespecs: list[str]. Contains all of the filespecs we want to resolve into
        shard-specific file paths.
  
    Returns:
      A list. The first element is the number of shards, which is an int >= 1 when
      filespecs contains sharded paths and 0 if none do. All subsequent
      returned values follow the shard-specific paths for each filespec, in order.
  
    Raises:
      ValueError: if any filespecs are inconsistent.
    """
    if not filespecs:
      raise ValueError('filespecs must have at least one element.')
  
    master = filespecs[0]
    master_is_sharded = is_sharded_file_spec(master)
  
    master_num_shards = 0
    if master_is_sharded:
      _, master_num_shards, _ = parse_sharded_file_spec(master)
      if shard >= master_num_shards or shard < 0:
        raise ValueError('Invalid shard={} value with master={} sharding'.format(
            shard, master))
    elif shard > 0:
      raise ValueError('Output is not sharded but shard > 0: {}'.format(shard))
  
    def resolve_one(filespec):
      """Resolves a single filespec into a concrete filepath."""
      if not filespec:
        return filespec
  
      is_sharded = is_sharded_file_spec(filespec)
      if master_is_sharded != is_sharded:
        raise ValueError('Master={} and {} have inconsistent sharding'.format(
            master, filespec))
  
      if not is_sharded:  # Not sharded => filespec is the actual filename.
        return filespec
  
      _, filespec_num_shards, _ = parse_sharded_file_spec(filespec)
      if filespec_num_shards != master_num_shards:
        raise ValueError('Master={} and {} have inconsistent sharding'.format(
            master, filespec))
      return sharded_filename(filespec, shard)
  
    return [master_num_shards] + [resolve_one(spec) for spec in filespecs]
function_tokens: def resolve_filespecs ( shard , * filespecs ) : if not filespecs : raise ValueError ( 'filespecs must have at least one element.' ) master = filespecs [ 0 ] master_is_sharded = is_sharded_file_spec ( master ) master_num_shards = 0 if master_is_sharded : _ , master_num_shards , _ = parse_sharded_file_spec ( master ) if shard >= master_num_shards or shard < 0 : raise ValueError ( 'Invalid shard={} value with master={} sharding' . format ( shard , master ) ) elif shard > 0 : raise ValueError ( 'Output is not sharded but shard > 0: {}' . format ( shard ) ) def resolve_one ( filespec ) : """Resolves a single filespec into a concrete filepath.""" if not filespec : return filespec is_sharded = is_sharded_file_spec ( filespec ) if master_is_sharded != is_sharded : raise ValueError ( 'Master={} and {} have inconsistent sharding' . format ( master , filespec ) ) if not is_sharded : # Not sharded => filespec is the actual filename. return filespec _ , filespec_num_shards , _ = parse_sharded_file_spec ( filespec ) if filespec_num_shards != master_num_shards : raise ValueError ( 'Master={} and {} have inconsistent sharding' . format ( master , filespec ) ) return sharded_filename ( filespec , shard ) return [ master_num_shards ] + [ resolve_one ( spec ) for spec in filespecs ]