Python imaplib 模块,ParseFlags() 实例源码

我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用imaplib.ParseFlags()

项目:imap_tools    作者:ikvk    | 项目源码 | 文件源码
def _clean_message_data(fetch_data):
        """
        :param fetch_data: Message object model
        :returns [message_data: bytes, uid_data: bytes, flag_data: list]
        *Elements may contain byte strings in any order, like: b'4517 (FLAGS (\\Recent NonJunk))'
        """
        message_data = b''
        uid_data = b''
        flag_data = []
        for fetch_item in fetch_data:
            # flags
            if type(fetch_item) is bytes and imaplib.ParseFlags(fetch_item):
                flag_data.extend(imaplib.ParseFlags(fetch_item))
            # data, uid
            if type(fetch_item) is tuple:
                uid_data = fetch_item[0]
                message_data = fetch_item[1]
        return message_data, uid_data, flag_data
项目:touch-pay-client    作者:HackPucBemobi    | 项目源码 | 文件源码
def store(self, *args):
        """
        implements some flag commands
        args: ("<id>", "<+|->FLAGS", "(\\Flag1 \\Flag2 ... \\Flagn)")
        """
        message = self.spam[self._mailbox][int(args[0] - 1)]
        old_flags = ParseFlags(message["flags"])
        flags = ParseFlags("FLAGS" + args[2])
        if args[1].strip().startswith("+"):
            message["flags"] = "FLAGS (%s)" % " ".join(set(flags + old_flags))
        elif args[1].strip().startswith("-"):
            message["flags"] = "FLAGS (%s)" % " ".join([flag for flag in old_flags if not flag in flags])
项目:spc    作者:whbrewer    | 项目源码 | 文件源码
def store(self, *args):
        """
        implements some flag commands
        args: ("<id>", "<+|->FLAGS", "(\\Flag1 \\Flag2 ... \\Flagn)")
        """
        message = self.spam[self._mailbox][int(args[0] - 1)]
        old_flags = ParseFlags(message["flags"])
        flags = ParseFlags("FLAGS" + args[2])
        if args[1].strip().startswith("+"):
            message["flags"] = "FLAGS (%s)" % " ".join(set(flags + old_flags))
        elif args[1].strip().startswith("-"):
            message["flags"] = "FLAGS (%s)" % " ".join([flag for flag in old_flags if not flag in flags])
项目:Problematica-public    作者:TechMaz    | 项目源码 | 文件源码
def store(self, *args):
        """
        implements some flag commands
        args: ("<id>", "<+|->FLAGS", "(\\Flag1 \\Flag2 ... \\Flagn)")
        """
        message = self.spam[self._mailbox][int(args[0] - 1)]
        old_flags = ParseFlags(message["flags"])
        flags = ParseFlags("FLAGS" + args[2])
        if args[1].strip().startswith("+"):
            message["flags"] = "FLAGS (%s)" % " ".join(set(flags + old_flags))
        elif args[1].strip().startswith("-"):
            message["flags"] = "FLAGS (%s)" % " ".join([flag for flag in old_flags if not flag in flags])
项目:rekall-agent-server    作者:rekall-innovations    | 项目源码 | 文件源码
def store(self, *args):
        """
        implements some flag commands
        args: ("<id>", "<+|->FLAGS", "(\\Flag1 \\Flag2 ... \\Flagn)")
        """
        message = self.spam[self._mailbox][int(args[0] - 1)]
        old_flags = ParseFlags(message["flags"])
        flags = ParseFlags("FLAGS" + args[2])
        if args[1].strip().startswith("+"):
            message["flags"] = "FLAGS (%s)" % " ".join(set(flags + old_flags))
        elif args[1].strip().startswith("-"):
            message["flags"] = "FLAGS (%s)" % " ".join([flag for flag in old_flags if not flag in flags])
项目:qxf2-page-object-model    作者:qxf2    | 项目源码 | 文件源码
def parse_flags(self, headers):
        return list(ParseFlags(headers))
        # flags = re.search(r'FLAGS \(([^\)]*)\)', headers).groups(1)[0].split(' ')
项目:StuffShare    作者:StuffShare    | 项目源码 | 文件源码
def store(self, *args):
        """
        implements some flag commands
        args: ("<id>", "<+|->FLAGS", "(\\Flag1 \\Flag2 ... \\Flagn)")
        """
        message = self.spam[self._mailbox][int(args[0] - 1)]
        old_flags = ParseFlags(message["flags"])
        flags = ParseFlags("FLAGS" + args[2])
        if args[1].strip().startswith("+"):
            message["flags"] = "FLAGS (%s)" % " ".join(set(flags + old_flags))
        elif args[1].strip().startswith("-"):
            message["flags"] = "FLAGS (%s)" % " ".join([flag for flag in old_flags if not flag in flags])