Creates PR and returns PR number
343937
async function createPr(
  branchName,
  title,
  description,
  labels,
  useDefaultBranch = true
) {
  // labels is not supported in Bitbucket: https://bitbucket.org/site/master/issues/11976/ability-to-add-labels-to-pull-requests-bb

  const base = useDefaultBranch ? config.defaultBranch : config.baseBranch;

  logger.debug({ repository: config.repository, title, base }, 'Creating PR');

  const body = {
    title,
    description,
    source: {
      branch: {
        name: branchName,
      },
    },
    destination: {
      branch: {
        name: base,
      },
    },
    close_source_branch: true,
  };

  const prInfo = (await api.post(
    `/2.0/repositories/${config.repository}/pullrequests`,
    { body }
  )).body;
  const pr = { number: prInfo.id, displayNumber: `Pull Request #${prInfo.id}` };
  // istanbul ignore if
  if (config.prList) {
    config.prList.push(pr);
  }
  return pr;
}
38643
def _create_record(self, rtype, name, content):
        """"""
        # check if record already exists
        existing_records = self._list_records(rtype, name, content)
        if len(existing_records) >= 1:
            return True

        record = {
            "record_type": rtype,
            "name": self._relative_name(name),
            "content": content,
        }
        if self._get_lexicon_option("ttl"):
            record["ttl"] = self._get_lexicon_option("ttl")
        if self._get_lexicon_option("priority"):
            record["prio"] = self._get_lexicon_option("priority")

        payload = self._post(
            "/v1/domains/{0}/records".format(self.domain),
            {"record": record},
        )

        status = "id" in payload.get("record", {})
        LOGGER.debug("create_record: %s", status)
        return status
729390
def _get_post_data_to_create_dns_entry(self, rtype, name, content, identifier=None):
        
        is_update = identifier is not None
        if is_update:
            records = self._list_records_internal(identifier=identifier)
            assert len(records) == 1, 'ID is not unique or does not exist'
            record = records[0]
            LOGGER.debug('Create post data to update record: %s', record)

        data = {
            'id': str(identifier) if is_update else '',
            'action': 'save',
            'name': name,
            'type': rtype,
            'content': content,
            'prio': str(record['priority']) if is_update else '10',
            'ttl': str(record['ttl']) if is_update else '360',
            'commit': ''
        }
        ttl = self._get_lexicon_option('ttl')
        if ttl and ttl > 360:
            data['ttl'] = str(ttl)

        prio = self._get_lexicon_option('priority')
        if prio and prio > 0:
            data['prio'] = str(prio)

        return data
255183
function create(req, res, next) {
  var body = req.body
    , slug = string.slugify(body.title);

  db.tags.findBySlug(slug, function(err, tag) {
    if(err && err.statusCode != 404) { return next(err); }

    if(tag) {
      res.json(201, tag);
    } else {
      db.tags.create(req.body, function(err, tag) {
        if(err) {
          next(err);
        } else {
          res.json(201, tag);
          signals.emit('tag:create', tag);
        }
      });
    }
  });
}
1072418
def _create(self, uri, body, return_none=False, return_raw=False,
            return_response=None, **kwargs):
        
        self.run_hooks("modify_body_for_create", body, **kwargs)
        resp, resp_body = self.api.method_post(uri, body=body)
        if return_none:
            # No response body
            return
        elif return_response:
            return resp
        elif return_raw:
            if self.response_key:
                return resp_body[self.response_key]
            else:
                return resp_body
        return self.resource_class(self, resp_body, self.response_key)
1072290
def prt_num_sig(self, prt=sys.stdout, alpha=0.05):
        """"""
        ctr = self.get_num_sig(alpha)
        prt.write("{N:6,} TOTAL: {TXT}\n".format(N=len(self.nts), TXT=" ".join([
            "FDR({FDR:4})".format(FDR=ctr['FDR']),
            "Bonferroni({B:4})".format(B=ctr['Bonferroni']),
            "Benjamini({B:4})".format(B=ctr['Benjamini']),
            "PValue({P:4})".format(P=ctr['PValue']),
            os.path.basename(self.fin_davidchart)])))
520070
def create_prd_file(self):
        '''
        
        '''
        prd_str = ''
        prd_str += '--INDIVIDUAL\n'
        prd_str += '%s 1 %s cwa\n' % (self.db.target_table, self.db.target_table)
        prd_str += '--STRUCTURAL\n'
        for ftable, ptable in self.db.reverse_fkeys.items():
            prd_str += '%s2%s 2 1:%s *:%s 1 cwa li\n' % (ptable, ftable[0], ptable, ftable[0])
        prd_str += '--PROPERTIES\n'
        prd_str += 'class 2 %s #class cwa\n' % self.db.target_table
        for table, cols in self.db.cols.items():
            for col in cols:
                if col != self.db.pkeys[table] and col not in self.db.fkeys[table] and (
                                table != self.db.target_table or col != self.db.target_att):
                    prd_str += '%s_%s 2 %s #%s_%s 1 cwa\n' % (table, col, table, table, col)
        return prd_str
479350
def pr(self, script=False, expanded=False, verbose=False) -> str:
        
        if verbose:
            ret_str = self.listformat.format(self.idx, str(self).rstrip())
            if self != self.expanded:
                ret_str += self.ex_listformat.format(self.idx, self.expanded.rstrip())
        else:
            if script:
                # display without entry numbers
                if expanded or self.statement.multiline_command:
                    ret_str = self.expanded.rstrip()
                else:
                    ret_str = str(self)
            else:
                # display a numbered list
                if expanded or self.statement.multiline_command:
                    ret_str = self.listformat.format(self.idx, self.expanded.rstrip())
                else:
                    ret_str = self.listformat.format(self.idx, str(self).rstrip())
        return ret_str
871852
def post(self, param, h, r):
        '''
        
        '''
        try:
            rsp = self.client().post(self.uri(), param)
            # print(rsp)
            return self.result(rsp, h, r)
        except ValueError as err:
            return h.catch_exception(err, r)
350172
def make_number(num: str, repr_: str = None, speak: str = None):
    
    if not num or is_unknown(num):
        return
    # Check CAVOK
    if num == 'CAVOK':
        return Number('CAVOK', 9999, 'ceiling and visibility ok')  # type: ignore
    # Check special
    if num in SPECIAL_NUMBERS:
        return Number(repr_ or num, None, SPECIAL_NUMBERS[num])  # type: ignore
    # Create Fraction
    if '/' in num:
        nmr, dnm = [int(i) for i in num.split('/')]
        unpacked = unpack_fraction(num)
        spoken = spoken_number(unpacked)
        return Fraction(repr_ or num, nmr / dnm, spoken, nmr, dnm, unpacked)  # type: ignore
    # Create Number
    val = num.replace('M', '-')
    val = float(val) if '.' in num else int(val)  # type: ignore
    return Number(repr_ or num, val, spoken_number(speak or str(val)))
612521
def info():
    """"""
    print("convenience function for listing prms")
    print(type(prms))
    print(prms.__name__)
    print(f"prm file: {_get_prm_file()}")

    for key in prms.__dict__:
        if isinstance(prms.__dict__[key], box.Box):
            print()
            print(80 * "=")
            print(f"prms.{key}:")
            print(80 * "-")
            for subkey in prms.__dict__[key]:
                print(
                    f"prms.{key}.{subkey} = ",
                    f"{prms.__dict__[key][subkey]}"
                )
            print(80 * "=")
899377
def _create_old_return_value(payload, num_ints, buff):
    """"""

    parsed = {'ints': payload[:num_ints], 'buffer': None, 'error': 'No Error',
              'is_error': False, 'return_value': 0}

    if buff:
        parsed['buffer'] = bytearray(payload[-1])

    return parsed
1199958
def create_user(post_data):
        '''
        
        '''
        out_dic = {'success': False, 'code': '00'}

        if not tools.check_username_valid(post_data['user_name']):
            out_dic['code'] = '11'
            return out_dic

        if not tools.check_email_valid(post_data['user_email']):
            out_dic['code'] = '21'
            return out_dic

        try:
            TabMember.create(uid=tools.get_uuid(),
                             user_name=post_data['user_name'],
                             user_pass=tools.md5(post_data['user_pass']),
                             user_email=post_data['user_email'],
                             role='1000',  # ‘1000' as default role.
                             time_create=tools.timestamp(),
                             time_update=tools.timestamp(),
                             time_reset_passwd=tools.timestamp(),
                             time_login=tools.timestamp(),
                             time_email=tools.timestamp())

            out_dic['success'] = True
        except:
            out_dic['code'] = '91'
        return out_dic
790374
@Override
    public PreReleaseInformationMessage createPRI() {
        PreReleaseInformationMessage msg = new PreReleaseInformationMessageImpl(_PRI_HOLDER.mandatoryCodes, _PRI_HOLDER.mandatoryVariableCodes,
                _PRI_HOLDER.optionalCodes, _PRI_HOLDER.mandatoryCodeToIndex, _PRI_HOLDER.mandatoryVariableCodeToIndex,
                _PRI_HOLDER.optionalCodeToIndex);
        return msg;
    }
947790
def create(self, num):
        
        self.log.record_process('enviroment.py', 'Creating ' + str(num) + ' environments - ' + self.name)
594270
async function findPr(branchName, prTitle, state = 'all', refreshCache) {
  logger.debug(`findPr(${branchName}, "${prTitle}", "${state}")`);
  const prList = await getPrList({ refreshCache });
  const pr = prList.find(isRelevantPr(branchName, prTitle, state));
  if (pr) {
    logger.debug(`Found PR #${pr.number}`);
  } else {
    logger.debug(`DID NOT Found PR from branch #${branchName}`);
  }
  return pr;
}
768272
def create_307_response(self):
        
        request = get_current_request()
        msg_mb = UserMessageMember(self.message)
        coll = request.root['_messages']
        coll.add(msg_mb)
        # Figure out the new location URL.
        qs = self.__get_new_query_string(request.query_string,
                                         self.message.slug)
        resubmit_url = "%s?%s" % (request.path_url, qs)
        headers = [('Warning', '299 %s' % self.message.text),
#                       ('Content-Type', cnt_type),
                   ]
        http_exc = HttpWarningResubmit(location=resubmit_url,
                                       detail=self.message.text,
                                       headers=headers)
        return request.get_response(http_exc)