Get a seq of Commandchain objects that match key
(self, key)
| 41 | self.regexs[regex] = chain |
| 42 | |
| 43 | def dispatch(self, key): |
| 44 | """ Get a seq of Commandchain objects that match key """ |
| 45 | if key in self.strs: |
| 46 | yield self.strs[key] |
| 47 | |
| 48 | for r, obj in self.regexs.items(): |
| 49 | if re.match(r, key): |
| 50 | yield obj |
| 51 | else: |
| 52 | # print("nomatch",key) # dbg |
| 53 | pass |
| 54 | |
| 55 | def __repr__(self): |
| 56 | return "<Strdispatch %s, %s>" % (self.strs, self.regexs) |