MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _normalize

Method _normalize

tools/python-3.11.9-amd64/Lib/email/header.py:389–405  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

387 return value
388
389 def _normalize(self):
390 # Step 1: Normalize the chunks so that all runs of identical charsets
391 # get collapsed into a single unicode string.
392 chunks = []
393 last_charset = None
394 last_chunk = []
395 for string, charset in self._chunks:
396 if charset == last_charset:
397 last_chunk.append(string)
398 else:
399 if last_charset is not None:
400 chunks.append((SPACE.join(last_chunk), last_charset))
401 last_chunk = [string]
402 last_charset = charset
403 if last_chunk:
404 chunks.append((SPACE.join(last_chunk), last_charset))
405 self._chunks = chunks
406
407
408class _ValueFormatter:

Callers 2

__str__Method · 0.95
encodeMethod · 0.95

Calls 2

appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected