summaryrefslogtreecommitdiff
path: root/src/text_buffer.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-04-06 19:52:59 +0200
committermathieui <mathieui@mathieui.net>2014-04-06 19:58:57 +0200
commite216fd2112c796bd625730f711861b7361f6fe9f (patch)
tree942239b0bf00dec0f9afd9e036a1bcedf449e6d3 /src/text_buffer.py
parent218c71dfbfb9f564eb1ec2a966df24eef2efbdec (diff)
downloadpoezio-e216fd2112c796bd625730f711861b7361f6fe9f.tar.gz
poezio-e216fd2112c796bd625730f711861b7361f6fe9f.tar.bz2
poezio-e216fd2112c796bd625730f711861b7361f6fe9f.tar.xz
poezio-e216fd2112c796bd625730f711861b7361f6fe9f.zip
Code cleanup
fixes whitespace issues, some builtin overrides, and some enormous lines might make poezio run nanoseconds faster!
Diffstat (limited to 'src/text_buffer.py')
-rw-r--r--src/text_buffer.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/text_buffer.py b/src/text_buffer.py
index 919fbe8c..b2915a61 100644
--- a/src/text_buffer.py
+++ b/src/text_buffer.py
@@ -21,7 +21,8 @@ from theming import get_theme
message_fields = 'txt nick_color time str_time nickname user identifier highlight me old_message revisions jid'
Message = collections.namedtuple('Message', message_fields)
-class CorrectionError(Exception): pass
+class CorrectionError(Exception):
+ pass
def other_elems(self):
acc = ['Message(']
@@ -29,16 +30,16 @@ def other_elems(self):
fields.remove('old_message')
for field in fields:
acc.append('%s=%s' % (field, repr(getattr(self, field))))
- return (', '.join(acc) + ', old_message=')
+ return ', '.join(acc) + ', old_message='
def repr_message(self):
init = other_elems(self)
acc = [init]
- next = self.old_message
+ next_message = self.old_message
rev = 1
- while next:
- acc.append(other_elems(next))
- next = next.old_message
+ while next_message:
+ acc.append(other_elems(next_message))
+ next_message = next_message.old_message
rev += 1
acc.append('None')
while rev:
@@ -69,7 +70,8 @@ class TextBuffer(object):
return self.messages[-1] if self.messages else None
- def make_message(self, txt, time, nickname, nick_color, history, user, identifier, str_time=None, highlight=False, old_message=None, revisions=0, jid=None):
+ @staticmethod
+ def make_message(txt, time, nickname, nick_color, history, user, identifier, str_time=None, highlight=False, old_message=None, revisions=0, jid=None):
time = time or datetime.now()
me = False
if txt.startswith('/me '):