U
iÛfW ã @ sL d Z dddgZddlZddlmZ dd„ Zdd d„Zddd„Zddd
„ZdS )z1Various types of useful iterators and generators.Úbody_line_iteratorÚtyped_subpart_iteratorÚwalké N)ÚStringIOc c s. | V | ¡ r*| ¡ D ]}| ¡ E dH qdS )z‰Walk over the message tree, yielding each subpart.
The walk is performed in depth-first order. This method is a
generator.
N)Úis_multipartÚget_payloadr )ÚselfÚsubpart© r
ú4/opt/alt/python38/lib64/python3.8/email/iterators.pyr s Fc c s6 | ¡ D ](}|j|d}t|tƒrt|ƒE dH qdS )zŽIterate over the parts, returning string payloads line-by-line.
Optional decode (default False) is passed through to .get_payload().
)ÚdecodeN)r r Ú
isinstanceÚstrr )Úmsgr r Zpayloadr
r
r r " s
Útextc c s8 | ¡ D ]*}| ¡ |kr|dks,| ¡ |kr|V qdS )zøIterate over the subparts with a given MIME type.
Use `maintype' as the main MIME type to match against; this defaults to
"text". Optional `subtype' is the MIME subtype to match against; if
omitted, only the main type is matched.
N)r Zget_content_maintypeZget_content_subtype)r ZmaintypeZsubtyper r
r
r r - s c C s€ |dkrt j}d|d }t|| ¡ d|d |rJtd| ¡ |d n
t|d | ¡ r|| ¡ D ]}t|||d |ƒ qddS ) zA handy debugging aidNú é Ú )ÚendÚfilez [%s])r é )ÚsysÚstdoutÚprintZget_content_typeZget_default_typer r Ú
_structure)r ÚfpÚlevelZinclude_defaultZtabr r
r
r r ; s
r )F)r N)Nr F) Ú__doc__Ú__all__r Úior r r r r r
r
r
r Ú