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

Function quoteaddr

Lib/smtplib.py:144–155  ·  view source on GitHub ↗

Quote a subset of the email addresses defined by RFC 821. Should be able to handle anything email.utils.parseaddr can handle.

(addrstring)

Source from the content-addressed store, hash-verified

142 """
143
144def quoteaddr(addrstring):
145 """Quote a subset of the email addresses defined by RFC 821.
146
147 Should be able to handle anything email.utils.parseaddr can handle.
148 """
149 displayname, addr = email.utils.parseaddr(addrstring)
150 if (displayname, addr) == ('', ''):
151 # parseaddr couldn't parse it, use it as is and hope for the best.
152 if addrstring.strip().startswith('<'):
153 return addrstring
154 return "<%s>" % addrstring
155 return "<%s>" % addr
156
157def _addr_only(addrstring):
158 displayname, addr = email.utils.parseaddr(addrstring)

Callers 2

mailMethod · 0.85
rcptMethod · 0.85

Calls 2

startswithMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…