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


Python _compat.string_types方法代码示例

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


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

示例1: check_iterator

# 需要导入模块: from werkzeug import _compat [as 别名]
# 或者: from werkzeug._compat import string_types [as 别名]
def check_iterator(self, app_iter):
        if isinstance(app_iter, string_types):
            warn(WSGIWarning('application returned string.  Response will '
                             'send character for character to the client '
                             'which will kill the performance.  Return a '
                             'list or iterable instead.'), stacklevel=3) 
开发者ID:jpush,项目名称:jbox,代码行数:8,代码来源:lint.py

示例2: __init__

# 需要导入模块: from werkzeug import _compat [as 别名]
# 或者: from werkzeug._compat import string_types [as 别名]
def __init__(self, title=None, entries=None, **kwargs):
        self.title = title
        self.title_type = kwargs.get('title_type', 'text')
        self.url = kwargs.get('url')
        self.feed_url = kwargs.get('feed_url', self.url)
        self.id = kwargs.get('id', self.feed_url)
        self.updated = kwargs.get('updated')
        self.author = kwargs.get('author', ())
        self.icon = kwargs.get('icon')
        self.logo = kwargs.get('logo')
        self.rights = kwargs.get('rights')
        self.rights_type = kwargs.get('rights_type')
        self.subtitle = kwargs.get('subtitle')
        self.subtitle_type = kwargs.get('subtitle_type', 'text')
        self.generator = kwargs.get('generator')
        if self.generator is None:
            self.generator = self.default_generator
        self.links = kwargs.get('links', [])
        self.entries = entries and list(entries) or []

        if not hasattr(self.author, '__iter__') \
           or isinstance(self.author, string_types + (dict,)):
            self.author = [self.author]
        for i, author in enumerate(self.author):
            if not isinstance(author, dict):
                self.author[i] = {'name': author}

        if not self.title:
            raise ValueError('title is required')
        if not self.id:
            raise ValueError('id is required')
        for author in self.author:
            if 'name' not in author:
                raise TypeError('author must contain at least a name') 
开发者ID:jpush,项目名称:jbox,代码行数:36,代码来源:atom.py

示例3: eval

# 需要导入模块: from werkzeug import _compat [as 别名]
# 或者: from werkzeug._compat import string_types [as 别名]
def eval(self, code, mode='single'):
        """Evaluate code in the context of the frame."""
        if isinstance(code, string_types):
            if PY2 and isinstance(code, unicode):
                code = UTF8_COOKIE + code.encode('utf-8')
            code = compile(code, '<interactive>', mode)
        return eval(code, self.globals, self.locals) 
开发者ID:googlearchive,项目名称:cloud-playground,代码行数:9,代码来源:tbtools.py


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