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

Class AddrSpec

Lib/email/_header_value_parser.py:534–564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

532
533
534class AddrSpec(TokenList):
535
536 token_type = 'addr-spec'
537 as_ew_allowed = False
538
539 @property
540 def local_part(self):
541 return self[0].local_part
542
543 @property
544 def domain(self):
545 if len(self) < 3:
546 return None
547 return self[-1].domain
548
549 @property
550 def value(self):
551 if len(self) < 3:
552 return self[0].value
553 return self[0].value.rstrip()+self[1].value+self[2].value.lstrip()
554
555 @property
556 def addr_spec(self):
557 nameset = set(self.local_part)
558 if len(nameset) > len(nameset-DOT_ATOM_ENDS):
559 lp = quote_string(self.local_part)
560 else:
561 lp = self.local_part
562 if self.domain is not None:
563 return lp + '@' + self.domain
564 return lp
565
566
567class ObsLocalPart(TokenList):

Callers 1

get_addr_specFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…