MCPcopy Index your code
hub / github.com/python/cpython / _normalize

Method _normalize

Lib/email/header.py:398–414  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

396 return value
397
398 def _normalize(self):
399 # Step 1: Normalize the chunks so that all runs of identical charsets
400 # get collapsed into a single unicode string.
401 chunks = []
402 last_charset = None
403 last_chunk = []
404 for string, charset in self._chunks:
405 if charset == last_charset:
406 last_chunk.append(string)
407 else:
408 if last_charset is not None:
409 chunks.append((SPACE.join(last_chunk), last_charset))
410 last_chunk = [string]
411 last_charset = charset
412 if last_chunk:
413 chunks.append((SPACE.join(last_chunk), last_charset))
414 self._chunks = chunks
415
416
417class _ValueFormatter:

Callers 2

__str__Method · 0.95
encodeMethod · 0.95

Calls 2

appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected