This repository has been archived on 2024-10-27. You can view files and clone it, but cannot push or open issues or pull requests.
local-llm-server/llm_server/helpers.py

20 lines
342 B
Python
Raw Normal View History

2023-08-21 21:28:52 -06:00
from pathlib import Path
def resolve_path(*p: str):
return Path(*p).expanduser().resolve().absolute()
2023-08-22 20:28:41 -06:00
def safe_list_get(l, idx, default):
"""
https://stackoverflow.com/a/5125636
:param l:
:param idx:
:param default:
:return:
"""
try:
return l[idx]
except IndexError:
return default