mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-02-16 15:13:18 +01:00
python: pep8 compliance for message.py
This commit is contained in:
parent
9562c7d1fb
commit
61f0184707
1 changed files with 63 additions and 66 deletions
|
@ -31,7 +31,8 @@ try:
|
||||||
import simplejson as json
|
import simplejson as json
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class Messages(object):
|
class Messages(object):
|
||||||
"""Represents a list of notmuch messages
|
"""Represents a list of notmuch messages
|
||||||
|
|
||||||
|
@ -222,7 +223,7 @@ class Messages(object):
|
||||||
sys.stdout.write(set_end)
|
sys.stdout.write(set_end)
|
||||||
sys.stdout.write(set_end)
|
sys.stdout.write(set_end)
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
class Message(object):
|
class Message(object):
|
||||||
"""Represents a single Email message
|
"""Represents a single Email message
|
||||||
|
|
||||||
|
@ -296,7 +297,6 @@ class Message(object):
|
||||||
#keep reference to parent, so we keep it alive
|
#keep reference to parent, so we keep it alive
|
||||||
self._parent = parent
|
self._parent = parent
|
||||||
|
|
||||||
|
|
||||||
def get_message_id(self):
|
def get_message_id(self):
|
||||||
"""Returns the message ID
|
"""Returns the message ID
|
||||||
|
|
||||||
|
@ -324,10 +324,11 @@ class Message(object):
|
||||||
if self._msg is None:
|
if self._msg is None:
|
||||||
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
||||||
|
|
||||||
return Message._get_thread_id (self._msg);
|
return Message._get_thread_id(self._msg)
|
||||||
|
|
||||||
def get_replies(self):
|
def get_replies(self):
|
||||||
"""Gets all direct replies to this message as :class:`Messages` iterator
|
"""Gets all direct replies to this message as :class:`Messages`
|
||||||
|
iterator
|
||||||
|
|
||||||
.. note:: This call only makes sense if 'message' was
|
.. note:: This call only makes sense if 'message' was
|
||||||
ultimately obtained from a :class:`Thread` object, (such as
|
ultimately obtained from a :class:`Thread` object, (such as
|
||||||
|
@ -346,7 +347,7 @@ class Message(object):
|
||||||
if self._msg is None:
|
if self._msg is None:
|
||||||
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
||||||
|
|
||||||
msgs_p = Message._get_replies(self._msg);
|
msgs_p = Message._get_replies(self._msg)
|
||||||
|
|
||||||
if msgs_p is None:
|
if msgs_p is None:
|
||||||
return None
|
return None
|
||||||
|
@ -557,8 +558,6 @@ class Message(object):
|
||||||
self.tags_to_maildir_flags()
|
self.tags_to_maildir_flags()
|
||||||
return STATUS.SUCCESS
|
return STATUS.SUCCESS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def remove_all_tags(self, sync_maildir_flags=False):
|
def remove_all_tags(self, sync_maildir_flags=False):
|
||||||
"""Removes all tags from the given message.
|
"""Removes all tags from the given message.
|
||||||
|
|
||||||
|
@ -684,7 +683,6 @@ class Message(object):
|
||||||
|
|
||||||
raise NotmuchError(status)
|
raise NotmuchError(status)
|
||||||
|
|
||||||
|
|
||||||
def is_match(self):
|
def is_match(self):
|
||||||
"""(Not implemented)"""
|
"""(Not implemented)"""
|
||||||
return self.get_flag(Message.FLAG.MATCH)
|
return self.get_flag(Message.FLAG.MATCH)
|
||||||
|
@ -753,7 +751,6 @@ class Message(object):
|
||||||
msg['date'] = date.fromtimestamp(self.get_date())
|
msg['date'] = date.fromtimestamp(self.get_date())
|
||||||
return "%(from)s (%(date)s) (%(tags)s)" % (msg)
|
return "%(from)s (%(date)s) (%(tags)s)" % (msg)
|
||||||
|
|
||||||
|
|
||||||
def get_message_parts(self):
|
def get_message_parts(self):
|
||||||
"""Output like notmuch show"""
|
"""Output like notmuch show"""
|
||||||
fp = open(self.get_filename())
|
fp = open(self.get_filename())
|
||||||
|
@ -858,11 +855,11 @@ class Message(object):
|
||||||
parts = format["body"]
|
parts = format["body"]
|
||||||
parts.sort(key=lambda x: x['id'])
|
parts.sort(key=lambda x: x['id'])
|
||||||
for p in parts:
|
for p in parts:
|
||||||
if not p.has_key("filename"):
|
if not "filename" in p:
|
||||||
output += "\n\fpart{ "
|
output += "\n\fpart{ "
|
||||||
output += "ID: %d, Content-type: %s\n" % (p["id"],
|
output += "ID: %d, Content-type: %s\n" % (p["id"],
|
||||||
p["content-type"])
|
p["content-type"])
|
||||||
if p.has_key("content"):
|
if "content" in p:
|
||||||
output += "\n%s\n" % p["content"]
|
output += "\n%s\n" % p["content"]
|
||||||
else:
|
else:
|
||||||
output += "Non-text part: %s\n" % p["content-type"]
|
output += "Non-text part: %s\n" % p["content-type"]
|
||||||
|
|
Loading…
Add table
Reference in a new issue