Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1""" 

2Controller 

3 

4There should be no deep logic 

5""" 

6from collections.abc import Mapping 

7from typing import Iterator 

8 

9from processor.core.command import RegisteredCommands 

10 

11 

12class CommandList(Mapping): 

13 _commands = RegisteredCommands() 

14 

15 def __init__(self, *args, **kwargs): 

16 pass 

17 

18 def __getitem__(self, key: str): 

19 return self._commands[self._keytransform(key)] 

20 

21 def __iter__(self) -> Iterator: 

22 return iter(self._commands) 

23 

24 def __len__(self) -> int: 

25 return len(self._commands) 

26 

27 def _keytransform(self, key: str): 

28 return key