本文整理匯總了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)