fQBdZgdZddlZddlmZdZd dZd dZd dZy) z1Various types of useful iterators and generators.)body_line_iteratortyped_subpart_iteratorwalkN)StringIOc#K||jr.|jD]}|jEd{yy7w)zWalk 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)selfsubparts &/usr/lib/python3.12/email/iterators.pyrrsH J '') &G||~ % % & %s;AA Ac#K|jD]8}|j|}t|ts&t |Ed{:y7w)zIterate over the parts, returning string payloads line-by-line. Optional decode (default False) is passed through to .get_payload(). )decodeN)rr isinstancestrr)msgrr payloads r rr sM 88:)%%V%4 gs #( ( () )s6AAAAc#K|jD]0}|j|k(s||j|k(s-|2yw)zIterate 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)rget_content_maintypeget_content_subtype)rmaintypesubtyper s r rr+sH88:  ' ' )X 5'"="="?7"J s'AAAc>|tj}d|dzz}t||jzd||rtd|j z|n t||j r'|j D]}t|||dz|yy) zA handy debugging aidN )endfilez [%s])r)sysstdoutprintget_content_typeget_default_typerr _structure)rfplevelinclude_defaulttabr s r r$r$8s z ZZ  C #$$& &BR8 g,,..R8 2 ( >G wE!G_ = >)F)textN)NrF) __doc____all__riorrrrr$r)r r/s- 8   &)  >r)