Create a path for a given file, in such a way
        that files end up being organized and browsable by run
358028
def _get_run_breadcrumbs(cls, source_type, data_object, task_attempt):
        
        # We cannot generate the path unless connect to a TaskAttempt
        # and a run
        if not task_attempt:
            return []
        # If multiple tasks exist, use the original.
        task = task_attempt.tasks.earliest('datetime_created')
        if task is None:
            return []
        run = task.run
        if run is None:
            return []

        breadcrumbs = [
            run.name,
            "task-%s" % str(task.uuid)[0:8],
            "attempt-%s" % str(task_attempt.uuid)[0:8],
        ]

        # Include any ancestors if run is nested
        while run.parent is not None:
            run = run.parent
            breadcrumbs = [run.name] + breadcrumbs

        # Prepend first breadcrumb with datetime and id
        breadcrumbs[0] = "%s-%s-%s" % (
            run.datetime_created.strftime('%Y-%m-%dT%H.%M.%SZ'),
            str(run.uuid)[0:8],
            breadcrumbs[0])

        breadcrumbs = ['runs'] + breadcrumbs
        return breadcrumbs
518273
def _create_path(self):
        """"""

        if self.driver == 'sqlite' and 'memory' not in self.dsn and self.dsn != 'sqlite://':

            dir_ = os.path.dirname(self.path)

            if dir_ and not os.path.exists(dir_):
                try:
                    # Multiple process may try to make, so it could already
                    # exist
                    os.makedirs(dir_)
                except Exception:
                    pass

                if not os.path.exists(dir_):
                    raise Exception("Couldn't create directory " + dir_)
193314
def create_done_path(done_path, uid=-1, gid=-1):
    """"""
    with open(done_path, 'wb'):
        pass
    os.chown(done_path, uid, gid);
1036687
function createDirectories(done) {
		debug('createDirectories()');
		var paths = [ options.output ];
		function iterator(dirpath, next) { mkdirp(dirpath, '0755', next); };
		async.forEach(paths, iterator, done);
	}
1223276
def make_path_properties(file_or_path, prefix=''):
    """"""
    is_std = file_or_path in (sys.stdin, sys.stdout, sys.stderr)

    if is_std:
        path = '-'
    elif is_filelike(file_or_path):
        try:
            path = str(file_or_path.name)
        except AttributeError:
            path = None
    else:
        path = str(file_or_path)

    if is_std or not path:
        abspath = dirname = basename = stem = ext = None
        realpath = realdrive = realdir = realbase = realstem = realext = None
        numbers = num = None
    else:
        abspath = os.path.abspath(path)

        dirname, basename = os.path.split(path)
        stem, ext = os.path.splitext(basename)

        if not dirname:
            dirname = os.curdir

        realpath = os.path.realpath(path)
        realdrive, tail = os.path.splitdrive(realpath)
        realdir, realbase = os.path.split(tail)
        realstem, realext = os.path.splitext(realbase)

        numbers = [int(s) for s in re.findall(r'\d+', basename)]
        num = numbers[-1] if numbers else None

    return {
            prefix + 'path':      path,
            prefix + 'abspath':   abspath,
            prefix + 'dirname':   dirname,
            prefix + 'basename':  basename,
            prefix + 'stem':      stem,
            prefix + 'ext':       ext,
            prefix + 'realpath':  realpath,
            prefix + 'realdrive': realdrive,
            prefix + 'realdir':   realdir,
            prefix + 'realbase':  realbase,
            prefix + 'realstem':  realstem,
            prefix + 'realext':   realext,
            prefix + 'numbers':   numbers,
            prefix + 'num':       num,
        }
270965
def _file_path(self, dirname, filename):
        '''
        
        '''
        if not os.path.exists(dirname):
            try:
                os.makedirs(dirname)
            except KeyboardInterrupt as e:
                raise e
            except Exception:
                pass

        fpath = os.path.join(dirname, filename)

        if not os.path.exists(fpath):
            try:
                open(fpath, "w").close()
            except KeyboardInterrupt as e:
                raise e
            except Exception:
                pass

        return fpath
1126716
def process_paths(options, candidates=None, error=True):
    """"""
    errors = check_path(options, rootdir=CURDIR, candidates=candidates)

    if options.format in ['pycodestyle', 'pep8']:
        pattern = "%(filename)s:%(lnum)s:%(col)s: %(text)s"
    elif options.format == 'pylint':
        pattern = "%(filename)s:%(lnum)s: [%(type)s] %(text)s"
    else:  # 'parsable'
        pattern = "%(filename)s:%(lnum)s:%(col)s: [%(type)s] %(text)s"

    for er in errors:
        if options.abspath:
            er._info['filename'] = op.abspath(er.filename)
        LOGGER.warning(pattern, er._info)

    if error:
        sys.exit(int(bool(errors)))

    return errors
173055
def directory_files(path):
    """"""

    for entry in os.scandir(path):
        if not entry.name.startswith('.') and entry.is_file():
            yield entry.name
317367
def queue_files(dirpath, queue):
    """"""
    for root, _, files in os.walk(os.path.abspath(dirpath)):
        if not files:
            continue
        for filename in files:
            queue.put(os.path.join(root, filename))
1373465
def create_init_files(path):
    
    python_files = sorted([os.path.basename(file_)[:-3] for file_ in
                           glob.glob(os.path.join(path, '*.py'))
                           if not file_.endswith('__init__.py')])

    folders = sorted([os.path.basename(folder) for folder in os.listdir(path)
                      if os.path.isdir(os.path.join(path, folder))])
    with open(path + '/__init__.py', 'w') as fn:
        if python_files:
            [fn.write('from %s import *\n' % file_) for file_ in python_files]
            [fn.write('import %s\n' % folder) for folder in folders]
    for folder in folders:
        create_init_files(os.path.join(path, folder))
420404
def make_path(inpath):
    
    if not os.path.isfile(inpath):
        try:
            os.makedirs(inpath)
        except FileExistsError:
            pass
    else:
        raise OSError
1106901
def makepath(s, as_file=False):
    
    if s is None:
        return None
    result = FilePath(s) if (os.path.isfile(s) or as_file) else DirectPath(s)
    return result.expandall()
881846
def generate(self, path, label):
        
        for filename in os.listdir(path):
            self[filename] = label
1076173
def walkfiles(startdir, regex=None, recurse=True):
    """"""
    for r,_,fs in os.walk(startdir):
        if not recurse and startdir != r:
            return
        for f in fs:
            path = op.abspath(op.join(r,f))
            if regex and not _is_match(regex, path):
                    continue
            if op.isfile(path):
                yield path
932629
def create_recursive(path)
      recursive = path.split("/")
      directory = ""
      recursive.each do |sub_directory|
        directory += sub_directory + "/"
        Dir.mkdir("#{directory}") unless (File.directory? directory)
      end
    end
787304
def gen_files(path, prefix="_"):
    "  "

    if op.isdir(path):
        for name in listdir(path):
            fpath = op.join(path, name)
            if is_parsed_file(fpath):
                yield op.abspath(fpath)

    elif is_parsed_file(path):
        yield op.abspath(path)
1074528
function makeFilePathRelativeToCwd (file) {
  const cwd = process.cwd();
  return (file.startsWith(cwd)) ? '.' + file.substring(cwd.length) : file;
}