本文整理汇总了Python中email.utils._sanitize方法的典型用法代码示例。如果您正苦于以下问题:Python utils._sanitize方法的具体用法?Python utils._sanitize怎么用?Python utils._sanitize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类email.utils
的用法示例。
在下文中一共展示了utils._sanitize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __new__
# 需要导入模块: from email import utils [as 别名]
# 或者: from email.utils import _sanitize [as 别名]
def __new__(cls, name, value):
kwds = {'defects': []}
cls.parse(value, kwds)
if utils._has_surrogates(kwds['decoded']):
kwds['decoded'] = utils._sanitize(kwds['decoded'])
self = str.__new__(cls, kwds['decoded'])
del kwds['decoded']
self.init(name, **kwds)
return self
示例2: parse
# 需要导入模块: from email import utils [as 别名]
# 或者: from email.utils import _sanitize [as 别名]
def parse(cls, value, kwds):
kwds['parse_tree'] = parse_tree = cls.value_parser(value)
kwds['decoded'] = str(parse_tree)
kwds['defects'].extend(parse_tree.all_defects)
if parse_tree.params is None:
kwds['params'] = {}
else:
# The MIME RFCs specify that parameter ordering is arbitrary.
kwds['params'] = {utils._sanitize(name).lower():
utils._sanitize(value)
for name, value in parse_tree.params}
示例3: init
# 需要导入模块: from email import utils [as 别名]
# 或者: from email.utils import _sanitize [as 别名]
def init(self, *args, **kw):
super().init(*args, **kw)
self._maintype = utils._sanitize(self._parse_tree.maintype)
self._subtype = utils._sanitize(self._parse_tree.subtype)