MCPcopy Create free account
hub / github.com/catboost/catboost / parse_qs_binary

Function parse_qs_binary

library/python/strings/strings.py:187–220  ·  view source on GitHub ↗

Parse a query like original `parse_qs` from `urlparse`, `urllib.parse`, but query given as a bytes argument. Arguments: qs: percent-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in percent-encoded queries should be treated as blank b

(qs, keep_blank_values=False, strict_parsing=False, max_num_fields=None, separator=b'&')

Source from the content-addressed store, hash-verified

185
186
187def parse_qs_binary(qs, keep_blank_values=False, strict_parsing=False, max_num_fields=None, separator=b'&'):
188 """Parse a query like original `parse_qs` from `urlparse`, `urllib.parse`, but query given as a bytes argument.
189
190 Arguments:
191
192 qs: percent-encoded query string to be parsed
193
194 keep_blank_values: flag indicating whether blank values in
195 percent-encoded queries should be treated as blank byte strings.
196 A true value indicates that blanks should be retained as
197 blank byte strings. The default false value indicates that
198 blank values are to be ignored and treated as if they were
199 not included.
200
201 strict_parsing: flag indicating what to do with parsing errors.
202 If false (the default), errors are silently ignored.
203 If true, errors raise a ValueError exception.
204
205 max_num_fields: int. If set, then throws a ValueError if there
206 are more than n fields read by parse_qsl_binary().
207
208 separator: bytes. The symbol to use for separating the query arguments.
209 Defaults to &.
210
211 Returns a dictionary.
212 """
213 parsed_result = {}
214 pairs = parse_qsl_binary(qs, keep_blank_values, strict_parsing, max_num_fields=max_num_fields, separator=separator)
215 for name, value in pairs:
216 if name in parsed_result:
217 parsed_result[name].append(value)
218 else:
219 parsed_result[name] = [value]
220 return parsed_result
221
222
223def parse_qsl_binary(qs, keep_blank_values=False, strict_parsing=False, max_num_fields=None, separator=b'&'):

Callers

nothing calls this directly

Calls 2

parse_qsl_binaryFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected