MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / parse_string

Function parse_string

notify.py:920–932  ·  view source on GitHub ↗
(input_string, value_format_fn=None)

Source from the content-addressed store, hash-verified

918
919
920def parse_string(input_string, value_format_fn=None):
921 matches = {}
922 pattern = r"(\w+):\s*((?:(?!\n\w+:).)*)"
923 regex = re.compile(pattern)
924 for match in regex.finditer(input_string):
925 key, value = match.group(1).strip(), match.group(2).strip()
926 try:
927 value = value_format_fn(value) if value_format_fn else value
928 json_value = json.loads(value)
929 matches[key] = json_value
930 except:
931 matches[key] = value
932 return matches
933
934
935def parse_body(body, content_type, value_format_fn=None):

Callers 1

parse_bodyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected