(self)
Iterate over each item and its duration.
Iterate over each item and its duration.
Iterate over each item and its duration .
def items(self):
        """Iterate over each item and its duration."""
        self._check_expired()
        last_expiry = datetime.datetime.now()
        for item, expiry, _ in self._deque:
            if expiry is None:
                duration = None
            else:
                # adjust duration
                duration = (expiry - last_expiry).total_seconds()
                last_expiry = expiry
            yield item, duration
def items ( self ) : self . _check_expired ( ) last_expiry = datetime . datetime . now ( ) for item , expiry , _ in self . _deque : if expiry is None : duration = None else : # adjust duration duration = ( expiry - last_expiry ) . total_seconds ( ) last_expiry = expiry yield item , duration