Skip to content

Commit

Permalink
result_summary: restore missing split_query_params function
Browse files Browse the repository at this point in the history
Restore this function that was accidentally removed during the last
refactoring.

Signed-off-by: Ricardo Cañuelo <[email protected]>
  • Loading branch information
Ricardo Cañuelo authored and r-c-n committed Apr 24, 2024
1 parent 52afc5d commit fa9afb0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/result_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def _setup(self, args):
# Additional query parameters
extra_query_params = {}
if args.query_params:
extra_query_params = split_query_params(args.query_params)
extra_query_params = utils.split_query_params(args.query_params)
output_dir = None
if args.output_dir:
output_dir = args.output_dir
Expand Down
19 changes: 19 additions & 0 deletions src/result_summary/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,30 @@
# Common utils for result-summary.

import gzip
import re
import requests

import result_summary


def split_query_params(query_string):
"""Given a string input formatted like this:
parameter1=value1,parameter2=value2,...,parameterN=valueN
return a dict containing the string information where the
parameters are the dict keys:
{'parameter1': 'value1',
'parameter2': 'value2',
...,
'parameterN': 'valueN'
}
"""
query_dict = {}
matches = re.findall('([^ =,]+)\s*=\s*([^ =,]+)', query_string) # noqa: W605
for operator, value in matches:
query_dict[operator] = value
return query_dict


def parse_block_config(block, kind, state):
"""Parse a config block. Every block may define a set of
parameters, including a list of 'repos' (trees/branches). For
Expand Down

0 comments on commit fa9afb0

Please sign in to comment.