本文整理汇总了Python中pyaid.string.StringUtils.StringUtils.contains方法的典型用法代码示例。如果您正苦于以下问题:Python StringUtils.contains方法的具体用法?Python StringUtils.contains怎么用?Python StringUtils.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyaid.string.StringUtils.StringUtils
的用法示例。
在下文中一共展示了StringUtils.contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _renderImpl
# 需要导入模块: from pyaid.string.StringUtils import StringUtils [as 别名]
# 或者: from pyaid.string.StringUtils.StringUtils import contains [as 别名]
def _renderImpl(self, **kwargs):
if self._processor.globalVars:
self._processor.globalVars.includeTwitterWidgetAPI = True
a = self.attrs
q = a.get(TagAttributesEnum.SEARCH, '@vizme', kwargs)
start = a.get(TagAttributesEnum.START, None, kwargs)
stop = a.get(TagAttributesEnum.STOP, None, kwargs)
skips = a.get(TagAttributesEnum.IGNORE, None, kwargs)
height = a.getAsEnumerated(TagAttributesEnum.HEIGHT, GeneralSizeEnum, GeneralSizeEnum.medium)
title = a.get(TagAttributesEnum.TITLE, '', kwargs)
subtitle = a.get(TagAttributesEnum.SUBTITLE, '', kwargs)
count = a.get(TagAttributesEnum.COUNT + TagAttributesEnum.TWEETS, 10, kwargs)
scrollbar = a.getAsBool(TagAttributesEnum.SCROLL, count > 5, kwargs)
interval = a.getAsInt(TagAttributesEnum.TIME, 5, kwargs)
loop = a.getAsBool(TagAttributesEnum.LOOP, interval > 0, kwargs)
if not isinstance(q, list):
q = [q]
user = len(q) == 1 and q[0].startswith('@') and not StringUtils.contains(q[0], [' ', ','])
q = u' OR '.join(q)
if height in ['none', 'm']:
height = 300
elif height == 'xxs':
height = 100
elif height == 'xs':
height = 175
elif height == 's':
height = 250
elif height == 'l':
height = 375
elif height == 'xl':
height = 450
elif height == 'xxl':
height = 525
else:
height = 300
if skips:
user = False
q += u' ' + (u'-' + skips if isinstance(skips, basestring) else u' -'.join(skips))
if start or stop:
user = False
if start:
q += u' since:' + start
if stop:
q += u' until:' + stop
data = {
'id':a.id.get(),
'version':2,
'width':'auto',
'height':height,
'interval':1000*interval,
'theme': {
'shell': {
'background': a.backColors.baseColor.web,
'color': a.focalColors.highlightColor.web
},
'tweets': {
'background': a.backColors.baseColor.web,
'color': a.focalColors.baseColor.web,
'links': a.focalColors.linkColor.web
}
},
'features': {
'scrollbar':scrollbar,
'loop':loop,
'live':interval > 0,
'behavior': u'all' if user else u'default'
},
'type': 'profile' if user else 'search'
}
if user:
a.render['setUser'] = u'.setUser("' + q + u'")'
data['rpp'] = count
else:
a.render['setUser'] = u''
data['search'] = q
data['title'] = subtitle.capitalize() if subtitle else string.capwords(q)
data['subject'] = title.capitalize() if title else string.capwords(q.split(' ')[0])
a.render['twitterData'] = JSON.asString(data).replace("'", "\\'")