Rename ModuleList.get_by_id to get_module_by_id

This commit is contained in:
enkore 2013-10-23 16:54:30 +02:00
parent 67faff6e0f
commit 1de1eaae87
2 changed files with 2 additions and 3 deletions

View File

@ -51,7 +51,7 @@ class Status:
def run_command_endpoint(self): def run_command_endpoint(self):
for command in io.JSONIO(io=io.IOHandler(sys.stdin, open(os.devnull, "w")), skiplines=1).read(): for command in io.JSONIO(io=io.IOHandler(sys.stdin, open(os.devnull, "w")), skiplines=1).read():
module = self.modules.get_by_id(command["instance"]) module = self.modules.get_module_by_id(command["instance"])
if module: if module:
module.on_click(command["button"]) module.on_click(command["button"])

View File

@ -82,12 +82,11 @@ class ModuleList(collections.UserList):
super().append(module) super().append(module)
return module return module
def get_by_id(self, find_id): def get_module_by_id(self, find_id):
find_id = int(find_id) find_id = int(find_id)
for module in self: for module in self:
if int(id(module)) == find_id: if int(id(module)) == find_id:
return module return module
return None
class PrefixedKeyDict(collections.UserDict): class PrefixedKeyDict(collections.UserDict):