python类uppercase()的实例源码

makegwenum.py 文件源码 项目:OSPTF 作者: xSploited 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def is_interface_enum(enumtype):
  return not (enumtype[0] in string.uppercase and enumtype[2] in string.uppercase)
nmb.py 文件源码 项目:PiBunny 作者: tholum 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def _do_first_level_encoding(m):
    s = ord(m.group(0))
    return string.uppercase[s >> 4] + string.uppercase[s & 0x0f]
makegwenum.py 文件源码 项目:pupy 作者: ru-faraon 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def is_interface_enum(enumtype):
  return not (enumtype[0] in string.uppercase and enumtype[2] in string.uppercase)
toolsFL.py 文件源码 项目:inter 作者: rsms 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def makePSFontName(name):
    """Create a postscript filename out of a regular postscript fontname,
    using the old fashioned macintosh 5:3:3 convention.
    """
    import string
    parts = []
    current = []
    final = []
    notAllowed = '-_+=,-'
    index = 0
    for c in name:
        if c in notAllowed:
            continue
        if c in string.uppercase or index == 0:
            c = string.upper(c)
            if current:
                parts.append("".join(current))
            current = [c]
        else:
            current.append(c)
        index = index + 1
    if current:
        parts.append("".join(current))
    final.append(parts[0][:5])
    for p in parts[1:]:
        final.append(p[:3])
    return "".join(final)

#
#
#
#   stuff for glyphs
#
#
#
tools.py 文件源码 项目:true_review_web2py 作者: lucadealfaro 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def random_password(self):
        import string
        import random
        password = ''
        specials = r'!#$*'
        for i in range(0, 3):
            password += random.choice(string.lowercase)
            password += random.choice(string.uppercase)
            password += random.choice(string.digits)
            password += random.choice(specials)
        return ''.join(random.sample(password, len(password)))
nmb.py 文件源码 项目:tvalacarta 作者: tvalacarta 项目源码 文件源码 阅读 41 收藏 0 点赞 0 评论 0
def _do_first_level_encoding(m):
    s = ord(m.group(0))
    return string.uppercase[s >> 4] + string.uppercase[s & 0x0f]
tools.py 文件源码 项目:Problematica-public 作者: TechMaz 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def random_password(self):
        import string
        import random
        password = ''
        specials = r'!#$*'
        for i in range(0, 3):
            password += random.choice(string.lowercase)
            password += random.choice(string.uppercase)
            password += random.choice(string.digits)
            password += random.choice(specials)
        return ''.join(random.sample(password, len(password)))
test_string.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def test_attrs(self):
        string.whitespace
        string.lowercase
        string.uppercase
        string.letters
        string.digits
        string.hexdigits
        string.octdigits
        string.punctuation
        string.printable
test_string.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def test_attrs(self):
        string.whitespace
        string.lowercase
        string.uppercase
        string.letters
        string.digits
        string.hexdigits
        string.octdigits
        string.punctuation
        string.printable
nmb.py 文件源码 项目:CVE-2017-7494 作者: joxeankoret 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def _do_first_level_encoding(m):
    s = ord(m.group(0))
    return string.uppercase[s >> 4] + string.uppercase[s & 0x0f]
ws.py 文件源码 项目:web_ctp 作者: molebot 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def set_accounts(_acc):
    f = shelve.open(STORE)
    _out = {}
    for k,v in _acc.items():
        _out[k] = v
        if '#' in v['instrument']:
            _out[k]['instrument'] = '#'
        elif '@' in v['instrument']:
            _out[k]['instrument'] = '@'
        else:
            _instrument = v['instrument'].split('+')
            _instrument.sort(reverse=True)
            if '' in _instrument:
                _pos = _instrument.index('')
                _instrument = _instrument[:_pos]
            _list = []
            for one in _instrument:
                if '=' in one:
                    one = filter(lambda x:x in _chars+_CHARS,one)+'='
                    _list.append(one)
                else:
                    _list.append(one)
            _out[k]['instrument'] = '+'.join(_list)
    f['accounts'] = _out
    f.close()
    start_accounts(get_accounts())
base.py 文件源码 项目:raw-packet 作者: Vladimir-Ivanov-Git 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def make_random_string(length):
        return ''.join(choice(lowercase + uppercase + digits) for _ in range(length))
basic_statistics.py 文件源码 项目:scienceie17 作者: OC-ScienceIE 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def num_capitals(entity):
    capital=[]
    for line in entity:
        capital.append(len(filter(lambda x: x in string.uppercase, line[2])))
    return sum(capital)
makegwenum.py 文件源码 项目:remoteControlPPT 作者: htwenning 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def is_interface_enum(enumtype):
  return not (enumtype[0] in string.uppercase and enumtype[2] in string.uppercase)
printer.py 文件源码 项目:Bigglesworth 作者: MaurizioB 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def compute_metrics(self):
        self.font_metrics = QtGui.QFontMetrics(self.font)
        cat = max([self.font_metrics.width(c) for c in digits+uppercase])*4 + self.font_metrics.width('    ')
        name = max([self.font_metrics.width(c) for c in self.chars])*16 + self.spacing
        self.prog_size = cat+name
printer.py 文件源码 项目:Bigglesworth 作者: MaurizioB 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def compute(self, cols=1, vertical=False):
        text = 'Blofeld preset list:\n\n'
        for b, bank in enumerate(self.main.blofeld_library.data):
            if b not in self.bank_selection: continue
            sounds = []
            for sound in bank:
                sounds.append('{}{:03}\t{}'.format(uppercase[sound.bank], sound.prog+1, sound.name))
            if sounds:
                text += 'Bank {}:\n=======\n'.format(uppercase[sound.bank])
                if cols == 1:
                    text += '\n'.join(sounds)
                else:
                    if vertical:
                        div = len(sounds)/cols
                        if div*cols < len(sounds):
                            div += 1
                        for d in range(div):
                            for col in range(cols):
                                try:
                                    text += sounds[d + div*col]
                                    if col == cols-1:
                                        text += '\n'
                                    else:
                                        text += '\t\t'
                                except:
                                    text += '\n'
                                    break
                    else:
                        col = 0
                        for txt in sounds:
                            text += txt
                            col += 1
                            if col == cols:
                                text += '\n'
                                col = 0
                            else:
                                text += '\t\t'
                text += '\n\n'
        self.text = text
classes.py 文件源码 项目:Bigglesworth 作者: MaurizioB 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def checkout(self):
        invalid = []
        for i, (param, value) in enumerate(zip(Params, self._data)):
            if param.range == 'reserved': continue
            if isinstance(param.values, AdvParam):
#                if value & param.values.forbidden:
#                    print 'FORBIDDEN! {}{:03} "{}" {}: {:07b} {:07b}'.format(uppercase[self.bank], self.prog, self.name, param.attr, param.values.forbidden, value)
                res = param.values.is_valid(value)
                if res is not True:
                    invalid.append((i, res))
                continue
            p_min, p_max = param.range[:-1]
            if not p_min <= value <= p_max:
                invalid.append(i)
        return invalid if invalid else None


问题


面经


文章

微信
公众号

扫码关注公众号