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

Method getphraselist

Lib/email/_parseaddr.py:495–516  ·  view source on GitHub ↗

Parse a sequence of RFC 2822 phrases. A phrase is a sequence of words, which are in turn either RFC 2822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space.

(self)

Source from the content-addressed store, hash-verified

493 return EMPTYSTRING.join(atomlist)
494
495 def getphraselist(self):
496 """Parse a sequence of RFC 2822 phrases.
497
498 A phrase is a sequence of words, which are in turn either RFC 2822
499 atoms or quoted-strings. Phrases are canonicalized by squeezing all
500 runs of continuous whitespace into one space.
501 """
502 plist = []
503
504 while self.pos < len(self.field):
505 if self.field[self.pos] in self.FWS:
506 self.pos += 1
507 elif self.field[self.pos] == '"':
508 plist.append(self.getquote())
509 elif self.field[self.pos] == '(':
510 self.commentlist.append(self.getcomment())
511 elif self.field[self.pos] in self.phraseends:
512 break
513 else:
514 plist.append(self.getatom(self.phraseends))
515
516 return plist
517
518class AddressList(AddrlistClass):
519 """An AddressList encapsulates a list of parsed RFC 2822 addresses."""

Callers 1

getaddressMethod · 0.95

Calls 4

getquoteMethod · 0.95
getcommentMethod · 0.95
getatomMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected