Get shared projects for the user.
558146
function getSharedWorkspace(req, res) {
		return sharedUtil.getSharedProjects(req, res, function(projects) {
				var workspaces = [];
				projects.forEach(function(project){
					var projectSegs = project.Location.split("/");
					var projectBelongingWorkspaceId = sharedUtil.getWorkspaceIdFromprojectLocation(project.Location);
					if(!workspaces.some(function(workspace){
						return workspace.Id === projectBelongingWorkspaceId;
					})){
						workspaces.push({
							Id: projectBelongingWorkspaceId,
							Location: api.join(sharedWorkspaceFileRoot, projectBelongingWorkspaceId),
							Name: projectSegs[2] + "'s " + projectSegs[3]
						});
					}
				});
				writeResponse(null, res, null, {
					Id: req.user.username,
					Name: req.user.username,
					UserName: req.user.fullname || req.user.username,
					Workspaces: workspaces
				}, true);
		});
	}
1013974
public function getProjects($refresh = null)
    {
        $cacheKey = sprintf('%s:projects', $this->sessionId);

        /** @var Project[] $projects */
        $projects = [];

        $cached = $this->cache->fetch($cacheKey);

        if ($refresh === false && !$cached) {
            return [];
        } elseif ($refresh || !$cached) {
            foreach ($this->getClient()->getProjects() as $project) {
                $projects[$project->id] = $project;
            }

            $cachedProjects = [];
            foreach ($projects as $id => $project) {
                $cachedProjects[$id] = $project->getData();
                $cachedProjects[$id]['_endpoint'] = $project->getUri(true);
            }

            $this->cache->save($cacheKey, $cachedProjects, $this->config->get('api.projects_ttl'));
        } else {
            $guzzleClient = $this->getHttpClient();
            foreach ((array) $cached as $id => $data) {
                $projects[$id] = new Project($data, $data['_endpoint'], $guzzleClient);
            }
        }

        return $projects;
    }
633262
def get_projects():
    
    assert request.method == "GET", "GET request expected received {}".format(request.method)
    try:
        if request.method == 'GET':
            projects = utils.get_projects()

            return jsonify(projects)
    except Exception as e:
        logging.error(e)
    return jsonify({"0": "__EMPTY"})
921244
def get_my_choices_projects():
    

    proj_list = Project.objects.all()
    proj_tuple = []
    counter = 1
    for proj in proj_list:
        proj_tuple.append((counter, proj))
        counter = counter + 1
    return proj_tuple
1031539
def select_project(user_provided_project):
    '''
    

    '''

    home = os.path.expanduser('~')
    if os.path.isfile(os.path.join(home, '.transfer', 'config.yaml')):
        with open(os.path.join(home, '.transfer', 'config.yaml'), 'r') as fp:
            projects = yaml.load(fp.read())
        if len(projects) == 1:
            project = projects[0]
        else:
            if user_provided_project in [project['name'] for project in projects]:
                for inner_project in projects:
                    if user_provided_project == inner_project['name']:
                        project = inner_project
            else:
                print('Select your project')
                for i, project in enumerate(projects):
                    print('[' + str(i) + ']: ' + project['name'])
                project_index = int_input('project', -1, len(projects), show_range = False)
                project = projects[project_index]
    else:
        print('Transfer is not configured.')
        print('Please run:')
        print('')
        print(colored('    transfer --configure', 'green'))
        return

    print(colored('Project selected: ' + project['name'], 'cyan'))
    return project
371611
function addProjectToUser(user, project) {
		return addUser(user)
		.then(function(doc) {
			return userProject.findOneAndUpdate({username: user}, {$addToSet: {'sharedProjects': project} }, {
				safe: true,
				w: 'majority'
			}).exec();
		});
	}
577904
def get_projects(format):
    """"""

    projects_json = data_from_fablabs_io(fablabs_io_projects_api_url_v0)
    projects = {}
    project_url = "https://www.fablabs.io/projects/"
    fablabs = get_labs(format="object")

    # Load all the FabLabs
    for i in projects_json["projects"]:
        i = i["projects"]
        current_project = Project()
        current_project.id = i["id"]
        current_project.title = i["title"]
        current_project.description = i["description"]
        current_project.github = i["github"]
        current_project.web = i["web"]
        current_project.dropbox = i["dropbox"]
        current_project.bitbucket = i["bitbucket"]
        current_project.lab_id = i["lab_id"]
        # Add the lab of the project
        if i["lab_id"] is not None:
            for k in fablabs:
                if fablabs[k].id == i["lab_id"]:
                    current_project.lab = fablabs[k]
        else:
            current_project.lab = None
        current_project.owner_id = i["owner_id"]
        current_project.created_at = i["created_at"]
        current_project.updated_at = i["updated_at"]
        current_project.vimeo = i["vimeo"]
        current_project.flickr = i["flickr"]
        current_project.youtube = i["youtube"]
        current_project.drive = i["drive"]
        current_project.twitter = i["twitter"]
        current_project.facebook = i["facebook"]
        current_project.googleplus = i["googleplus"]
        current_project.instagram = i["instagram"]
        current_project.status = i["status"]
        current_project.version = i["version"]
        current_project.faq = i["faq"]
        current_project.scope = i["scope"]
        current_project.community = i["community"]
        current_project.lookingfor = i["lookingfor"]
        current_project.cover = i["cover"]
        url = project_url + str(current_project.id)
        current_project.url = url
        # Add the project
        projects[current_project.id] = current_project

    # Return a dictiornary / json
    if format.lower() == "dict" or format.lower() == "json":
        output = {}
        for j in projects:
            project_dict = projects[j].__dict__
            # Convert the lab from a Fab Lab object to a dict
            if project_dict["lab"] is not None:
                project_dict["lab"] = project_dict["lab"].__dict__
            output[j] = project_dict
    # Return a geojson, only for projects linked to a lab
    elif format.lower() == "geojson" or format.lower() == "geo":
        projects_list = []
        for p in projects:
            if projects[p].lab_id is not None:
                single_project = projects[p].__dict__
                if projects[p].lab is not None:
                    single_project["lab"] = single_project["lab"].__dict__
                for l in fablabs:
                    single_lab = fablabs[l].__dict__
                    if single_lab["id"] == single_project["lab_id"]:
                        project_lab = Feature(
                            type="Feature",
                            geometry=Point((single_lab["latitude"],
                                            single_lab["longitude"])),
                            properties=single_project)
                        projects_list.append(project_lab)
                output = dumps(FeatureCollection(projects_list))
    # Return an object
    elif format.lower() == "object" or format.lower() == "obj":
        output = projects
    # Default: return an object
    else:
        output = projects
    # Return a proper json
    if format.lower() == "json":
        output = json.dumps(output)
    return output
894037
def projects(self):
        
        r_json = self._get_json('project')
        projects = [Project(
            self._options, self._session, raw_project_json) for raw_project_json in r_json]
        return projects
186468
public LinkedList<Project> getProjects() {
	    if(projects != null) return projects;
	    try
	    {
	        projects = new LinkedList<Project>(getService().getAllProjects());
	        projectName = projectName == null ?  projects.iterator().next().getName() : projectName;
	        
	        return projects;
	    }
	    catch (GreenPepperServerException e)
	    {
	        addActionError(e.getId());
	    }
	    
	    return projects;
	}
965725
def _get_project(msg, key='project'):
    ''' 
    '''
    project = msg[key]['name']
    ns = msg[key].get('namespace')
    if ns:
        project = '/'.join([ns, project])
    if msg[key]['parent']:
        user = msg[key]['user']['name']
        project = '/'.join(['fork', user, project])
    return project
797669
def avail_projects(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudException(
            'The avail_projects function must be called with -f or --function.'
        )

    vm_ = get_configured_provider()
    manager = packet.Manager(auth_token=vm_['token'])

    ret = {}

    for project in manager.list_projects():
        ret[project.name] = project.__dict__

    return ret
218539
private List<SimplifiedProject> toSimplifiedProjects(final List<Project> projects) {
    final List<SimplifiedProject> simplifiedProjects = new ArrayList<>();
    for (final Project p : projects) {
      final SimplifiedProject sp =
          new SimplifiedProject(p.getId(), p.getName(),
              p.getLastModifiedUser(), p.getCreateTimestamp(),
              p.getUserPermissions(), p.getGroupPermissions());
      simplifiedProjects.add(sp);
    }
    return simplifiedProjects;
  }
1018407
def shared(self) -> typing.Union[None, SharedCache]:
        """"""
        return self._project.shared if self._project else None
1238884
def get_project_export(self, project_id):
        
        try:
            result = self._request('/getprojectexport/',
                                   {'projectid': project_id})
            return TildaProject(**result)
        except NetworkError:
            return []
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
864205
def get_project(self, project_short_name):
        """"""
        project = pbclient.find_project(short_name=project_short_name,
                                        all=self.all)
        if (len(project) == 1):
            return project[0]
        else:
            raise ProjectNotFound(project_short_name)
655012
def project_path(cls, user, project):
        """"""
        return google.api_core.path_template.expand(
            "users/{user}/projects/{project}", user=user, project=project
        )