(sharded_filenames)
return filenames
Generate a list of filenames from a filename with an @shards suffix.
Generate a list of filenames from a filename with an
Generate a list of filenames from a filename with an
def generate_sharded_filenames(sharded_filenames):
  """Generate a list of filenames from a filename with an @shards suffix."""
  filenames = []
  for filename in sharded_filenames.split(','):
    match = re.match(r'^([^@]+)@(\d+)$', filename)
    if not match:
      filenames.append(filename)
    else:
      num_shards = int(match.group(2))
      base = match.group(1)
      for i in range(num_shards):
        filenames.append('{}-{:0=5d}-of-{:0=5d}'.format(base, i, num_shards))
  return filenames
def generate_sharded_filenames ( sharded_filenames ) : filenames = [ ] for filename in sharded_filenames . split ( ',' ) : match = re . match ( r'^([^@]+)@(\d+)$' , filename ) if not match : filenames . append ( filename ) else : num_shards = int ( match . group ( 2 ) ) base = match . group ( 1 ) for i in range ( num_shards ) : filenames . append ( '{}-{:0=5d}-of-{:0=5d}' . format ( base , i , num_shards ) ) return filenames