(values: dict[str, int])
| 172 | |
| 173 | |
| 174 | def _encode_str_values(values: dict[str, int]) -> list[bytes]: |
| 175 | value_by_index = {index: value for value, index in values.items()} |
| 176 | result = [] |
| 177 | line: list[bytes] = [] |
| 178 | line_len = 0 |
| 179 | for i in range(len(values)): |
| 180 | value = value_by_index[i] |
| 181 | c_literal = format_str_literal(value) |
| 182 | c_len = len(c_literal) |
| 183 | if line_len > 0 and line_len + c_len > 70: |
| 184 | result.append(format_int(len(line)) + b"".join(line)) |
| 185 | line = [] |
| 186 | line_len = 0 |
| 187 | line.append(c_literal) |
| 188 | line_len += c_len |
| 189 | if line: |
| 190 | result.append(format_int(len(line)) + b"".join(line)) |
| 191 | result.append(b"") |
| 192 | return result |
| 193 | |
| 194 | |
| 195 | def _encode_bytes_values(values: dict[bytes, int]) -> list[bytes]: |
searching dependent graphs…