Returns an existing emulator instance for the provided project_id.

    If an emulator instance doesn't yet exist, it creates one.

    Args:
      project_id: project ID

    Returns:
      a DatastoreEmulator
554876
def Get(self, project_id):
    
    if project_id in self._emulators:
      return self._emulators[project_id]

    emulator = self.Create(project_id)
    self._emulators[project_id] = emulator
    return emulator
290021
def create_project(self, name, description=None):
        
        description = description or ''
        data = self._run(
            url_path="projects/add",
            name=name,
            description=description
        )
        return data['result']['project']['id']
107945
private File getProjectDir(String projectId, boolean create) throws IOException {
        File projectDir = new File(getKeenCacheDirectory(), projectId);
        if (create && !projectDir.exists()) {
            KeenLogging.log("Cache directory for project '" + projectId + "' doesn't exist. " +
                    "Creating it.");
            if (!projectDir.mkdirs()) {
                throw new IOException("Could not create project cache directory '" +
                        projectDir.getAbsolutePath() + "'");
            }
        }
        return projectDir;
    }
262056
def _update_project(self, project_name):
        ''''''
        project = self.projectdb.get(project_name)
        if not project:
            return None
        return self._load_project(project)
281548
def add_project(self, project_id=None, name=None, **kwargs):
        
        if project_id not in self._projects:

            for project in self._projects.values():
                if name and project.name == name:
                    raise aiohttp.web.HTTPConflict(text='Project name "{}" already exists'.format(name))
            project = Project(project_id=project_id, controller=self, name=name, **kwargs)
            self._projects[project.id] = project
            return self._projects[project.id]
        return self._projects[project_id]
1294595
public function enableProjects($enable, $project_id)
    {
        $enable = $enable === 'true';

        $projects = $project_id == 'all'
            ? Project::all()
            : Project::where('id', $project_id)->get();

        foreach ($projects as $test) {
            $this->enableProject($enable, $test);
        }

        return $enable;
    }
1181640
def get_connected_services(self, project_id, kind=None):
        
        route_values = {}
        if project_id is not None:
            route_values['projectId'] = self._serialize.url('project_id', project_id, 'str')
        query_parameters = {}
        if kind is not None:
            query_parameters['kind'] = self._serialize.query('kind', kind, 'str')
        response = self._send(http_method='GET',
                              location_id='b4f70219-e18b-42c5-abe3-98b07d35525e',
                              version='5.0-preview.1',
                              route_values=route_values,
                              query_parameters=query_parameters)
        return self._deserialize('[WebApiConnectedService]', self._unwrap_collection(response))
1046606
def create_version(self, project_id_or_key, version_name, extra_request_params={}):
        
        request_params = extra_request_params
        request_params["name"] = version_name
        return self.do("POST", "projects/{project_id_or_key}/versions",
                       url_params={"project_id_or_key": project_id_or_key},
                       request_params=request_params,
                       )
803842
def take_dynamips_id(self, project_id, dynamips_id):
        
        self._dynamips_ids.setdefault(project_id, set())
        if dynamips_id in self._dynamips_ids[project_id]:
            raise DynamipsError("Dynamips identifier {} is already used by another router".format(dynamips_id))
        self._dynamips_ids[project_id].add(dynamips_id)
424513
def _get_project_id(self):
        
        fpath = os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', None)
        if fpath is None:
            raise Exception('ERROR: No project ID specified, and '
                            'GOOGLE_APPLICATION_CREDENTIALS env var is not set')
        fpath = os.path.abspath(os.path.expanduser(fpath))
        logger.debug('Reading credentials file at %s to get project_id', fpath)
        with open(fpath, 'r') as fh:
            cred_data = json.loads(fh.read())
        return cred_data['project_id']
665827
def get_default_id(credentials=None):
    
    project_id = _utils.get_project_id()
    if project_id is None:
      projects, _ = Projects(credentials)._retrieve_projects(None, 2)
      if len(projects) == 1:
        project_id = projects[0].id
    return project_id
1033413
def project(project_id, opts = {})
      data, _status_code, _headers = project_with_http_info(project_id, opts)
      return data
    end
920152
def view_project_details(self, project_id):
        
        data = self._run(
            url_path="projects/view",
            id=project_id
        )
        return self._project_formatter(data['result']['project'])
31932
def object_exists_in_project(obj_id, proj_id):
    '''
    
    '''
    if obj_id is None:
        raise ValueError("Expected obj_id to be a string")
    if proj_id is None:
        raise ValueError("Expected proj_id to be a string")
    if not is_container_id(proj_id):
        raise ValueError('Expected %r to be a container ID' % (proj_id,))
    return try_call(dxpy.DXHTTPRequest, '/' + obj_id + '/describe', {'project': proj_id})['project'] == proj_id
1018041
def get(ctx, resource, id):
    
    session, api_url, project_id = build_client_from_context(ctx)
    url = '/'.join([api_url, resource, id])
    r = session.get(url)
    if r.status_code != 200:
        raise failed_request_exception('Failed to get resource', r)

    response = json.loads(r.text)
    if resource == 'deviceModels':
        pretty_print_model(response)
    elif resource == 'devices':
        pretty_print_device(response)
    logging.debug(r.text)
606144
function (data, id) {
            if (!data || !this.projectPath) {
                return;
            }

            if (data[this.projectPath] && (data[this.projectPath][id] !== undefined)) {
                return data[this.projectPath][id];
            }
            return;
        }
604779
def get_project(id=None, name=None):
    
    content = get_project_raw(id, name)
    if content:
        return utils.format_json(content)