Show More
@@ -467,9 +467,8 b' def mimeencode(ui, s, charsets=None, dis' | |||||
467 | return mimetextqp(s, 'plain', cs) |
|
467 | return mimetextqp(s, 'plain', cs) | |
468 |
|
468 | |||
469 |
|
469 | |||
470 | if pycompat.ispy3: |
|
470 | Generator = email.generator.BytesGenerator | |
471 |
|
471 | |||
472 | Generator = email.generator.BytesGenerator |
|
|||
473 |
|
472 | |||
474 |
|
|
473 | def parse(fp): | |
475 |
|
|
474 | # type: (Any) -> email.message.Message | |
@@ -485,27 +484,13 b' if pycompat.ispy3:' | |||||
485 |
|
|
484 | finally: | |
486 |
|
|
485 | fp.detach() | |
487 |
|
486 | |||
|
487 | ||||
488 |
|
|
488 | def parsebytes(data): | |
489 |
|
|
489 | # type: (bytes) -> email.message.Message | |
490 |
|
|
490 | ep = email.parser.BytesParser() | |
491 |
|
|
491 | return ep.parsebytes(data) | |
492 |
|
492 | |||
493 |
|
493 | |||
494 | else: |
|
|||
495 |
|
||||
496 | Generator = email.generator.Generator |
|
|||
497 |
|
||||
498 | def parse(fp): |
|
|||
499 | # type: (Any) -> email.message.Message |
|
|||
500 | ep = email.parser.Parser() |
|
|||
501 | return ep.parse(fp) |
|
|||
502 |
|
||||
503 | def parsebytes(data): |
|
|||
504 | # type: (str) -> email.message.Message |
|
|||
505 | ep = email.parser.Parser() |
|
|||
506 | return ep.parsestr(data) |
|
|||
507 |
|
||||
508 |
|
||||
509 | def headdecode(s): |
|
494 | def headdecode(s): | |
510 | # type: (Union[email.header.Header, bytes]) -> bytes |
|
495 | # type: (Union[email.header.Header, bytes]) -> bytes | |
511 | '''Decodes RFC-2047 header''' |
|
496 | '''Decodes RFC-2047 header''' |
General Comments 0
You need to be logged in to leave comments.
Login now