Generate project (snapshot) signature

		:param resource_provider: project provider
		:type  resource_provider: dict
		:param resource: project resource
		:type  resource: ProjectResource
974622
def generate(self, resource_provider, resource):
		
		provider = resource_provider["provider"]
		if provider == "github":
			return self.generateGithubRepositorySignature(resource_provider, resource)
		if provider == "bitbucket":
			return self.generateBitbucketRepositorySignature(resource_provider, resource)
		if provider == "googlecode":
			return self.generateGooglecodeRepositorySignature(resource_provider, resource)
		if provider == "fedora":
			return self.generateFedoraDistributionPackageSignature(resource_provider, resource)
717288
def snapshot(self, scheduler=None):
    
    if isinstance(self._sources, EagerFilesetWithSpec):
      snapshot = self._sources.snapshot
      if snapshot is not None:
        return snapshot
    input_pathglobs = PathGlobs(tuple(self.relative_to_buildroot()))
    return scheduler.product_request(Snapshot, [input_pathglobs])[0]
994381
def add_project(project,**kwargs):
    
    user_id = kwargs.get('user_id')

    existing_proj = get_project_by_name(project.name,user_id=user_id)

    if len(existing_proj) > 0:
        raise HydraError("A Project with the name \"%s\" already exists"%(project.name,))

    #check_perm(user_id, 'add_project')
    proj_i = Project()
    proj_i.name = project.name
    proj_i.description = project.description
    proj_i.created_by = user_id

    attr_map = hdb.add_resource_attributes(proj_i, project.attributes)
    db.DBSession.flush() #Needed to get the resource attr's ID
    proj_data = _add_project_attribute_data(proj_i, attr_map, project.attribute_data)
    proj_i.attribute_data = proj_data

    proj_i.set_owner(user_id)

    db.DBSession.add(proj_i)
    db.DBSession.flush()

    return proj_i
580836
def restore(self):
        

        yield from self._project.delete_on_computes()
        # We don't send close notif to clients because the close / open dance is purely internal
        yield from self._project.close(ignore_notification=True)
        self._project.controller.notification.emit("snapshot.restored", self.__json__())
        try:
            if os.path.exists(os.path.join(self._project.path, "project-files")):
                shutil.rmtree(os.path.join(self._project.path, "project-files"))
            with open(self._path, "rb") as f:
                project = yield from import_project(self._project.controller, self._project.id, f, location=self._project.path)
        except (OSError, PermissionError) as e:
            raise aiohttp.web.HTTPConflict(text=str(e))
        yield from project.open()
        return project
798156
def create(self, project, email, role, **attrs):
        
        attrs.update({'project': project, 'email': email, 'role': role})
        return self._new_resource(payload=attrs)
793747
def generate(self, projectpath, parameters, serviceid, servicename,serviceurl):
        

        #Make dictionary of parameters
        parameters = sanitizeparameters(parameters)

        program = Program(projectpath, [self])

        match, optional_absent = self.match(projectpath, parameters) #Does the profile match?
        if match: #pylint: disable=too-many-nested-blocks

            #gather all input files that match
            inputfiles = self.matchingfiles(projectpath) #list of (seqnr, filename,inputtemplate) tuples

            inputfiles_full = [] #We need the full CLAMInputFiles for generating provenance data
            for seqnr, filename, inputtemplate in inputfiles: #pylint: disable=unused-variable
                inputfiles_full.append(CLAMInputFile(projectpath, filename))

            for outputtemplate in self.output:
                if isinstance(outputtemplate, ParameterCondition):
                    outputtemplate = outputtemplate.evaluate(parameters)

                #generate output files
                if outputtemplate:
                    if isinstance(outputtemplate, OutputTemplate):
                        #generate provenance data
                        provenancedata = CLAMProvenanceData(serviceid,servicename,serviceurl,outputtemplate.id, outputtemplate.label,  inputfiles_full, parameters)

                        create = True
                        if outputtemplate.parent:
                            if outputtemplate.getparent(self) in optional_absent:
                                create = False

                        if create:
                            for inputtemplate, inputfilename, outputfilename, metadata in outputtemplate.generate(self, parameters, projectpath, inputfiles, provenancedata):
                                clam.common.util.printdebug("Writing metadata for outputfile " + outputfilename)
                                metafilename = os.path.dirname(outputfilename)
                                if metafilename: metafilename += '/'
                                metafilename += '.' + os.path.basename(outputfilename) + '.METADATA'
                                f = io.open(projectpath + '/output/' + metafilename,'w',encoding='utf-8')
                                f.write(metadata.xml())
                                f.close()
                                program.add(outputfilename, outputtemplate, inputfilename, inputtemplate)
                    else:
                        raise TypeError("OutputTemplate expected, but got " + outputtemplate.__class__.__name__)

        return program
648609
def join_resource_name(self, v):
        
        d = self.dict
        d['fragment'] = [v, None]
        return MetapackResourceUrl(downloader=self._downloader, **d)
1043608
def delete_project(self, resource):
        
        self.project_service.set_auth(self._token_project)
        self.project_service.delete(resource)
500344
def setup_resource(self):
        
        template = self.template
        variables = self.get_variables()

        tclass = variables['Class']
        tprops = variables['Properties']
        output = variables['Output']

        klass = load_object_from_string('troposphere.' + tclass)

        instance = klass.from_dict('ResourceRefName', tprops)

        template.add_resource(instance)
        template.add_output(Output(
            output,
            Description="A reference to the object created in this blueprint",
            Value=Ref(instance)
        ))
563259
def create_project(self, name, client_id, budget = None, budget_by =
    	'none', notes = None, billable = True):
        ''''''
        project = {'project':{
            'name': name,
            'client_id': client_id,
            'budget_by': budget_by,
            'budget': budget,
            'notes': notes,
            'billable': billable,
        }}
        response = self.post_request('projects/', project, follow = True)
        if response:
            return Project(self, response['project'])
743334
def output(self, resource):
        
        @wraps(resource)
        def wrapper(*args, **kwargs):
            rv = resource(*args, **kwargs)
            rv = self.responder(rv)
            return rv

        return wrapper
317174
ProjectBuildingResult getProjectBuildingResult(MavenModelResource pomResource) throws ProjectBuildingException
   {
      ProjectBuildingResult result = cacheProject.get(pomResource.getFullyQualifiedName());
      if (result == null)
      {
         try
         {
            ProjectBuildingRequest request = getProjectBuildingRequest();
            Assert.notNull(request, "Project building request was null");
            request.setResolveDependencies(true);
            boolean inTransaction = !pomResource.getUnderlyingResourceObject().exists();
            // FORGE-1287
            if (inTransaction)
            {
               result = getProjectBuilder().build(new FileResourceModelSource(pomResource), request);
               // If under a transaction, don't start monitoring
            }
            else
            {
               result = getProjectBuilder().build(pomResource.getUnderlyingResourceObject(), request);
               monitorResource(pomResource);
            }
         }
         catch (ProjectBuildingException pbe)
         {
            List<ProjectBuildingResult> results = pbe.getResults();
            if (results != null && results.size() > 0)
               result = results.get(0);
            throw pbe;
         }
         finally
         {
            if (result != null && !Projects.isCacheDisabled())
               cacheProject.put(pomResource.getFullyQualifiedName(), result);
         }
      }
      return result;
   }
25568
public void copyProviderToCreator(Resource.Provider provider,
                                      Resource.Creator creator) {
        provider.stream().forEach((ConsumerWithThrowable<Resource.Readable, IOException>) resource ->
                copyResourceWithStreams(resource, creator.create(resource.getPath())));
    }
1343555
public ProjectGenerationResponse generate(ProjectGenerationRequest request)
			throws IOException {
		Log.info("Using service at " + request.getServiceUrl());
		InitializrServiceMetadata metadata = loadMetadata(request.getServiceUrl());
		URI url = request.generateUrl(metadata);
		CloseableHttpResponse httpResponse = executeProjectGenerationRequest(url);
		HttpEntity httpEntity = httpResponse.getEntity();
		validateResponse(httpResponse, request.getServiceUrl());
		return createResponse(httpResponse, httpEntity);
	}
181429
def from_api_repr(cls, resource):
        
        name = resource.get("name")
        type_ = resource["parameterType"]["type"]
        value = resource["parameterValue"]["value"]
        converted = _QUERY_PARAMS_FROM_JSON[type_](value, None)
        return cls(name, type_, converted)
829998
def output(self, resource):
        
        @wraps(resource)
        def wrapper(*args, **kwargs):
            resp = resource(*args, **kwargs)
            if isinstance(resp, ResponseBase):  # There may be a better way to test
                return resp
            data, code, headers = unpack(resp)
            return self.make_response(data, code, headers=headers)
        return wrapper
120778
def _generate_url(self, resource, query_params=None):
        
        resource = '{resource}?token={token}'.format(resource=resource, token=self.token)
        if query_params:
            resource += "&{}".format(urlencode(query_params))
        return self.base_url_template.format(resource)