Return the key associated to a registered file object. Returns: SelectorKey for this file object
(self, fileobj)
| 182 | pass |
| 183 | |
| 184 | def get_key(self, fileobj): |
| 185 | """Return the key associated to a registered file object. |
| 186 | |
| 187 | Returns: |
| 188 | SelectorKey for this file object |
| 189 | """ |
| 190 | mapping = self.get_map() |
| 191 | if mapping is None: |
| 192 | raise RuntimeError('Selector is closed') |
| 193 | try: |
| 194 | return mapping[fileobj] |
| 195 | except KeyError: |
| 196 | raise KeyError("{!r} is not registered".format(fileobj)) from None |
| 197 | |
| 198 | @abstractmethod |
| 199 | def get_map(self): |