• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python _xml_helpers.readNoEmptyStr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中messenger.doc_loaders._xml_helpers.readNoEmptyStr函数的典型用法代码示例。如果您正苦于以下问题:Python readNoEmptyStr函数的具体用法?Python readNoEmptyStr怎么用?Python readNoEmptyStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: load

def load(xmlCtx, section, messengerSettings):
    for tagName, subSec in section.items():
        if tagName != 'colorScheme':
            raise _xml_helpers.XMLError(xmlCtx, 'Tag {0:>s} is invalid'.format(tagName))
        ctx = xmlCtx.next(subSec)
        name = _xml_helpers.readNoEmptyStr(ctx, subSec, 'name', 'Color scheme name is not defined')
        colorScheme = messengerSettings.getColorScheme(name)
        if colorScheme is not None:
            _readColorScheme(ctx, subSec, colorScheme)
开发者ID:wotmods,项目名称:WOTDecompiled,代码行数:9,代码来源:colors_schemes.py


示例2: _readReceiverValue

def _readReceiverValue(xmlCtx, section, settings = None):
    name = _xml_helpers.readNoEmptyStr(xmlCtx, section, 'name', 'Receiver name is not defined')
    valueSec = section['value']
    if not valueSec:
        raise _xml_helpers.XMLError(xmlCtx, 'Item value is not defined')
    modifiers = []
    modifiersSec = valueSec['modifiers']
    if modifiersSec:
        modifiers = map(lambda section: section.asInt, modifiersSec.values())
    label = _xml_helpers.readNoEmptyI18nStr(xmlCtx.next(valueSec), valueSec, 'label', 'Label is not defined')
    return (name, _ReceiverInBattle(label, modifiers, valueSec.readInt('order')))
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:11,代码来源:settings_set.py


示例3: _readReceiverValue

def _readReceiverValue(xmlCtx, section, settings=None):
    name = _xml_helpers.readNoEmptyStr(xmlCtx, section, "name", "Receiver name is not defined")
    valueSec = section["value"]
    if not valueSec:
        raise _xml_helpers.XMLError(xmlCtx, "Item value is not defined")
    modifiers = []
    modifiersSec = valueSec["modifiers"]
    if modifiersSec:
        modifiers = map(lambda section: section.asInt, modifiersSec.values())
    label = _xml_helpers.readNoEmptyI18nStr(xmlCtx.next(valueSec), valueSec, "label", "Label is not defined")
    return (name, _ReceiverInBattle(label, modifiers, valueSec.readInt("order")))
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:11,代码来源:settings_set.py


示例4: load

def load(xmlCtx, section, messengerSettings):
    for tagName, subSec in section.items():
        if tagName != 'settings':
            raise _xml_helpers.XMLError(xmlCtx, 'Tag "{0:>s}" is invalid'.format(tagName))
        name = _xml_helpers.readNoEmptyStr(xmlCtx, subSec, 'name', 'Setting name is not defined')
        if name not in _SETTINGS_LOADERS:
            raise _xml_helpers.XMLError(xmlCtx, 'Setting "{0:>s}" is not valid'.format(name))
        loader, setReaders, itemReaders = _SETTINGS_LOADERS[name]
        if hasattr(messengerSettings, name):
            loader(xmlCtx.next(subSec), subSec, getattr(messengerSettings, name), setReaders, itemReaders)
        else:
            raise _xml_helpers.XMLError(xmlCtx, 'Settings has not attribute {0:>s}'.format(name))
开发者ID:aevitas,项目名称:wotsdk,代码行数:12,代码来源:doc_loaderssettings_set.py


示例5: _readColorScheme

def _readColorScheme(xmlCtx, section, colorScheme):
    names = colorScheme.getColorsNames()
    defName = colorScheme.getDefColorName()
    for tagName, subSec in section.items():
        if tagName == 'name':
            continue
        if tagName != 'item':
            raise _xml_helpers.XMLError(xmlCtx, 'Tag "{0:>s}" is invalid'.format(tagName))
        ctx = xmlCtx.next(subSec)
        name = _xml_helpers.readNoEmptyStr(ctx, subSec, 'name', 'Section "name" is not defined')
        colorsSec = subSec['colors']
        if not colorsSec:
            raise _xml_helpers.XMLError(ctx, 'Section "colors" is not defined')
        colorScheme[name] = _readColors(ctx.next(colorsSec), colorsSec, names, defName)
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:14,代码来源:colors_schemes.py


示例6: _readSet

def _readSet(xmlCtx, section, _, readers):
    result = []
    items = section['items']
    if items is None:
        raise _xml_helpers.XMLError(xmlCtx, 'Items not found')
    for tagName, subSec in items.items():
        if tagName != 'item':
            raise _xml_helpers.XMLError(xmlCtx, 'Tag "{0:>s}" is invalid'.format(tagName))
        ctx = xmlCtx.next(subSec)
        name = _xml_helpers.readNoEmptyStr(xmlCtx, subSec, 'name', 'Item name is not defined')
        if name not in readers:
            raise _xml_helpers.XMLError(xmlCtx, 'Item "{0:>s}" is not valid'.format(name))
        result.append(readers[name](ctx, subSec, settings=None))

    return result
开发者ID:aevitas,项目名称:wotsdk,代码行数:15,代码来源:doc_loaderssettings_set.py


示例7: _readSettings

def _readSettings(xmlCtx, section, settings, setReaders, itemReaders):
    for tagName, subSec in section.items():
        if tagName == 'name':
            continue
        if tagName == 'set':
            readers = setReaders
        elif tagName == 'item':
            readers = itemReaders
        else:
            raise _xml_helpers.XMLError(xmlCtx, 'Tag "{0:>s}" is invalid'.format(tagName))
        ctx = xmlCtx.next(subSec)
        name = _xml_helpers.readNoEmptyStr(ctx, subSec, 'name', 'Tag "name" is not defined')
        if name not in readers:
            raise _xml_helpers.XMLError(ctx, 'Set/item "{0:>s}" is not valid'.format(name))
        readers[name](ctx, subSec, settings)
开发者ID:aevitas,项目名称:wotsdk,代码行数:15,代码来源:doc_loaderssettings_set.py


示例8: loadDefault

def loadDefault(xmlCtx, section, messengerSettings):
    data = {}
    for tagName, subSec in section.items():
        if tagName != 'preference':
            raise _xml_helpers.XMLError(xmlCtx, 'Tag {0:>s} is invalid'.format(tagName))
        ctx = xmlCtx.next(subSec)
        name = _xml_helpers.readNoEmptyStr(ctx, subSec, 'name', 'Preference name is not defined')
        if name not in _userProps:
            raise _xml_helpers.XMLError(ctx, 'Preference {0:>s} is invalid'.format(name))
        reader, _, validator, _ = _userProps[name]
        value = getattr(subSec, reader)('value')
        if validator(value):
            data[name] = value
        else:
            raise _xml_helpers.XMLError(ctx, 'Invalid value of preference {0:>s}'.format(name))

    if len(data):
        messengerSettings.userPrefs = messengerSettings.userPrefs._replace(**data)
开发者ID:aevitas,项目名称:wotsdk,代码行数:18,代码来源:doc_loadersuser_prefs.py


示例9: _readColors

def _readColors(xmlCtx, section, colorsNames, defName):
    result = {}
    notFound = colorsNames[:]
    for tagName, subSec in section.items():
        if tagName != 'color':
            raise _xml_helpers.XMLError(xmlCtx, 'Tag "{0:>s}" is invalid'.format(tagName))
        ctx = xmlCtx.next(subSec)
        name = _xml_helpers.readNoEmptyStr(ctx, subSec, 'name', 'Section "name" is not defined')
        if name not in colorsNames:
            raise _xml_helpers.XMLError(ctx, 'Name of color {0:>s} is invalid'.format(name))
        result[name] = _xml_helpers.readRGB(ctx, subSec, 'rgb', 'Color is invalid.')
        notFound.remove(name)

    if len(notFound):
        defColor = 0
        if defName in result:
            defColor = result[defName]
        for name in notFound:
            result[name] = defColor

    return result
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:21,代码来源:colors_schemes.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ext.passCensor函数代码示例发布时间:2022-05-27
下一篇:
Python messenger.Messenger类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap