示例#1
0
def get_pf_bdf(bdf):
    paths = glob.glob0(PCI_DEVICES_PATH, bdf)
    if paths:
        p0 = paths[0]
        path = find_pf_by_vf(p0) if is_vf(p0) else p0
        return get_bdf_by_path(path)
    return bdf
def FindCompilationDBFolder(filename):
    dirname = os.path.dirname(filename)

    for x in range(0, 7):
        DB = glob.glob0(dirname, 'compile_commands.json')
        if len(DB) != 0:
            return dirname
        dirname = os.path.dirname(dirname)

    return ''
示例#3
0
def get_file_type(path, pinfo_list, install_dir):
    """Return the file type of a path according to the given PathInfo
    list"""

    Match = lambda x: [match for match in glob.glob0(install_dir, x.lstrip("/")) if pisi.util.join_path(install_dir, path).find(match) > -1]

    def Sort(x):
        x.sort(reverse=True)
        return x

    best_matched_path = Sort([pinfo.path for pinfo in pinfo_list if Match(pinfo.path)])[0]
    info = [pinfo for pinfo in pinfo_list if best_matched_path == pinfo.path][0]
    return info.fileType, info.permanent
示例#4
0
文件: misc.py 项目: spacehamster/cook
    def _iglob(pathname):
        """Return an iterator which yields the paths matching a pathname pattern.

        The pattern may contain simple shell-style wildcards a la
        fnmatch. However, unlike fnmatch, filenames starting with a
        dot are special cases that are not matched by '*' and '?'
        patterns.

        If recursive is true, the pattern '**' will match any files and
        zero or more directories and subdirectories.

        Note: The recursive glob was introduced in Python 3.5. This is more
        or less a straight back-port in order to support older versions.
        """
        dirname, basename = os.path.split(pathname)
        if not _glob.has_magic(pathname):
            if basename:
                if os.path.lexists(pathname):
                    yield pathname
                else:
                    raise FileNotFoundError
            else:
                if os.path.isdir(dirname):
                    yield pathname
                else:
                    raise NotADirectoryError
            return
        if not dirname:
            if basename == '**':
                for name in _glob2(dirname, basename):
                    yield name
            else:
                for name in _glob.glob1(dirname, basename):
                    yield name
            return
        if dirname != pathname and _glob.has_magic(dirname):
            dirs = _iglob(dirname)
        else:
            dirs = [dirname]
        if _glob.has_magic(basename):
            if basename == '**':
                glob_in_dir = _glob2
            else:
                glob_in_dir = _glob.glob1
        else:
            glob_in_dir = _glob.glob0(dirname, basename)
        for dirname in dirs:
            for name in glob_in_dir(dirname, basename):
                yield os.path.join(dirname, name)
示例#5
0
__author__ = 'Dixit_Patel'

from genericFunctions import *
import athletemodel
#from athletemodel import *
import yate
import glob

data_files = glob.glob("data/*.txt")
print(glob.glob0('data','/*.txt'))
print(glob.glob1('data','/*.txt'))
athletes = athletemodel.put_to_store(data_files)
print(yate.header("ATHLetA"))
print(yate.para('Select an athlete from list'))
print(yate.start_form(''))
print(type(athletes))
for athlete in athletes:
    print(yate.radio_button("which_athlete",athletes[athlete].name))
# print(yate.radio_button('James','James'))
# print(yate.radio_button('Mikey','Mikey'))
print(yate.end_form())
print(yate.include_footer({"Home": "/index.html"}))
示例#6
0
文件: nodes.py 项目: xxoolm/Ryven
 def update_event(self, inp=-1):
     self.set_output_val(0, glob.glob0(self.input(0), self.input(1)))