Returns the next object to be returned by :meth:`pop`, but without removing it from the queue. Raises :exc:`NotImplementedError` if the underlying queue class does not implement a ``peek`` method, which is optional for queues.
(self)
| 52 | return None |
| 53 | |
| 54 | def peek(self) -> Any | None: |
| 55 | """Returns the next object to be returned by :meth:`pop`, |
| 56 | but without removing it from the queue. |
| 57 | |
| 58 | Raises :exc:`NotImplementedError` if the underlying queue class does |
| 59 | not implement a ``peek`` method, which is optional for queues. |
| 60 | """ |
| 61 | try: |
| 62 | s = super().peek() |
| 63 | except AttributeError as ex: |
| 64 | raise NotImplementedError( |
| 65 | "The underlying queue class does not implement 'peek'" |
| 66 | ) from ex |
| 67 | if s: |
| 68 | return deserialize(s) |
| 69 | return None |
| 70 | |
| 71 | return SerializableQueue |
| 72 |
no outgoing calls