当前位置: 首页>>代码示例>>Python>>正文


Python string.upper方法代码示例

本文整理汇总了Python中string.upper方法的典型用法代码示例。如果您正苦于以下问题:Python string.upper方法的具体用法?Python string.upper怎么用?Python string.upper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在string的用法示例。


在下文中一共展示了string.upper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _initializePOSTables

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def _initializePOSTables():
    global _POSNormalizationTable, _POStoDictionaryTable
    _POSNormalizationTable = {}
    _POStoDictionaryTable = {}
    for pos, abbreviations in (
	    (NOUN, "noun n n."),
	    (VERB, "verb v v."),
	    (ADJECTIVE, "adjective adj adj. a s"),
	    (ADVERB, "adverb adv adv. r")):
	tokens = string.split(abbreviations)
	for token in tokens:
	    _POSNormalizationTable[token] = pos
	    _POSNormalizationTable[string.upper(token)] = pos
    for dict in Dictionaries:
	_POSNormalizationTable[dict] = dict.pos
	_POStoDictionaryTable[dict.pos] = dict 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:18,代码来源:wordnet.py

示例2: name_registration_request

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def name_registration_request(self, nbname, destaddr, qtype, scope, nb_flags=0, nb_address='0.0.0.0'):
        netbios_name = nbname.upper()
        qn_label = encode_name(netbios_name, qtype, scope)

        p = NAME_REGISTRATION_REQUEST()
        p['NAME_TRN_ID'] = randint(1, 32000)
        p['QUESTION_NAME'] = qn_label[:-1]
        p['RR_NAME'] = qn_label[:-1]
        p['TTL'] = 0xffff
        p['NB_FLAGS'] = nb_flags
        p['NB_ADDRESS'] = socket.inet_aton(nb_address)
        if not destaddr:
            p['FLAGS'] |= NM_FLAGS_BROADCAST
            destaddr = self.__broadcastaddr
        req = p.getData()

        res = self.send(p, destaddr, 1)
        return res 
开发者ID:joxeankoret,项目名称:CVE-2017-7494,代码行数:20,代码来源:nmb.py

示例3: name_query_request

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def name_query_request(self, nbname, destaddr = None, qtype = TYPE_SERVER, scope = None, timeout = 1):
        netbios_name = nbname.upper()
        qn_label = encode_name(netbios_name, qtype, scope)

        p = NAME_QUERY_REQUEST()
        p['NAME_TRN_ID'] = randint(1, 32000)
        p['QUESTION_NAME'] = qn_label[:-1]
        p['FLAGS'] = NM_FLAGS_RD
        if not destaddr:
            p['FLAGS'] |= NM_FLAGS_BROADCAST

            destaddr = self.__broadcastaddr
        req = p.getData()

        res = self.send(p, destaddr, timeout)
        return NBPositiveNameQueryResponse(res['ANSWERS']) 
开发者ID:joxeankoret,项目名称:CVE-2017-7494,代码行数:18,代码来源:nmb.py

示例4: node_status_request

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def node_status_request(self, nbname, destaddr, type, scope, timeout):
        netbios_name = string.upper(nbname)
        qn_label = encode_name(netbios_name, type, scope)
        p = NODE_STATUS_REQUEST()
        p['NAME_TRN_ID'] = randint(1, 32000)
        p['QUESTION_NAME'] = qn_label[:-1]

        if not destaddr:
            p['FLAGS'] = NM_FLAGS_BROADCAST
            destaddr = self.__broadcastaddr

        res = self.send(p, destaddr, timeout)
        answ = NBNodeStatusResponse(res['ANSWERS'])
        self.mac = answ.get_mac()
        return answ.entries

################################################################################
# 4.2 SESSION SERVICE PACKETS
################################################################################ 
开发者ID:joxeankoret,项目名称:CVE-2017-7494,代码行数:21,代码来源:nmb.py

示例5: format_option_strings

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def format_option_strings(self, option):
        """Return a comma-separated list of option strings & metavariables."""
        if option.takes_value():
            metavar = option.metavar or string.upper(option.dest)
            short_opts = []
            for sopt in option._short_opts:
                short_opts.append(self._short_opt_fmt % (sopt, metavar))
            long_opts = []
            for lopt in option._long_opts:
                long_opts.append(self._long_opt_fmt % (lopt, metavar))
        else:
            short_opts = option._short_opts
            long_opts = option._long_opts

        if self.short_first:
            opts = short_opts + long_opts
        else:
            opts = long_opts + short_opts

        return string.join(opts, ", ") 
开发者ID:coin3d,项目名称:pivy,代码行数:22,代码来源:SConsOptions.py

示例6: _generateGUID

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def _generateGUID(slnfile, name):
    """This generates a dummy GUID for the sln file to use.  It is
    based on the MD5 signatures of the sln filename plus the name of
    the project.  It basically just needs to be unique, and not
    change with each invocation."""
    m = hashlib.md5()
    # Normalize the slnfile path to a Windows path (\ separators) so
    # the generated file has a consistent GUID even if we generate
    # it on a non-Windows platform.
    m.update(ntpath.normpath(str(slnfile)) + str(name))
    # TODO(1.5)
    #solution = m.hexdigest().upper()
    solution = string.upper(_hexdigest(m.digest()))
    # convert most of the signature to GUID form (discard the rest)
    solution = "{" + solution[:8] + "-" + solution[8:12] + "-" + solution[12:16] + "-" + solution[16:20] + "-" + solution[20:32] + "}"
    return solution 
开发者ID:coin3d,项目名称:pivy,代码行数:18,代码来源:msvs.py

示例7: __connect_tree

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def __connect_tree(self, path, service, password, timeout = None):
        if password:
            # Password is only encrypted if the server passed us an "encryption" during protocol dialect
            # negotiation and mxCrypto's DES module is loaded.
            if self.__enc_key and DES:
                password = self.__deshash(password)
            self.__send_smb_packet(SMB.SMB_COM_TREE_CONNECT_ANDX, 0, 0x08, 0, 0, 0, pack('<BBHHH', 0xff, 0, 0, 0, len(password)), password + string.upper(path) + '\0' + service + '\0')
        else:
            self.__send_smb_packet(SMB.SMB_COM_TREE_CONNECT_ANDX, 0, 0x08, 0, 0, 0, pack('<BBHHH', 0xff, 0, 0, 0, 1), '\0' + string.upper(path) + '\0' + service + '\0')

        while 1:
            data = self.__sess.recv_packet(timeout)
            if data:
                cmd, err_class, err_code, flags1, flags2, tid, _, mid, params, d = self.__decode_smb(data)
                if cmd == SMB.SMB_COM_TREE_CONNECT_ANDX:
                    if err_class == 0x00 and err_code == 0x00:
                        return tid
                    else:
                        raise SessionError, ( "Cannot connect tree. (ErrClass: %d and ErrCode: %d)" % ( err_class, err_code ), err_class, err_code ) 
开发者ID:tvalacarta,项目名称:tvalacarta,代码行数:21,代码来源:smb.py

示例8: formatMS

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def formatMS(self,fmt):
        '''format like MS date using the notation
        {YY}    --> 2 digit year
        {YYYY}  --> 4 digit year
        {M}     --> month as digit
        {MM}    --> 2 digit month
        {MMM}   --> abbreviated month name
        {MMMM}  --> monthname
        {MMMMM} --> first character of monthname
        {D}     --> day of month as digit
        {DD}    --> 2 digit day of month
        {DDD}   --> abrreviated weekday name
        {DDDD}  --> weekday name
        '''
        r = fmt[:]
        f = 0
        while 1:
            m = _fmtPat.search(r,f)
            if m:
                y = getattr(self,'_fmt'+string.upper(m.group()[1:-1]))()
                i, j = m.span()
                r = (r[0:i] + y) + r[j:]
                f = i + len(y)
            else:
                return r 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:27,代码来源:normalDate.py

示例9: enrich_nodes

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def enrich_nodes(node, function=string.upper,\
                     target_nodes="//Token", input_attribute="text", \
                     output_attribute="uppercase_text", overwrite=True, kwargs={}):
    """
    Apply function to elements of utt that mathc xpath target_nodes. Input to
    the function with be input_attribute, output will be put in output_attribute.  

    Using the defaults, this should make uppercase copies of tokens [TODO: test this].  
    """
    nodes = node.xpath(target_nodes)
    assert len(nodes) > 0
    for node in nodes:
        assert node.has_attribute(input_attribute)
        if not overwrite:
            assert not node.has_attribute(output_attribute),"Cannot overwrite existing '%s' in node "%(output_attribute)
        input_data = node.get(input_attribute)
        transformed_data = function(input_data, **kwargs)
        node.set(output_attribute, transformed_data) 
开发者ID:CSTR-Edinburgh,项目名称:Ossian,代码行数:20,代码来源:NodeProcessors.py

示例10: copy

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def copy(self):
        "Copy raster data"

        self.load()
        im = self.im.copy()
        return self._new(im)

    ##
    # Returns a rectangular region from this image. The box is a
    # 4-tuple defining the left, upper, right, and lower pixel
    # coordinate.
    # <p>
    # This is a lazy operation.  Changes to the source image may or
    # may not be reflected in the cropped image.  To break the
    # connection, call the {@link #Image.load} method on the cropped
    # copy.
    #
    # @param The crop rectangle, as a (left, upper, right, lower)-tuple.
    # @return An Image object. 
开发者ID:awslabs,项目名称:mxnet-lambda,代码行数:21,代码来源:Image.py

示例11: heathcheck_exist

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def heathcheck_exist(cls, healthcheck_type, id_evironment_vip):

        health_type_upper = healthcheck_type.upper()

        env_query = Ambiente.objects.filter(
            Q(vlan__networkipv4__ambient_vip__id=id_evironment_vip) |
            Q(vlan__networkipv6__ambient_vip__id=id_evironment_vip)
        )

        environment = env_query and env_query.uniqueResult() or None

        options_pool_environment = environment.opcaopoolambiente_set.all()

        for option_pool_env in options_pool_environment:
            if option_pool_env.opcao_pool.description.upper() == health_type_upper:
                return True

        return False 
开发者ID:globocom,项目名称:GloboNetworkAPI,代码行数:20,代码来源:models.py

示例12: create_LM_hashed_password_v1

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def create_LM_hashed_password_v1(passwd):
    "setup LanManager password"
    "create LanManager hashed password"
    # if the passwd provided is already a hash, we just return the first half
    if re.match(r'^[\w]{32}:[\w]{32}$',passwd):
        return binascii.unhexlify(passwd.split(':')[0])

    # fix the password length to 14 bytes
    passwd = string.upper(passwd)
    lm_pw = passwd + '\0' * (14 - len(passwd))
    lm_pw = passwd[0:14]

    # do hash
    magic_str = "KGS!@#$%" # page 57 in [MS-NLMP]

    res = ''
    dobj = des.DES(lm_pw[0:7])
    res = res + dobj.encrypt(magic_str)

    dobj = des.DES(lm_pw[7:14])
    res = res + dobj.encrypt(magic_str)

    return res 
开发者ID:blackye,项目名称:luscan-devel,代码行数:25,代码来源:ntlm.py

示例13: getSeeds

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def getSeeds(inSortedFasta, outSeedsFasta):
    """
        @param inSortedFasta: DNA sequences sorted according to the sequence length in the descending order
        @param outSeedsFasta: a fasta file that contains all seeds
    """
    out = csv.OutFileBuffer(outSeedsFasta)
    seedList = []
    seqList = fasta.getSequencesToList(inSortedFasta)  # list of (sequenceName, sequence)

    for seqId, seq in seqList:
        seq = string.upper(seq)

        newSeed = True
        for seedSeq in seedList:

            if len(seedSeq) < len(seq):
                continue

            # if bool(re.search(seq, seedSeq, re.I)) or bool(re.search(str(Seq(seq).reverse_complement()), seedSeq, re.I)):
            if seq in seedSeq or str(Seq(seq).reverse_complement()) in seedSeq:
                newSeed = False
                break

        if newSeed:
            # print 'new seed:', seqId
            seedList.append(seq)
            out.writeText(str('>' + seqId + '\n' + seq + '\n'))
        # else:
        #    print 'no seed:', seqId

    out.close()

    print 'total', len(seqList)
    print 'seed count', len(seedList)
    print 'duplicate', (len(seqList) - len(seedList)) 
开发者ID:CAMI-challenge,项目名称:CAMISIM,代码行数:37,代码来源:ref_seq_gen.py

示例14: tree_connect

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def tree_connect(self, path, password = '', service = SERVICE_ANY):
        LOG.warning("[MS-CIFS] This is an original Core Protocol command.This command has been deprecated.Client Implementations SHOULD use SMB_COM_TREE_CONNECT_ANDX")

        # return 0x800
        if password:
            # Password is only encrypted if the server passed us an "encryption" during protocol dialect
            if self._dialects_parameters['ChallengeLength'] > 0:
                # this code is untested
                password = self.get_ntlmv1_response(ntlm.compute_lmhash(password))

        if not unicode_support:
            if unicode_convert:
                path = str(path)
            else:
                raise Exception('SMB: Can\t conver path from unicode!')

        smb = NewSMBPacket()
        treeConnect = SMBCommand(SMB.SMB_COM_TREE_CONNECT)
        treeConnect['Parameters'] = SMBTreeConnect_Parameters()
        treeConnect['Data']       = SMBTreeConnect_Data()
        treeConnect['Data']['Path'] = path.upper()
        treeConnect['Data']['Password'] = password
        treeConnect['Data']['Service'] = service
        smb.addCommand(treeConnect)
        self.sendSMB(smb)

        while 1:
            smb = self.recvSMB()
            if smb.isValidAnswer(SMB.SMB_COM_TREE_CONNECT):
                # XXX Here we are ignoring the rest of the response
                return smb['Tid']
            return smb['Tid'] 
开发者ID:joxeankoret,项目名称:CVE-2017-7494,代码行数:34,代码来源:smb.py

示例15: set_mac_in_hexa

# 需要导入模块: import string [as 别名]
# 或者: from string import upper [as 别名]
def set_mac_in_hexa(self, data):
        data_aux = ''
        for d in data:
            if data_aux == '':
                data_aux = '%02x' % ord(d)
            else:
                data_aux += '-%02x' % ord(d)
        self.mac = string.upper(data_aux) 
开发者ID:joxeankoret,项目名称:CVE-2017-7494,代码行数:10,代码来源:nmb.py


注:本文中的string.upper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。