pgai / extract.py
Beracles's picture
update prompts
9a20d2b
raw
history blame contribute delete
439 Bytes
import json
def extract(info_str):
"""Extract user, source, username, and all info"""
info = {} # a copy of hf_token in json format
try:
info = dict(json.loads(info_str))
except json.decoder.JSONDecodeError:
return "__fake__", None, None, None
user = info.get("user", "__fake__")
source = info.get("source", None)
username = info.get("username", None)
return user, source, username, info