| 532 | |
| 533 | |
| 534 | class 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 | |
| 567 | class ObsLocalPart(TokenList): |
no outgoing calls
no test coverage detected
searching dependent graphs…