本文整理汇总了Python中email.message.get_labels方法的典型用法代码示例。如果您正苦于以下问题:Python message.get_labels方法的具体用法?Python message.get_labels怎么用?Python message.get_labels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类email.message
的用法示例。
在下文中一共展示了message.get_labels方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add
# 需要导入模块: from email import message [as 别名]
# 或者: from email.message import get_labels [as 别名]
def add(self, message):
"""Add message and return assigned key."""
key = _singlefileMailbox.add(self, message)
if isinstance(message, BabylMessage):
self._labels[key] = message.get_labels()
return key
示例2: __setitem__
# 需要导入模块: from email import message [as 别名]
# 或者: from email.message import get_labels [as 别名]
def __setitem__(self, key, message):
"""Replace the keyed message; raise KeyError if it doesn't exist."""
_singlefileMailbox.__setitem__(self, key, message)
if isinstance(message, BabylMessage):
self._labels[key] = message.get_labels()
示例3: get_labels
# 需要导入模块: from email import message [as 别名]
# 或者: from email.message import get_labels [as 别名]
def get_labels(self):
"""Return a list of user-defined labels in the mailbox."""
self._lookup()
labels = set()
for label_list in self._labels.values():
labels.update(label_list)
labels.difference_update(self._special_labels)
return list(labels)
示例4: _pre_mailbox_hook
# 需要导入模块: from email import message [as 别名]
# 或者: from email.message import get_labels [as 别名]
def _pre_mailbox_hook(self, f):
"""Called before writing the mailbox to file f."""
f.write('BABYL OPTIONS:%sVersion: 5%sLabels:%s%s\037' %
(os.linesep, os.linesep, ','.join(self.get_labels()),
os.linesep))
示例5: _pre_mailbox_hook
# 需要导入模块: from email import message [as 别名]
# 或者: from email.message import get_labels [as 别名]
def _pre_mailbox_hook(self, f):
"""Called before writing the mailbox to file f."""
babyl = b'BABYL OPTIONS:' + linesep
babyl += b'Version: 5' + linesep
labels = self.get_labels()
labels = (label.encode() for label in labels)
babyl += b'Labels:' + b','.join(labels) + linesep
babyl += b'\037'
f.write(babyl)