bgm4dZddlZddlmZddlmZddlmZddlZddlm Z ddlm Z ddl m Z dd l mZdd lmZeeeZd e d dfd Zejdde d dfdZde d dfdZdeeefd efdZded dfdZdS)zASubmit failure or test session information to a pastebin service.N)StringIO)IO)Union)Config)create_terminal_writer)Parser)StashKey)TerminalReporterparserreturnc l|d}|dddddddgd dS) Nzterminal reportingz --pastebinmodestorepastebinfailedallz3Send failed|all info to bpaste.net pastebin service)metavaractiondestdefaultchoiceshelp)getgroup _addoption)r groups a/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/_pytest/pastebin.pypytest_addoptionrsU OO0 1 1E  5! BT)trylastconfigcjjdkr]jd}|Ct jdjt<|jj fd}||j_ dSdSdS)Nrterminalreporterzw+bc|fi|t|tr|d}jt|dS)Nutf-8) isinstancestrencodestashpastebinfile_keywrite)skwargsr oldwrites r tee_writez#pytest_configure..tee_write+s`%%f%%%a%%*))A -.44Q77777r) optionr pluginmanager getplugintempfile TemporaryFiler(r)_twr*)r trr.r-s` @rpytest_configurer6s }&&  ! + +,> ? ? >-5-CE-J-JFL) *v|H 8 8 8 8 8 8 %BFLLL!'& >rct|jvr|jt}|d|}||jt=|jd}|jjd=| ddt|}| d|zdSdS)Nrr"r*=$Sending information to Paste Servicezpastebin session-log: %s ) r)r(seekreadcloser0r1r4__dict__ write_sepcreate_new_paste write_line)r pastebinfile sessionlogr5 pastebinurls rpytest_unconfigurerD4s6<''|$45 !!&&((  L) *  ! + +,> ? ? FOG $ S@AAA&z22  2[@AAAAA('rcontentsc~ddl}ddlm}ddlm}|ddd}d} ||||d  d }n#t$r}d |zcYd}~Sd}~wwxYw| d |}|r|d| dSd|zdzS)zCreate a new paste using the bpaste.net service. :contents: Paste contents string. :returns: URL to the pasted contents, or an error message. rN)urlopen) urlencodetext1week)codelexerexpiryzhttps://bpa.stascii)datar$zbad response: %szhref="/raw/(\w+)"z/show/zbad response: invalid format ('z')) reurllib.requestrG urllib.parserHr'r;decodeOSErrorsearchr) rErQrGrHparamsurlresponseexc_infoms rr?r?Es III&&&&&&&&&&&&7 C CF C- GCii//66w?? @ @ @ E E G G N Nw W W  ---!H,,,,,,,- &11AC))QWWQZZ)))08;dBBsAA)) B3A=7B=Br"c(|jjjdkrdSd|jvr|dd|jdD]} |jjjdj}n%#t$r| |}YnwxYwt}t|j|}| ||}t|sJt!|}||d|dSdS)Nrr8r9z --> )r r/rstatsr>longrepr reprtraceback reprentries reprfilelocAttributeError_getfailureheadlinerr toterminalgetvaluelenr?r@)r"repmsgfiletwr+rCs rpytest_terminal_summaryrl^s=%.(::#)))""3(NOOO#)(3 D DC @l0rxsGG !!!!!!111111,,,,,,""""""------'8BuI&(( V     %V%%%%%(BvB$BBBB"CuS%Z0CSCCCC2D.>D4DDDDDDr