Use TOC to return subpath for given key, or raise a KeyError.
(self, key)
| 607 | self._last_read = time.time() |
| 608 | |
| 609 | def _lookup(self, key): |
| 610 | """Use TOC to return subpath for given key, or raise a KeyError.""" |
| 611 | try: |
| 612 | if os.path.exists(os.path.join(self._path, self._toc[key])): |
| 613 | return self._toc[key] |
| 614 | except KeyError: |
| 615 | pass |
| 616 | self._refresh() |
| 617 | try: |
| 618 | return self._toc[key] |
| 619 | except KeyError: |
| 620 | raise KeyError('No message with key: %s' % key) from None |
| 621 | |
| 622 | # This method is for backward compatibility only. |
| 623 | def next(self): |