Update client

pull/1794/head
H Lohaus 2 months ago committed by GitHub
parent 8335359c96
commit 912dc63497
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,16 @@
import re
def read_json(text: str) -> dict:
"""
Parses JSON code block from a string.
Args:
text (str): A string containing a JSON code block.
Returns:
dict: A dictionary parsed from the JSON code block.
"""
match = re.search(r"```(json|)\n(?P<code>[\S\s]+?)\n```", text)
if match:
return match.group("code")
return text
Loading…
Cancel
Save