本文整理汇总了Python中sre_compile.isstring函数的典型用法代码示例。如果您正苦于以下问题:Python isstring函数的具体用法?Python isstring怎么用?Python isstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isstring函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: decodeFromDict
def decodeFromDict(self, d):
self.conf = d
self.level = d.get('level')
if not isinstance(self.level, int):
raise TYVipConfException(d, 'VipLevel.level must be int')
self.name = d.get('name')
if not isstring(self.name) or not self.name:
raise TYVipConfException(d, 'VipLevel.name must be valid string')
self.vipExp = d.get('exp')
if not isinstance(self.vipExp, int):
raise TYVipConfException(d, 'VipLevel.vipExt must be int')
self.pic = d.get('pic', '')
if not isstring(self.pic):
raise TYVipConfException(d, 'VipLevel.pic must be string')
self.desc = d.get('desc', [])
if not isinstance(self.desc, list):
raise TYVipConfException(d, 'VipLevel.desc must be list')
if self.desc:
for subDesc in self.desc:
if not isstring(subDesc):
raise TYVipConfException(d, 'VipLevel.desc.item must be string')
rewardContent = d.get('rewardContent')
if rewardContent:
self.rewardContent = TYContentRegister.decodeFromDict(rewardContent)
giftContent = d.get('giftContent')
if giftContent:
self.giftContent = TYContentRegister.decodeFromDict(giftContent)
self.expDesc = d.get('expDesc', '')
if not isstring(self.expDesc):
raise TYVipConfException(d, 'VipLevel.expDesc must be string')
self.nextVipLevelValue = d.get('nextLevel')
if (self.nextVipLevelValue is not None
and not isinstance(self.nextVipLevelValue, int)):
raise TYVipConfException(d, 'VipLevel.nextVipLevelValue must be int')
return self
开发者ID:zhaozw,项目名称:hall37,代码行数:35,代码来源:hallvip.py
示例2: reloadConf
def reloadConf(self, conf):
qqGroup = conf.get('qqGroup', '')
if not isstring(qqGroup):
raise TYBizConfException(conf, 'qqGroup must be string')
instruction = conf.get('instruction', '')
if not isstring(instruction):
raise TYBizConfException(conf, 'instruction must be string')
mailWhenCanExchange = conf.get('mailWhenCanExchange', '')
if not isstring(mailWhenCanExchange):
raise TYBizConfException(conf, 'mailWhenCanExchange must be string')
items = conf.get('items', [])
if not isinstance(items, list):
raise TYBizConfException(conf, 'items must be list')
couponItemList = []
couponItemMap = {}
for item in items:
couponItem = CouponItem().decodeFromDict(item)
if couponItem.couponId in couponItemMap:
raise TYBizConfException(item, 'Duplicate couponId %s' % (couponItem.couponId))
couponItemList.append(couponItem)
couponItemMap[couponItem.couponId] = couponItem
self._couponItemList = couponItemList
self._couponItemMap = couponItemMap
self._qqGroup = qqGroup
self._instruction = instruction
self._mailWhenCanExchange = mailWhenCanExchange
ftlog.debug('CouponService.reloadConf successed gameId=', self.gameId,
'couponItems=', self._couponItemMap.keys(),
'qqGroup=', self._qqGroup,
'instruction=', self._instruction,
'mailWhenCanExchange=', self._mailWhenCanExchange)
开发者ID:zhaozw,项目名称:hall37,代码行数:32,代码来源:hallcoupon.py
示例3: decodeFromDict
def decodeFromDict(self, d):
self.desc = d.get('desc', '')
if not isstring(self.desc):
raise TYBizConfException(d, 'FlipableCard.desc must be string')
self.tips = d.get('tips', '')
if not isstring(self.tips):
raise TYBizConfException(d, 'FlipableCard.tips must be string')
self._decodeFromDictImpl(d)
return self
开发者ID:zhaozw,项目名称:hall37,代码行数:9,代码来源:hallflipcardluck.py
示例4: decodeFromDict
def decodeFromDict(self, d):
self.name = d.get('name')
if not isstring(self.name) or not self.name:
raise TYBenefitsConfException(d, 'Privilege.name must be valid string')
self.desc = d.get('desc', '')
if not isstring(self.desc):
raise TYBenefitsConfException(d, 'Privilege.desc must be string')
self.sortValue = d.get('sort', 0)
self._decodeFromDictImpl(d)
return self
开发者ID:zhaozw,项目名称:hall37,代码行数:10,代码来源:hallbenefits.py
示例5: decodeFromDict
def decodeFromDict(self, d):
self.conf = d
self.kindId = d.get('kindId')
if not isinstance(self.kindId, int):
raise TYTaskConfException(d, 'task.kindId must be int')
self.name = d.get('name')
if not isstring(self.name):
raise TYTaskConfException(d, 'task.name must be string')
self.count = d.get('count')
if not isinstance(self.count, int):
raise TYTaskConfException(d, 'task.count must be int')
self.totalLimit = d.get('totalLimit', 0)
if not isinstance(self.totalLimit, int):
raise TYTaskConfException(d, 'task.totalLimit must be int')
self.desc = d.get('desc', '')
if not isstring(self.desc):
raise TYTaskConfException(d, 'task.desc must be string')
self.pic = d.get('pic', '')
if not isstring(self.pic):
raise TYTaskConfException(d, 'task.pic must be string')
self.inheritPrevTaskProgress = d.get('inheritPrevTaskProgress', 0)
if self.inheritPrevTaskProgress not in (0, 1):
raise TYTaskConfException(d, 'task.inheritPrevTaskProgress must be int in (0, 1)')
self.star = d.get('star', 0)
if not isinstance(self.star, int):
raise TYTaskConfException(d, 'task.star must be int')
self.shareUrl = d.get('shareUrl', 0)
if self.shareUrl not in (0, 1):
raise TYTaskConfException(d, 'task.shareUrl must be in (0,1)')
rewardContent = d.get('rewardContent')
if rewardContent:
self.rewardContent = TYContentRegister.decodeFromDict(rewardContent)
self.autoSendReward = d.get('autoSendReward', 0)
if self.autoSendReward not in (0, 1):
raise TYTaskConfException(d, 'task.n must be int int (0, 1)')
self.rewardMail = d.get('rewardMail', '')
if not isstring(self.rewardMail):
raise TYTaskConfException(d, 'task.rewardMail must be string')
if 'inspector' in d:
inspector = TYTaskInspectorRegister.decodeFromDict(d.get('inspector'))
self.inspectors.append(inspector)
elif 'inspectors' in d:
self.inspectors = TYTaskInspectorRegister.decodeList(d.get('inspectors'))
self._decodeFromDictImpl(d)
return self
开发者ID:zhaozw,项目名称:hall37,代码行数:54,代码来源:task.py
示例6: reloadConf
def reloadConf(self, conf):
vipLevelMap = {}
assistanceChip = conf.get('assistanceChip')
if not isinstance(assistanceChip, int) or assistanceChip <= 0:
raise TYVipConfException(conf, 'assistanceChip must be int > 0')
assistanceChipUpperLimit = conf.get('assistanceChipUpperLimit')
if not isinstance(assistanceChipUpperLimit, int) or assistanceChipUpperLimit < 0:
raise TYVipConfException(conf, 'assistanceChip must be int >= 0')
levelUpDesc = conf.get('levelUpDesc', '')
if not isstring(levelUpDesc):
raise TYVipConfException(conf, 'levelUpDesc must be string')
levelUpPayOrder = conf.get('levelUpPayOrder')
if not isinstance(levelUpPayOrder, dict):
raise TYVipConfException(conf, 'levelUpPayOrder must be dict')
gotGiftDesc = conf.get('gotGiftDesc', '')
if not isstring(gotGiftDesc):
raise TYVipConfException(conf, 'gotGiftDesc must be string')
gotAssistanceDesc = conf.get('gotAssistanceDesc', '')
if not isstring(gotAssistanceDesc):
raise TYVipConfException(conf, 'gotAssistanceDesc must be string')
levelsConf = conf.get('levels')
if not isinstance(levelsConf, list) or not levelsConf:
raise TYVipConfException(conf, 'vip levels must be list')
for levelConf in levelsConf:
vipLevel = TYVipLevel()
vipLevel.decodeFromDict(levelConf)
if vipLevel.level in vipLevelMap:
raise TYVipConfException(conf, 'duplicate vip level' % (vipLevel.level))
vipLevelMap[vipLevel.level] = vipLevel
for vipLevel in vipLevelMap.values():
vipLevel.initWhenLoaded(vipLevelMap)
vipLevelList = sorted(vipLevelMap.values(), cmp=lambda x, y: cmp(x.vipExp, y.vipExp))
# 判读是否循环配置
for vipLevel in vipLevelList:
nextVipLevel = vipLevel.nextVipLevel
while (nextVipLevel):
if nextVipLevel == vipLevel:
raise TYVipConfException(conf, 'Loop vip level %s' % (vipLevel.level))
nextVipLevel = nextVipLevel.nextVipLevel
self._vipLevelMap = vipLevelMap
self._vipLevelList = vipLevelList
self._assistanceChip = assistanceChip
self._assistanceChipUpperLimit = assistanceChipUpperLimit
self._levelUpDesc = levelUpDesc
self._gotGiftDesc = gotGiftDesc
self._gotAssistanceDesc = gotAssistanceDesc
self._levelUpPayOrder = levelUpPayOrder
ftlog.debug('TYVipSystemImpl.reloadConf successed allLevels=', self._vipLevelMap.keys(), 'list=',
[l.level for l in vipLevelList])
开发者ID:zhaozw,项目名称:hall37,代码行数:52,代码来源:hallvip.py
示例7: _compile
def _compile(pattern, flags):
# internal: compile pattern
try:
p, loc = _cache[type(pattern), pattern, flags]
if loc is None or loc == _locale.setlocale(_locale.LC_CTYPE):
return p
except KeyError:
pass
if isinstance(pattern, _pattern_type):
if flags:
raise ValueError(
"cannot process flags argument with a compiled pattern")
return pattern
if not sre_compile.isstring(pattern):
raise TypeError("first argument must be string or compiled pattern")
p = sre_compile.compile(pattern, flags)
if not (flags & DEBUG):
if len(_cache) >= _MAXCACHE:
_cache.clear()
if p.flags & LOCALE:
if not _locale:
return p
loc = _locale.setlocale(_locale.LC_CTYPE)
else:
loc = None
_cache[type(pattern), pattern, flags] = p, loc
return p
开发者ID:LibingEmail0104,项目名称:src_project,代码行数:27,代码来源:re.py
示例8: _check_param_orderId
def _check_param_orderId(self, msg, key, params):
orderId = msg.getParam(key)
if (isstring(orderId)
and (orderid.is_valid_orderid_str(orderId)
or orderId in ('ios_compensate', 'momo_compensate'))):
return None, orderId
return 'ERROR of orderId !' + str(orderId), None
开发者ID:zhaozw,项目名称:hall37,代码行数:7,代码来源:store_handler.py
示例9: addKeyword
def addKeyword(self, keyword):
'''添加一个关键词'''
if not isstring(keyword):
return False
keyword = self.__ensureUnicode(keyword)
if keyword in self.__keywords:
return False
self.__keywords.add(keyword)
keyword += unichr(11)
q = {}
k = u''
d = self.__d
for uchar in keyword:
uchar = uchar.lower()
if d == '':
q[k] = {}
d = q[k]
if not (uchar in d):
d[uchar] = ''
q = d
k = uchar
d = d[uchar]
return True
开发者ID:zhaozw,项目名称:hall37,代码行数:25,代码来源:keywords.py
示例10: getParamsByPlayer
def getParamsByPlayer(player, timestamp):
try:
m360kpParams = player.getSigninParam('m360kp')
if not m360kpParams:
return None
gkey = m360kpParams.get('gkey')
if not gkey or not isstring(gkey):
return None
snsId = player.snsId
if not snsId or not snsId.startswith('360:'):
return None
return {
'time': timestamp,
'gkey': gkey,
'uid': snsId[4:],
'matchid': player.matchId,
'skey': 1
}
except:
ftlog.error('match360kp.getParamsByPlayer userId=', player.userId,
'signinParams=', player.signinParams,
'snsId=', player.snsId)
return None
开发者ID:zhaozw,项目名称:hall37,代码行数:26,代码来源:match360kp.py
示例11: _compile
def _compile(*key):
pattern, flags = key
bypass_cache = flags & DEBUG
if not bypass_cache:
cachekey = (type(key[0]),) + key
p = _cache.get(cachekey)
if p is not None:
return p
if isinstance(pattern, _pattern_type):
if flags:
raise ValueError("Cannot process flags argument with a compiled pattern")
return pattern
else:
if not sre_compile.isstring(pattern):
raise TypeError, "first argument must be string or compiled pattern"
try:
p = sre_compile.compile(pattern, flags)
except error as v:
raise error, v
if not bypass_cache:
if len(_cache) >= _MAXCACHE:
_cache.clear()
_cache[cachekey] = p
return p
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:25,代码来源:re.py
示例12: decodeFromDict
def decodeFromDict(self, d):
# itemId
self.itemId = d.get('itemId')
if not isstring(self.itemId):
raise TYBizConfException(d, 'TYRedEnvelopeLimit.itemId must be string')
# minValue
self.minValue = d.get('minValue', 1)
if not isinstance(self.minValue, int):
raise TYBizConfException(d, 'TYRedEnvelopeLimit.minValue must be int')
# maxValue
self.maxValue = d.get('maxValue', 1)
if not isinstance(self.maxValue, int):
raise TYBizConfException(d, 'TYRedEnvelopeLimit.maxValue must be int')
if self.minValue > self.maxValue:
raise TYBizConfException(d, 'TYRedEnvelopeLimit minValue > maxValue !!!')
self.minCount = d.get('minCount', 1)
if not isinstance(self.minCount, int):
raise TYBizConfException(d, 'TYRedEnvelopeLimit.minCount must be int')
self.maxCount = d.get('maxCount', 1)
if not isinstance(self.maxCount, int):
raise TYBizConfException(d, 'TYRedEnvelopeLimit.maxCount must be int')
return self
开发者ID:zhaozw,项目名称:hall37,代码行数:28,代码来源:hall_red_envelope.py
示例13: _compile
def _compile(pattern, flags):
# internal: compile pattern
if isinstance(flags, RegexFlag):
flags = flags.value
try:
return _cache[type(pattern), pattern, flags]
except KeyError:
pass
if isinstance(pattern, Pattern):
if flags:
raise ValueError(
"cannot process flags argument with a compiled pattern")
return pattern
if not sre_compile.isstring(pattern):
raise TypeError("first argument must be string or compiled pattern")
p = sre_compile.compile(pattern, flags)
if not (flags & DEBUG):
if len(_cache) >= _MAXCACHE:
# Drop the oldest item
try:
del _cache[next(iter(_cache))]
except (StopIteration, RuntimeError, KeyError):
pass
_cache[type(pattern), pattern, flags] = p
return p
开发者ID:Apoorvadabhere,项目名称:cpython,代码行数:25,代码来源:re.py
示例14: load_namespaces
def load_namespaces (root, graph):
with open (join (root, 'data', 'context.jsonld'), "rb") as f:
context = json.loads (f.read ())
for prefix, url in context["@context"].items ():
if isstring (url):
graph.namespace_manager.bind (prefix, url)
开发者ID:warpr,项目名称:licensedb,代码行数:7,代码来源:turtle-cc.py
示例15: checkValid
def checkValid(self):
if not isstring(self.name):
raise MatchConfException('Stage.name must be string')
if not AnimationType.isValid(self.animationType):
raise MatchConfException('Stage.animationType must in:' + str(AnimationType.VALID_TYPES))
if not SeatQueuingType.isValid(self.seatQueuing):
raise MatchConfException('Stage.seat.principles must in:' + str(SeatQueuingType.VALID_TYPES))
if (not isinstance(self.cardCount, int)
or self.cardCount <= 0
or self.cardCount > MAX_CARD_COUNT):
raise MatchConfException('Stage.card.count must in:' + str((1, MAX_CARD_COUNT)))
if (not isinstance(self.riseUserCount, int)
or self.riseUserCount <= 0):
raise MatchConfException('Stage.raise.user.count must be integer >= 0')
if not isinstance(self.chipBase, int):
raise MatchConfException('Stage.chip.base must be integer')
if not GroupingType.isValid(self.groupingType):
raise MatchConfException('Stage.grouping.type must in:' + str(GroupingType.VALID_TYPES))
if self.groupingType == GroupingType.TYPE_GROUP_COUNT:
if not isinstance(self.groupingGroupCount, int) or self.groupingGroupCount <= 0:
raise MatchConfException('Stage.grouping.group.count must be integer > 0')
elif self.groupingType == GroupingType.TYPE_USER_COUNT:
if not isinstance(self.groupingUserCount, int) or self.groupingUserCount <= 0:
raise MatchConfException('Stage.grouping.user.count must be integer > 0')
return self
开发者ID:zhaozw,项目名称:hall37,代码行数:32,代码来源:config.py
示例16: _compile
def _compile(*key):
# internal: compile pattern
taint = _get_taint(key[0])
if taint is not None: # can't hash the set
taint = tuple(taint)
cachekey = (type(key[0]), key, taint)
p = re._cache.get(cachekey)
if p is not None:
return p
pattern, flags = key
if isinstance(pattern, re._pattern_type):
if flags:
raise ValueError("Cannot process flags argument with"
" a compiled pattern")
return pattern
if not sre_compile.isstring(pattern):
raise TypeError("first argument must be string or compiled"
" pattern")
p = sre_compile.compile(pattern, flags)
if len(re._cache) >= re._MAXCACHE:
re._cache.clear()
re._cache[cachekey] = p
return p
开发者ID:delta-force,项目名称:deltaforce-python,代码行数:25,代码来源:taint.py
示例17: decodeFromDict
def decodeFromDict(self, d):
self.conf = d
self.type = d.get('type')
if not isstring(self.type):
raise TYBizConfException(d, 'HallGameNode.type must be string')
self._decodeFromDictImpl(d)
return self
开发者ID:zhaozw,项目名称:hall37,代码行数:7,代码来源:hallgamelist2.py
示例18: decodeFromDict
def decodeFromDict(self, d):
startTimeStr = d.get('startTime')
endTimeStr = d.get('endTime')
if startTimeStr:
self.startDT = datetime.strptime(startTimeStr, '%Y-%m-%d %H:%M:%S').timetuple()
if endTimeStr:
self.endDT = datetime.strptime(endTimeStr, '%Y-%m-%d %H:%M:%S').timetuple()
if self.endDT and self.startDT and self.endDT < self.startDT:
raise TYBizConfException(d, 'BuyCountLimit.endTime must >= BuyCountLimit.startTime')
periods = d.get('periods', [])
if not periods:
raise TYBizConfException(d, 'BuyCountLimit.periods must not empty list')
for period in periods:
limit = TimePeriodLimit().decodeFromDict(period)
if limit.periodId in self.periodLimitMap:
raise TYBizConfException(d, 'Duplicate BuyCountLimit period %s' % (limit.periodId))
self.periodLimitList.append(limit)
self.periodLimitMap[limit.periodId] = limit
self.outTimeFailure = d.get('outTimeFailure', '')
if not isstring(self.outTimeFailure) or not self.outTimeFailure:
raise TYBizConfException(d, 'BuyCountLimit.outTimeFailure must be not empty string')
return self
开发者ID:zhaozw,项目名称:hall37,代码行数:26,代码来源:hallstocklimit.py
示例19: _decodeFromDictImpl
def _decodeFromDictImpl(self, d):
self.type = d.get('type')
if not isstring(self.type):
raise TYBizConfException(d, 'HallGameNode.type must be string')
self.params = d.get('params', {})
self.conditions = UserConditionRegister.decodeList(d.get('conditions', []))
开发者ID:zhaozw,项目名称:hall37,代码行数:8,代码来源:hallgamelist2.py
示例20: decodeFromDict
def decodeFromDict(self, d):
from hall.entity.hallusercond import UserConditionRegister
self.value = d.get('value', '')
if not isstring(self.value):
raise TYBizConfException(d, 'hallshare.HallShareConfigItem.value must be string')
self.conditions = UserConditionRegister.decodeList(d.get('conditions', []))
return self
开发者ID:zhaozw,项目名称:hall37,代码行数:8,代码来源:hallshare.py
注:本文中的sre_compile.isstring函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论