Append a value to a list of values Args: key: The key identifying the list; the list will be created if needed. value: The value to append.
(self, key: str, value: str)
| 120 | self[key] = value |
| 121 | |
| 122 | def append(self, key: str, value: str) -> None: |
| 123 | """Append a value to a list of values |
| 124 | |
| 125 | Args: |
| 126 | key: The key identifying the list; the list will be created if needed. |
| 127 | value: The value to append. |
| 128 | """ |
| 129 | if key not in self._params: |
| 130 | self._params[key] = value |
| 131 | broadcast_notification( |
| 132 | QueryParamsAppendNotification(key, value), self._stream |
| 133 | ) |
| 134 | self._set_value(self._params) |
| 135 | return |
| 136 | |
| 137 | current_value = self._params[key] |
| 138 | if isinstance(current_value, list): |
| 139 | current_value.append(value) |
| 140 | else: |
| 141 | self._params[key] = [current_value, value] |
| 142 | |
| 143 | broadcast_notification( |
| 144 | QueryParamsAppendNotification(key, value), self._stream |
| 145 | ) |
| 146 | self._set_value(self._params) |
| 147 | |
| 148 | def remove(self, key: str, value: str | None = None) -> None: |
| 149 | """Remove a value from a list of values. |