Generate filenames.

    :param tuple sources: Sequence of strings representing path to file(s).
    :return: Path to file(s).
    :rtype: :py:class:`str`
188402
def _generate_filenames(sources):
    

    for source in sources:

        if os.path.isdir(source):
            for path, dirlist, filelist in os.walk(source):
                for fname in filelist:
                    if nmrstarlib.VERBOSE:
                        print("Processing file: {}".format(os.path.abspath(fname)))
                    if GenericFilePath.is_compressed(fname):
                        if nmrstarlib.VERBOSE:
                            print("Skipping compressed file: {}".format(os.path.abspath(fname)))
                        continue
                    else:
                        yield os.path.join(path, fname)

        elif os.path.isfile(source):
            yield source

        elif GenericFilePath.is_url(source):
            yield source

        elif source.isdigit():
            try:
                urlopen(nmrstarlib.BMRB_REST + source)
                yield nmrstarlib.BMRB_REST + source
            except HTTPError:
                urlopen(nmrstarlib.PDB_REST + source + ".cif")
                yield nmrstarlib.PDB_REST + source + ".cif"

        elif re.match("[\w\d]{4}", source):
            yield nmrstarlib.PDB_REST + source + ".cif"

        else:
            raise TypeError("Unknown file source.")
550031
def gen_template_files(path):
    "  "

    path = path.rstrip(op.sep)
    for root, _, files in walk(path):
        for f in filter(lambda x: not x in (TPLNAME, CFGNAME), files):
            yield op.relpath(op.join(root, f), path)
547138
def source(self):
        
        if len(self.sources) == 0:
            raise ValueError("No source associated with %s" % self.__class__.__name__)
        elif len(self.sources) > 1:
            raise ValueError("Multiple sources for %s" % self.__class__.__name__)
        return list(self.sources)[0]
940283
def _get_file_content(source):
    
    filepath = os.path.join('siglists', source + '.txt')

    lines = []
    with resource_stream(__name__, filepath) as f:
        for i, line in enumerate(f):
            line = line.decode('utf-8', 'strict').strip()
            if not line or line.startswith('#'):
                continue

            try:
                re.compile(line)
            except Exception as ex:
                raise BadRegularExpressionLineError(
                    'Regex error: {} in file {} at line {}'.format(
                        str(ex),
                        filepath,
                        i
                    )
                )

            lines.append(line)

    if source in _SPECIAL_EXTENDED_VALUES:
        lines = lines + _SPECIAL_EXTENDED_VALUES[source]

    return tuple(lines)
196925
def file_names(self) -> Iterable[str]:
        
        if self.is_sharded():
            yield from ShardedFile(self.filename_spec).get_filenames()
        elif self.filename_spec:
            yield self.filename_spec
1222573
def filenames(self, sources):
        
        filename = []
        for src in sources:
            filename.append(src.split("/")[-1])
        return filename
907513
def list_files(self, prefix, flat=False):
    
    layer_path = self.get_path_to_file("")        
    path = os.path.join(layer_path, prefix)
    for blob in self._bucket.list_blobs(prefix=path):
      filename = blob.name.replace(layer_path, '')
      if not flat and filename[-1] != '/':
        yield filename
      elif flat and '/' not in blob.name.replace(path, ''):
        yield filename
1329649
def _many_to_many(self):
        
        if not self.file_generator.to_path_compression:
            self._to_dir(self.file_generator)
        elif self.file_generator.to_path_compression == "zip":
            self._to_zipfile(self.file_generator)
        elif self.file_generator.to_path_compression in ("tar", "tar.gz", "tar.bz2"):
            self._to_tarfile(self.file_generator)
        elif self.file_generator.to_path_compression in ("gz", "bz2"):
            raise TypeError('Many-to-one conversion, cannot convert "{}" into "{}"'.format(self.file_generator.from_path,
                                                                                           self.file_generator.to_path))
        else:
            raise TypeError('Unknown output file format: "{}"'.format(self.file_generator.to_path))
695962
def _to_dir(self, file_generator):
        
        for f in file_generator:
            outpath = self._output_path(f.source, file_generator.to_format)

            if not os.path.exists(os.path.dirname(outpath)):
                os.makedirs(os.path.dirname(outpath))

            with open(outpath, mode="w") as outfile:
                f.write(outfile, file_generator.to_format)
1246177
def sources(self):
        
        data = clips.data.DataObject(self._env)

        lib.EnvSlotSources(self._env, self._cls, self._name, data.byref)

        return tuple(data.value) if isinstance(data.value, list) else ()
1099622
def expand_source_paths(paths):
    
    for src_path in paths:
        # only track the source path if we can find it to avoid double-reloads
        # when the source and the compiled path change because on some
        # platforms they are not changed at the same time
        if src_path.endswith(('.pyc', '.pyo')):
            py_path = get_py_path(src_path)
            if os.path.exists(py_path):
                src_path = py_path
        yield src_path
1261202
def source_file(self):
        
        if self._filename is None:
            self._filename = self._as_in_memory_geotiff()._filename
        return self._filename
779477
def filenames(self):
        
        fns = set()
        for fn2var in self._type2filename2variable.values():
            fns.update(fn2var.keys())
        return sorted(fns)
50614
def gen_filename(endpoint):
    
    now = datetime.now().strftime('%Y%m%d_%H%M%S%f')[:-4]
    base = endpoint.split('://', 1)[1]
    if base.startswith('localhost:'):
        base = gethostname().split('.')[0] + base[9:]
    base = base.replace(':', '_').replace('/', '_')
    return '{}_{}.h5'.format(base, now)
1335596
def create_file(self, name: str, generate_unique_name: bool = False):
        '''
        
        '''
        def enumerate_name():
            yield name
            index = 0
            while True:
                index += 1
                yield f'{name} ({index})'
        for n in enumerate_name():
            path = os.path.join(self._path, n)
            if os.path.exists(path):
                if not generate_unique_name:
                    raise FileExistsError
            return FileInfo(path)
585176
def _load_names(self) -> List[str]:
        
        names = []
        for path in self._get_files():
            for name in self._get_names(path):
                names.append(self._normalize_name(name))
        return names
873546
def source_filename(self, docname: str, srcdir: str):
        

        docpath = Path(srcdir, docname)
        parent = docpath.parent
        imgpath = parent.joinpath(self.filename)

        # Does this exist?
        if not imgpath.exists():
            msg = f'Image does not exist at "{imgpath}"'
            raise SphinxError(msg)

        return imgpath