From bfb02d64a88bf9ca0bbd78cf389c9c648adbf725 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Thu, 26 Nov 2015 01:02:07 +0000 Subject: Make poezio.core.struct more Cython-friendly. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Status and Command are now slotted classes instead of namedtuples, which led to a few changes to access them with their named parameters instead of as a tuple. “short” being a C type, I renamed Command.short into Command.short_desc, which is more explicit anyway. I also renamed possible_show into POSSIBLE_SHOW, as it is a module-level constant dict. --- poezio/core/core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'poezio/core/core.py') diff --git a/poezio/core/core.py b/poezio/core/core.py index ab234367..089454ec 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -45,7 +45,7 @@ import keyboard from . import completions from . import commands from . import handlers -from . structs import possible_show, DEPRECATED_ERRORS, \ +from . structs import POSSIBLE_SHOW, DEPRECATED_ERRORS, \ ERROR_AND_STATUS_CODES, Command, Status @@ -61,7 +61,7 @@ class Core(object): self.connection_time = time.time() self.stdscr = None status = config.get('status') - status = possible_show.get(status, None) + status = POSSIBLE_SHOW.get(status, None) self.status = Status(show=status, message=config.get('status_message')) self.running = True @@ -716,11 +716,11 @@ class Core(object): if line == "": return if line.startswith('/'): - command = line.strip()[:].split()[0][1:] + command = line.strip().split()[0][1:] arg = line[2+len(command):] # jump the '/' and the ' ' # example. on "/link 0 open", command = "link" and arg = "0 open" if command in self.commands: - func = self.commands[command][0] + func = self.commands[command].func func(arg) return else: -- cgit v1.2.3