Wc$& ddlZddlZddlZddgZdZej eeddZejdjZ Gd d e Z d Z d Zd ZdZdZdZddgfdZddZgfdZdZdZdZedkr edSdS)Ngetcaps findmatchztThe {name} module is deprecated and will be removed in Python {remove}. See the mimetypes module for an alternative.) )removec"d|vr d|dfSdS)Nlinenor)r)entrys /usr/lib64/python3.12/mailcap.pylineno_sort_keyrs!5%/!!tz[^\xa1-\U0010FFFF\w@+=:,./-]ceZdZdS)UnsafeMailcapInputN)__name__ __module__ __qualname__r rr rrs33rrc  i}d}tD]^} t|d}|5t||\}}dddj D]\}}||vr|||<|||z||<`|S#t$rYnwxYw#1swYLxYw)Nrr)listmailcapfilesopenOSError_readmailcapfileitems)capsr mailcapfpmorecapskeyvalues r rrs D F#% . . gs#B < </F; Hf < < < < <"..* . .JC$;;!S  I-S  . K    H  < < < < < < < <  Orcf tjdtdt|d\}}|S)Nz2readmailcapfile is deprecated, use getcaps instead)warningswarnDeprecationWarningr)rr_s r readmailcapfiler3Ks3I MMF$a))r4(GD! Krc@ i} |j}|s ||fS|ddks|jdkr;|}|dddkr'|j}|sd}|dd|z}|dddkr't|\}}|r|s| ||d<|dz }|jd }t t |D]}||j||<d j |j}||vr||j|n|g||<) Nr r#z\  r /) readlinestrip parseliner(rangelenjoinlowerappend) rr rlinenextliner fieldstypesjs r rrSsU D {{}tU6 <3 7c>>TZZ\R// rsmv%%{{}H8X9x'Drsmv%%  o V   %F8  aKF #s5z" ( (AQx~~'E!HHhhuo##% $;; I  V $ $ $DI9 rc g}dt|}}||kr0t|||\}}|j||dz}||kr0t|dkrdS|d|d|dd}}}d|i}|D]T}|jd}|dkr|}d} n+|d|j }||dzdj } ||vrP| ||<V||fS)Nrr r.NNview=r6)r> parsefieldrAfindr;) rBrDinfieldr rIrestfkeyfvalues r r<r<|s F c$iqA a%%dAq)q e aC a%% 6{QzQiF12JtCd^F " " JJsO q55DFF!9??$D1Q34[&&(F 6>> !F4LL ;rc |}||kr'||}|dkrn|dkr|dz}n|dz}||kr'|||j|fS)N;\r.r )r;)rBrMrNstartcs r rKrKsm9 E a%% G 88  $YY!AA!A a%% a=   ! ##rrIz /dev/nullcF t|r%d|d}tj|tdSt |||}|D]Z}d|vr6t |d||}||rt j|dkr=t |||||} | V| |fcSdS)Nz&Refusing to use mailcap with filename z . Use a safe temporary filename.rHtestr) _find_unsafer/r0rlookupsubstr&system) rMIMEtyper filenameplistmsgentrieserYcommands r rrsH\d\d\df c-..zT8S)G    Q;;6He4D|t $1,,#(E:  A:    :rcg}||vr |||z}|jd}|ddz}||vr |||z} fd|D}t|t}|S)Nr9rz/*c g|] }|vs| Sr r ).0rcr s r zlookup..s 2221112r)r )r(sortedr)rr^r rb MIMEtypess ` r r[r[sG4DN*s#I|d"H4DN* 2222g22W/22G Nrc~d}dt|}}||kr$||}|dz}|dkr|dkr |||dz}|dz}||z}n||}|dz}|dkr||z}n|dkr||z}n|dkr8t|r%d|d }tj|tdS||z}n|d kr|} ||kr$||d kr|dz}||kr ||d kr|| |} |dz}t | |} t| r(d | d | d}tj|tdS|| z}n|dz|z}||kr$|S)Nr6rr %rUstz!Refusing to substitute MIME type z into a shell command.{}z!Refusing to substitute parameter z (z) into a shell command)r>rZr/r0r findparam) rOr^r_r`resrMrNrWrarVnameparams r r\r\s C c%jqA a%% !H!A#a 88Dyy!AaCLac!'CCaAac!CxxAgcHnc)))YaYaYacCMM#'9::4Hnc!eeaC!A!eeaCU1~aC!$.&&&]b]b]bdhdhdhiCMM#'9::4Ek Ci!mE a%%F Jrc|jdz}t|}|D]!}|d|j|ks||dcSdS)NrJr6)r@r>)rsr`rNps r rqrqsV ::<# D D A  Ra5;;=D QR5LLL 2rc$ddl}t}|jddst|dSt dt |jdD]}|j||dz}t |dkrt ddS|d}|d}t||d|\}}|st dtot d|tj|}tj|}|st d|dS) Nrr r.z"usage: mailcap [MIMEtype file] ...rIzNo viewer found forz Executing:z Exit status:) sysrargvshowr=r>printrtyper&r]waitstatus_to_exitcode) rxrrMargsr^filerdrcstss r rYrYs JJJ 9D 88AB<< T  1c#((mQ '++xx!A# t9q== 6 7 7 FF7AwtXvt< w ' . . . , ( ())G$C++C0Csnc***++rctdtD]}td|zt|s t}tdtt|}|D]S}t|||}|D]8}t|}|D]}td|z||t:UdS)NzMailcap files: zMailcap entries:z %-15s)r{rrri)rfnckeysr|rbrckeysks r rzrzs  22%r "2"2"2 GG 4   GG 4LE d t*  A!9D + +i!mQqT*** GGG  r__main__)N)r&r/re__all___DEPRECATION_MSG _deprecatedrrcompilesearchrZWarningrrrr3rr<rKrr[r\rqrYrzr rr rs+  [ !#X/@@@rzz9:AA 4444444 4$'''R> $ $ $ #);b6    ,.''''R+++." zDFFFFr