Generate a random path to project directory.

        :return: Path to project.

        :Example:
            /home/sherika/Development/Falcon/mercenary
198147
def project_dir(self) -> str:
        
        dev_dir = self.dev_dir()
        project = self.random.choice(PROJECT_NAMES)
        return str(self._pathlib_home / dev_dir / project)
349982
def action_create(self, courseid, taskid, path):
        
        # the path is given by the user. Let's normalize it
        path = path.strip()
        if not path.startswith("/"):
            path = "/" + path

        want_directory = path.endswith("/")

        wanted_path = self.verify_path(courseid, taskid, path, True)
        if wanted_path is None:
            return self.show_tab_file(courseid, taskid, _("Invalid new path"))

        task_fs = self.task_factory.get_task_fs(courseid, taskid)
        if want_directory:
            task_fs.from_subfolder(wanted_path).ensure_exists()
        else:
            task_fs.put(wanted_path, b"")
        return self.show_tab_file(courseid, taskid)
1009286
def get_project_source_path(path: str) -> str:
    

    path = environ.paths.clean(path)

    if not path.endswith('cauldron.json'):
        return os.path.join(path, 'cauldron.json')

    return path
955332
def randpath(self):
        
        return '/'.join(
            gen_rand_str(3, 10, use=self.random, keyspace=list(self.keyspace))
            for _ in range(self.random.randint(0, 3)))
761511
def generate_project(self):
        
        # checks needed properties
        if not self.name or not self.destdir or \
               not os.path.isdir(self.destdir):
            raise ValueError("Empty or invalid property values: run with 'help' command")

        _log("Generating project '%s'" % self.name)
        _log("Destination directory is: '%s'" % self.destdir)

        top = os.path.join(self.destdir, self.name)
        src = os.path.join(top, self.src_name)
        resources = os.path.join(top, self.res_name)
        utils = os.path.join(src, "utils")

        if self.complex:
            models = os.path.join(src, "models")
            ctrls = os.path.join(src, "ctrls")
            views = os.path.join(src, "views")
        else: models = ctrls = views = src

        res = self.__generate_tree(top, src, resources, models, ctrls, views, utils)
        res = self.__generate_classes(models, ctrls, views) or res
        res = self.__mksrc(os.path.join(utils, "globals.py"), templates.glob) or res

        if self.complex: self.templ.update({'model_import' : "from models.application import ApplModel",
                                            'ctrl_import' : "from ctrls.application import ApplCtrl",
                                            'view_import' : "from views.application import ApplView"})
        else: self.templ.update({'model_import' : "from ApplModel import ApplModel",
                                 'ctrl_import' : "from ApplCtrl import ApplCtrl",
                                 'view_import' : "from ApplView import ApplView"})

        res = self.__mksrc(os.path.join(top, "%s.py" % self.name), templates.main) or res

        # builder file
        if self.builder:
            res = self.__generate_builder(resources) or res

        if self.dist_gtkmvc3: res = self.__copy_framework(os.path.join(resources, "external")) or res

        if not res: _log("No actions were taken")
        else: _log("Done")
        return res
1372922
def random_path(instance, filename):
    
    # Split the uuid into two parts so that we won't run into subdirectory count limits. First part has 3 hex chars,
    #  thus 4k possible values.
    uuid_hex = get_uuid()
    return os.path.join(uuid_hex[:3], uuid_hex[3:], filename)
815949
def get_project_urls(project):
    """"""
    urls = []
    with ftputil.FTPHost(sra_host, sra_user, sra_password) as ftp_host:
        download_paths = []
        exp_dir = '/sra/sra-instant/reads/ByStudy/sra/SRP/%s/%s/' \
                %(project[:6], project)
        ftp_host.chdir(exp_dir)
        run_folders = ftp_host.listdir(ftp_host.curdir)

        # compile a list of all files
        for folder in run_folders:
            files = ftp_host.listdir(folder)
            assert len(files) == 1
            for f in files:
                path = exp_dir + folder + '/' + f
                urls.append(path)
    return urls
100363
def build_path(levels):
    
    path = os.path.join(*levels)
    if not dir_exists(path):
        os.makedirs(path)
    return path
655012
def project_path(cls, user, project):
        """"""
        return google.api_core.path_template.expand(
            "users/{user}/projects/{project}", user=user, project=project
        )
1148687
def get_random_path(graph) -> List[BaseEntity]:
    
    wg = graph.to_undirected()

    nodes = wg.nodes()

    def pick_random_pair() -> Tuple[BaseEntity, BaseEntity]:
        """Get a pair of random nodes."""
        return random.sample(nodes, k=2)

    source, target = pick_random_pair()

    tries = 0
    sentinel_tries = 5

    while not nx.has_path(wg, source, target) and tries < sentinel_tries:
        tries += 1
        source, target = pick_random_pair()

    if tries == sentinel_tries:
        return [source]

    return nx.shortest_path(wg, source=source, target=target)
320711
def prep_directory(self, target_dir):
        
        dirname = path.dirname(target_dir)
        if dirname:
            dirname = path.join(settings.BUILD_DIR, dirname)
            if not self.fs.exists(dirname):
                logger.debug("Creating directory at {}{}".format(self.fs_name, dirname))
                self.fs.makedirs(dirname)
471147
function getSrcDirPath(projectInfo)
{
    let srcDir
    if(projectInfo.SourceDir){
        srcDir = path.normalize(path.join(projectInfo.ProjectPath, projectInfo.SourceDir))
    }
    return srcDir
}
417324
def create_directory(self, path):
        
        _complain_ifclosed(self.closed)
        return self.fs.create_directory(path)
114326
def create_project_config_path(
    path, mode=0o777, parents=False, exist_ok=False
):
    """"""
    # FIXME check default directory mode
    project_path = Path(path).absolute().joinpath(RENKU_HOME)
    project_path.mkdir(mode=mode, parents=parents, exist_ok=exist_ok)
    return str(project_path)
213419
def search_project_root():
        

        while True:

            current = os.getcwd()

            if pathlib.Path("Miragefile.py").is_file() or pathlib.Path("Miragefile").is_file():
                return current
            elif os.getcwd() == "/":
                raise FileNotFoundError
            else:
                os.chdir("../")
806973
def get_project_directory(self, name, target):
        
        # if some directory is given, make sure it's nicely expanded.
        if target is None:
            top_dir = os.path.join(os.getcwd(), name)
        else:
            top_dir = os.path.abspath(os.path.expanduser(target))
            if not os.path.exists(top_dir):
                raise CommandError("Destination directory '%s' does not "
                                   "exist, please create it first." % top_dir)

        return top_dir
704325
def output_dir(self, *args) -> str:
        
        return os.path.join(self.project_dir, 'output', *args)