Python email.message.get_labels() Examples

The following are 30 code examples of email.message.get_labels(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module email.message , or try the search function .
Example #1
Source File: mailbox.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #2
Source File: mailbox.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #3
Source File: mailbox.py    From android_universal with MIT License 5 votes vote down vote up
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 
Example #4
Source File: mailbox.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
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)) 
Example #5
Source File: mailbox.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
def get_labels(self):
        """Return a list of labels on the message."""
        return self._labels[:] 
Example #6
Source File: mailbox.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #7
Source File: mailbox.py    From android_universal with MIT License 5 votes vote down vote up
def get_labels(self):
        """Return a list of labels on the message."""
        return self._labels[:] 
Example #8
Source File: mailbox.py    From android_universal with MIT License 5 votes vote down vote up
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) 
Example #9
Source File: mailbox.py    From android_universal with MIT License 5 votes vote down vote up
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) 
Example #10
Source File: mailbox.py    From android_universal with MIT License 5 votes vote down vote up
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() 
Example #11
Source File: mailbox.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #12
Source File: mailbox.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
def get_labels(self):
        """Return a list of labels on the message."""
        return self._labels[:] 
Example #13
Source File: mailbox.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
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)) 
Example #14
Source File: mailbox.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #15
Source File: mailbox.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #16
Source File: mailbox.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
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 
Example #17
Source File: mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def get_labels(self):
        """Return a list of labels on the message."""
        return self._labels[:] 
Example #18
Source File: mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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)) 
Example #19
Source File: mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #20
Source File: mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #21
Source File: mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #22
Source File: mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def get_labels(self):
        """Return a list of labels on the message."""
        return self._labels[:] 
Example #23
Source File: mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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)) 
Example #24
Source File: mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #25
Source File: mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #26
Source File: mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #27
Source File: mailbox.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def get_labels(self):
        """Return a list of labels on the message."""
        return self._labels[:] 
Example #28
Source File: mailbox.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #29
Source File: mailbox.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #30
Source File: mailbox.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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()