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/links.py
dece 8aee7fdfba gemtext: add links/title to parsing result
parse_gemtext used to return only the element list, requiring subsequent
loops to find a title or collect links; now it's all done at the same
time!
2021-03-28 18:55:52 +02:00

16 lines
395 B
Python

"""Links manager."""
from typing import List
class Links(dict):
def disambiguate(self, digits: str, max_digits: int):
"""Return the list of possible candidates for those digits."""
if len(digits) == max_digits:
return [int(digits)]
return [
link_id for link_id, url in self.items()
if str(link_id).startswith(digits)
]