Create prov entities and activities.
766983
def export(self, nidm_version, export_dir):
        
        if nidm_version['num'] in ["1.0.0", "1.1.0"]:
            self.label = self.label.replace("Supra-Threshold", "Significant")

        # FIXME deal with multiple contrasts
        atts = (
            (PROV['type'], NIDM_SIGNIFICANT_CLUSTER),
            (PROV['label'], self.label),
            (NIDM_CLUSTER_LABEL_ID, self.num),
            (NIDM_CLUSTER_SIZE_IN_VOXELS, self.size)
            )

        if self.clust_size_resels is not None:
            atts = atts + (
                (NIDM_CLUSTER_SIZE_IN_RESELS, self.clust_size_resels),
                )

        if self.punc is not None:
            atts = atts + (
                (NIDM_P_VALUE_UNCORRECTED,
                    Literal(self.punc, datatype=XSD_FLOAT)),
                )

        if self.pFDR is not None:
            atts = atts + (
                (NIDM_Q_VALUE_FDR, Literal(self.pFDR, datatype=XSD_FLOAT)),
                )

        if self.pFWER is not None:
            atts = atts + (
                (NIDM_P_VALUE_FWER, Literal(self.pFWER, datatype=XSD_FLOAT)),
                )

        self.add_attributes(atts)
898024
def create_loadfile(entities, f):
        """"""
        with open(f, 'w') as out:
            out.write(Entity.create_payload(entities))
458767
def create(self):
        """"""

        self.before_create()

        puts(green('Creating app context'))
        tdir = os.path.dirname(__file__)

        # Ensure the app context user exists
        user_ensure(self.user, home='/home/' + self.user)
        dir_ensure('/home/%s/.ssh' % self.user)

        t = '/home/%s/.ssh/authorized_keys'
        app_authorized_keys = t % env.user
        ctx_authorized_keys = t % self.user

        # Ensure the app user has the same authorized_keys as the admin user
        if file_exists(app_authorized_keys) and \
           not file_exists(ctx_authorized_keys):
            sudo('cp %s %s' % (app_authorized_keys, ctx_authorized_keys))
            file_attribs(ctx_authorized_keys, mode=755,
                         owner=self.user, group=self.user)

        # Actions to be performed with the app context user
        with settings(user=self.user):
            # Make sure the dot files exist
            # This is mostly necessary for virtualenvwrapper to work properly
            for f in ['bashrc', 'bash_profile', 'profile']:
                lfn = os.path.join(tdir, 'templates', '%s.tmpl' % f)
                contents = file_local_read(lfn) % self.__dict__
                rfn = '/home/%s/.%s' % (self.user, f)
                file_ensure(rfn, owner=self.user, group=self.user)
                file_update(rfn, lambda _: contents)

            # Make sure the sites folder exists
            dir_ensure('/home/%s/sites' % self.user)

            # Make sure the app's required folders exist
            for d in [self.root_dir, self.releases_dir, self.etc_dir,
                      self.log_dir, self.run_dir, self.shared_dir]:
                dir_ensure(d)

            # Create the virtualenv
            run('mkvirtualenv ' + self.name)

        self.after_create()
524315
public function createFixtures()
    {
        /**
         * Bundle fixtures
         */
        if($this->container->getParameter('core.fixtures_bundle')){
            $this->runSqlScript('Country.sql');
            $this->runSqlScript('State.sql');
            //$this->runSqlScript('PostalCode.sql');
            $this->runSqlScript('Translation.sql');

            //get dinamic actor class
            $actorClass = $this->container->get('core_manager')->getActorClass();

            $factory = $this->get('security.encoder_factory');
            $encoder = $factory->getEncoder(new $actorClass());

            //Roles
            $userRole = new Role();
            $userRole->setName('user');
            $userRole->setRole(Role::USER);
            $this->getManager()->persist($userRole);

            $managerRole = new Role();
            $managerRole->setName('manager');
            $managerRole->setRole(Role::MANAGER);
            $this->getManager()->persist($managerRole);

            $companyRole = new Role();
            $companyRole->setName('company');
            $companyRole->setRole(Role::COMPANY);
            $this->getManager()->persist($companyRole);

            $adminRole = new Role();
            $adminRole->setName('admin');
            $adminRole->setRole(Role::ADMIN);
            $this->getManager()->persist($adminRole);

            $superRole = new Role();
            $superRole->setName('root');
            $superRole->setRole(Role::SUPER_ADMIN);
            $this->getManager()->persist($superRole);

            $this->getManager()->flush();

             //User root
            $password = 'root';
            $root = new BaseUser();
            $root->setUsername('root');
            $root->setEmail('root@latinotype.com');
            $root->addRole($superRole);
            $encodePassword = $encoder->encodePassword($password, $root->getSalt());
            $root->setPassword($encodePassword);
            $root->setName('Root');
            $root->setActive(true);
            $this->getManager()->persist($root);
            
            $this->getManager()->flush();
            
            /**
             * Add Parameters
             */
            $this->addParameters();

        }
        
        /**
         * Dev fixtures
         */
        if($this->container->getParameter('core.fixtures_dev')){
            //User admin
            $password = 'admin';
            $admin = new $actorClass();
            $admin->setUsername('admin');
            $admin->setEmail('admin@admin.com');
            $admin->addRole($adminRole);
            $encodePassword = $encoder->encodePassword($password, $admin->getSalt());
            $admin->setPassword($encodePassword);
            $admin->setName('Admin');
            $admin->setLastname('Lastname');
            $admin->setActive(true);
            $this->getManager()->persist($admin);

            $password2 = 'company';
            $company = new $actorClass();
            $company->setUsername('company');
            $company->setEmail('company@latinotype.com');
            $company->addRole($companyRole);
            $encodePassword2 = $encoder->encodePassword($password2, $company->getSalt());
            $company->setPassword($encodePassword2);
            $company->setName('Company');
            $company->setLastname('Lastname');
            $company->setActive(true);
            $this->getManager()->persist($company);

            $password = 'user';
            $user = new $actorClass();
            $user->setUsername('user');
            $user->setEmail('user@user.com');
            $user->addRole($userRole);
            $encodePassword = $encoder->encodePassword($password, $user->getSalt());
            $user->setPassword($encodePassword);
            $user->setName('User');
            $user->setLastname('Lastname');
            $user->setActive(true);
            $this->getManager()->persist($user);

            $password2 = 'user2';
            $user2 = new $actorClass();
            $user2->setUsername('user2');
            $user2->setEmail('user2@user2.com');
            $user2->addRole($userRole);
            $encodePassword2 = $encoder->encodePassword($password2, $user2->getSalt());
            $user2->setPassword($encodePassword2);
            $user2->setName('User2');
            $user2->setLastname('Lastname2');
            $user2->setActive(true);
            $this->getManager()->persist($user2);

            $this->getManager()->flush();
        }
        
    }
1008660
def create_entity_type(project_id, display_name, kind):
    """"""
    import dialogflow_v2 as dialogflow
    entity_types_client = dialogflow.EntityTypesClient()

    parent = entity_types_client.project_agent_path(project_id)
    entity_type = dialogflow.types.EntityType(
        display_name=display_name, kind=kind)

    response = entity_types_client.create_entity_type(parent, entity_type)

    print('Entity type created: \n{}'.format(response))
716903
public function create()
    {
        event(new BeforeCreate($this));

        $this->beforeCreate();

        $this->doCreate();

        $this->afterCreate();

        event(new AfterCreate($this));
    }
597874
def generate_entities(ctx, output_path, mtz_file, exclude_namespace, namespace, maltego_entities, append, entity):
    """"""
    from canari.commands.generate_entities import generate_entities
    generate_entities(
        ctx.project, output_path, mtz_file, exclude_namespace, namespace, maltego_entities, append, entity)
50239
def _create(self):
        """"""
        if self.readonly:
            raise VirtualenvReadonlyException()
        args = ['virtualenv']
        if self.system_site_packages:
            args.append('--system-site-packages')
        if self.python is None:
            args.append(self.name)
        else:
            args.extend(['-p', self.python, self.name])
        proc = subprocess.Popen(args, cwd=self.root, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        output, error = proc.communicate()
        returncode = proc.returncode
        if returncode:
            raise VirtualenvCreationException((returncode, output, self.name))
        self._write_to_log(output, truncate=True)
        self._write_to_error(error, truncate=True)
1197000
def _init_proc(self):
        """"""
        if not self.proc:
            self.proc = [
                mp.Process(target=self._proc_loop, args=(i, self.alive, self.queue, self.fn))
                for i in range(self.num_proc)
            ]
            self.alive.value = True
            for p in self.proc:
                p.start()
298364
def create_iam(self):
        """"""
        utils.banner("Creating IAM")
        iam.create_iam_resources(env=self.env, app=self.app)
397161
public function createAction()
    {
        if ($this->enableScreens) {
            $edit = false;
            $org  = $this->getRespondent()->getOrganization();
            if (! $org) {
                $org = $this->currentOrganization;
            }

            if ($org) {
                $edit = $org->getRespondentEditScreen();
            }

            if (! $edit) {
                $group = $this->currentUser->getGroup();
                if ($group) {
                    $edit = $group->getRespondentEditScreen();
                }
            }

            if ($edit ) {
                if ($edit instanceof ProcessModelInterface) {
                    $edit->processModel($this->getModel());
                }

                // All are arrays, so easy to set
                $this->createParameters = $edit->getCreateParameters() + $this->createParameters;
                $editSnippets = $edit->getSnippets();
                if (false !== $editSnippets) {
                    $this->createEditSnippets = $editSnippets;
                }
            }
        }

        parent::createAction();
    }
287269
def create(self):
        
        # Calls each of these methods in order.  _populate_from_lines and
        # _update_relations must be implemented in subclasses.
        self._init_tables()
        self._populate_from_lines(self.iterator)
        self._update_relations()
        self._finalize()
119311
def create(self):
        
        steps = [
            (self.create_role, (), {}),
            (self.create_vpc, (), {}),
            (self.create_cluster, (), {}),
            (self.create_node_group, (), {}),
            (self.create_spot_nodes, (), {}),
            (self.create_utilities, (), {}),
        ]
        # Execute creation.
        for step in tqdm.tqdm(steps, ncols=70):
            method, args, kwargs = step
            method(*args, **kwargs)
7926
protected function build()
    {
        $operation = $this->buildOperation('DeleteProfile');

        $merchantID = $this->document->createElement(
            'merchantID',
            $this->merchantId
        );
        $operation->appendChild($merchantID);

        $customerId = $this->document->createElement(
            'customerID',
            $this->customerId
        );
        $operation->appendChild($customerId);

        if ($this->profileId) {
            $profileId = $this->document->createElement(
                'profileID',
                $this->profileId
            );
            $operation->appendChild($profileId);
        }
    }
946452
def create(self):
        """"""
        # url('datastores')
        content = request.environ['wsgi.input'].read(int(request.environ['CONTENT_LENGTH']))
        content = content.decode('utf8')
        content = simplejson.loads(content)
        new = DataStore(content['name'],
                        content['type'],
                        content['ogrstring'])
        results = meta.Session.add(new)
        meta.Session.commit()
        response.status = 201
292577
def finalize_prov_profile(self, name):
        # type: (Optional[Text]) -> List[Identifier]
        """"""
        # NOTE: Relative posix path
        if name is None:
            # master workflow, fixed filenames
            filename = "primary.cwlprov"
        else:
            # ASCII-friendly filename, avoiding % as we don't want %2520 in manifest.json
            wf_name = urllib.parse.quote(str(name), safe="").replace("%", "_")
            # Note that the above could cause overlaps for similarly named
            # workflows, but that's OK as we'll also include run uuid
            # which also covers thhe case of this step being run in
            # multiple places or iterations
            filename = "%s.%s.cwlprov" % (wf_name, self.workflow_run_uuid)

        basename = posixpath.join(_posix_path(PROVENANCE), filename)

        # TODO: Also support other profiles than CWLProv, e.g. ProvOne

        # list of prov identifiers of provenance files
        prov_ids = []

        # https://www.w3.org/TR/prov-xml/
        with self.research_object.write_bag_file(basename + ".xml") as provenance_file:
            self.document.serialize(provenance_file, format="xml", indent=4)
            prov_ids.append(self.provenance_ns[filename + ".xml"])

        # https://www.w3.org/TR/prov-n/
        with self.research_object.write_bag_file(basename + ".provn") as provenance_file:
            self.document.serialize(provenance_file, format="provn", indent=2)
            prov_ids.append(self.provenance_ns[filename + ".provn"])

        # https://www.w3.org/Submission/prov-json/
        with self.research_object.write_bag_file(basename + ".json") as provenance_file:
            self.document.serialize(provenance_file, format="json", indent=2)
            prov_ids.append(self.provenance_ns[filename + ".json"])

        # "rdf" aka https://www.w3.org/TR/prov-o/
        # which can be serialized to ttl/nt/jsonld (and more!)

        # https://www.w3.org/TR/turtle/
        with self.research_object.write_bag_file(basename + ".ttl") as provenance_file:
            self.document.serialize(provenance_file, format="rdf", rdf_format="turtle")
            prov_ids.append(self.provenance_ns[filename + ".ttl"])

        # https://www.w3.org/TR/n-triples/
        with self.research_object.write_bag_file(basename + ".nt") as provenance_file:
            self.document.serialize(provenance_file, format="rdf", rdf_format="ntriples")
            prov_ids.append(self.provenance_ns[filename + ".nt"])

        # https://www.w3.org/TR/json-ld/
        # TODO: Use a nice JSON-LD context
        # see also https://eprints.soton.ac.uk/395985/
        # 404 Not Found on https://provenance.ecs.soton.ac.uk/prov.jsonld :(
        with self.research_object.write_bag_file(basename + ".jsonld") as provenance_file:
            self.document.serialize(provenance_file, format="rdf", rdf_format="json-ld")
            prov_ids.append(self.provenance_ns[filename + ".jsonld"])

        _logger.debug(u"[provenance] added provenance: %s", prov_ids)
        return prov_ids
344377
def do_create(marfile, files, compress, productversion=None, channel=None,
              signing_key=None, signing_algorithm=None):
    """"""
    with open(marfile, 'w+b') as f:
        with MarWriter(f, productversion=productversion, channel=channel,
                       signing_key=signing_key,
                       signing_algorithm=signing_algorithm,
                       ) as m:
            for f in files:
                m.add(f, compress=compress)