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

Method getatom

Lib/email/_parseaddr.py:475–493  ·  view source on GitHub ↗

Parse an RFC 2822 atom. Optional atomends specifies a different set of end token delimiters (the default is to use self.atomends). This is used e.g. in getphraselist() since phrase endings must not include the '.' (which is legal in phrases).

(self, atomends=None)

Source from the content-addressed store, hash-verified

473 return '[%s]' % self.getdelimited('[', ']\r', False)
474
475 def getatom(self, atomends=None):
476 """Parse an RFC 2822 atom.
477
478 Optional atomends specifies a different set of end token delimiters
479 (the default is to use self.atomends). This is used e.g. in
480 getphraselist() since phrase endings must not include the '.' (which
481 is legal in phrases)."""
482 atomlist = ['']
483 if atomends is None:
484 atomends = self.atomends
485
486 while self.pos < len(self.field):
487 if self.field[self.pos] in atomends:
488 break
489 else:
490 atomlist.append(self.field[self.pos])
491 self.pos += 1
492
493 return EMPTYSTRING.join(atomlist)
494
495 def getphraselist(self):
496 """Parse a sequence of RFC 2822 phrases.

Callers 3

getaddrspecMethod · 0.95
getdomainMethod · 0.95
getphraselistMethod · 0.95

Calls 2

appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected