This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
2019-02-25 18:43:33 +00:00
|
|
|
"""passbook UI utils"""
|
2020-05-10 13:29:10 +00:00
|
|
|
from typing import Any, List
|
2019-02-25 18:43:33 +00:00
|
|
|
|
2019-12-31 11:51:16 +00:00
|
|
|
|
2020-05-10 13:29:10 +00:00
|
|
|
def human_list(_list: List[Any]) -> str:
|
2019-02-25 18:43:33 +00:00
|
|
|
"""Convert a list of items into 'a, b or c'"""
|
|
|
|
last_item = _list.pop()
|
2020-05-10 13:29:10 +00:00
|
|
|
if len(_list) < 1:
|
|
|
|
return last_item
|
2019-12-31 11:51:16 +00:00
|
|
|
result = ", ".join(_list)
|
|
|
|
return "%s or %s" % (result, last_item)
|