This repository has been archived on 2024-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Bebop/bebop/history.py

21 lines
526 B
Python
Raw Normal View History

2021-03-11 19:16:15 +01:00
"""History management."""
2021-02-18 01:40:05 +01:00
class History:
2021-03-11 19:16:15 +01:00
"""Basic browsing history manager."""
2021-02-18 01:40:05 +01:00
def __init__(self):
self.urls = []
def has_links(self):
"""Return True if there is at least one URL in the history."""
return bool(self.urls)
def push(self, url):
"""Add an URL to the history."""
if not self.urls or self.urls[-1] != url:
self.urls.append(url)
def pop(self):
"""Return latest URL added to history and remove it."""
return self.urls.pop()