You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/qs_codec/decode.py
+6-13Lines changed: 6 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -38,8 +38,7 @@ def decode(
38
38
Either a raw query string (``str``) or an already-parsed mapping (``Mapping[str, Any]``).
39
39
Passing a mapping is useful in tests or when a custom tokenizer is used upstream.
40
40
options:
41
-
``DecodeOptions`` controlling delimiter, duplicates policy, list & depth limits,
42
-
dot-notation, decoding charset, and more.
41
+
``DecodeOptions`` controlling delimiter, duplicates policy, list & depth limits, dot-notation, decoding charset, and more.
43
42
44
43
Returns
45
44
-------
@@ -49,15 +48,12 @@ def decode(
49
48
Raises
50
49
------
51
50
ValueError
52
-
If ``value`` is neither ``str`` nor ``Mapping``, or when limits are violated under
53
-
``raise_on_limit_exceeded=True``.
51
+
If ``value`` is neither ``str`` nor ``Mapping``, or when limits are violated under ``raise_on_limit_exceeded=True``.
54
52
55
53
Notes
56
54
-----
57
55
- Empty/falsey ``value`` returns an empty dict.
58
-
- When the *number of top-level tokens* exceeds ``list_limit`` and ``parse_lists`` is enabled,
59
-
the parser temporarily **disables list parsing** for this invocation to avoid quadratic work.
60
-
This mirrors the behavior of other ports and keeps large flat query strings efficient.
56
+
- When the *number of top-level tokens* exceeds ``list_limit`` and ``parse_lists`` is enabled, the parser temporarily **disables list parsing** for this invocation to avoid quadratic work. This mirrors the behavior of other ports and keeps large flat query strings efficient.
- If `comma=True` and `value` is a string that contains commas, split into a list.
123
-
- Otherwise, enforce the per-list length limit by comparing `current_list_length` to
124
-
`options.list_limit`. When `raise_on_limit_exceeded=True`, violations raise `ValueError`.
119
+
- Otherwise, enforce the per-list length limit by comparing `current_list_length` to `options.list_limit`. When `raise_on_limit_exceeded=True`, violations raise `ValueError`.
125
120
126
121
Returns either the original value or a list of values, without decoding (that happens later).
Split a composite key into *balanced* bracket segments.
105
107
106
-
- If ``allow_dots`` is True, convert dots to bracket groups first
107
-
(``a.b[c]`` → ``a[b][c]``) while leaving existing brackets intact.
108
-
- The *parent* (non‑bracket) prefix becomes the first segment, e.g.
109
-
``"a[b][c]"`` → ``["a", "[b]", "[c]"]``.
110
-
- Bracket groups are *balanced* using a counter so nested brackets
111
-
within a single group (e.g. ``"[with[inner]]"``) are treated as one
112
-
segment.
113
-
- When ``max_depth <= 0``, no splitting occurs; the key is returned as
114
-
a single segment (qs semantics).
115
-
- If there are more groups beyond ``max_depth`` and ``strict_depth`` is
116
-
True, an ``IndexError`` is raised. Otherwise, the remainder is added
117
-
as one final segment (again mirroring qs).
108
+
- If ``allow_dots`` is True, convert dots to bracket groups first (``a.b[c]`` → ``a[b][c]``) while leaving existing brackets intact.
109
+
- The *parent* (non‑bracket) prefix becomes the first segment, e.g. ``"a[b][c]"`` → ``["a", "[b]", "[c]"]``.
110
+
- Bracket groups are *balanced* using a counter so nested brackets within a single group (e.g. ``"[with[inner]]"``) are treated as one segment.
111
+
- When ``max_depth <= 0``, no splitting occurs; the key is returned as a single segment (qs semantics).
112
+
- If there are more groups beyond ``max_depth`` and ``strict_depth`` is True, an ``IndexError`` is raised. Otherwise, the remainder is added as one final segment (again mirroring qs).
0 commit comments