HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/_pytest/__pycache__/pastebin.cpython-310.pyc
o

%wem�@s�dZddlZddlmZddlmZddlmZddlZddlm	Z	ddlm
Z
ddlmZdd	l
mZdd
lmZeee�Zdeddfd
d�Zejdd�de	ddfdd��Zde	ddfdd�Zdeeefdefdd�Zdeddfdd�ZdS)zASubmit failure or test session information to a pastebin service.�N)�StringIO)�IO)�Union)�Config)�create_terminal_writer)�Parser)�StashKey)�TerminalReporter�parser�returnc	Cs*|�d�}|jdddddddgdd	�dS)
Nzterminal reportingz
--pastebin�mode�store�pastebin�failed�allz3Send failed|all info to bpaste.net pastebin service)�metavar�action�dest�default�choices�help)�getgroup�
_addoption)r
�group�r�I/home/arjun/projects/env/lib/python3.10/site-packages/_pytest/pastebin.py�pytest_addoptions

�rT)�trylast�configcsZ�jjdkr)�j�d�}|dur+t�d��jt<|jj	���fdd�}||j_	dSdSdS)Nr�terminalreporterzw+bcs8�|fi|��t|t�r|�d�}�jt�|�dS)N�utf-8)�
isinstance�str�encode�stash�pastebinfile_key�write)�s�kwargs�r�oldwriterr�	tee_write+s

z#pytest_configure.<locals>.tee_write)
�optionr�
pluginmanager�	getplugin�tempfile�
TemporaryFiler$r%�_twr&)r�trr+rr)r�pytest_configures�r3cCsvt|jvr9|jt}|�d�|��}|��|jt=|j�d�}|jjd=|�	dd�t
|�}|�d|�dSdS)Nrrr&�=�$Sending information to Paste Servicezpastebin session-log: %s
)r%r$�seek�read�closer-r.r1�__dict__�	write_sep�create_new_paste�
write_line)r�pastebinfile�
sessionlogr2�pastebinurlrrr�pytest_unconfigure4s



�r@�contentsc	
Cs�ddl}ddlm}ddlm}|ddd�}d}z||||��d	�d
����d�}Wnty@}z
d|WYd}~Sd}~ww|�	d
|�}|rS|�d|�
d���Sd|dS)z�Create a new paste using the bpaste.net service.

    :contents: Paste contents string.
    :returns: URL to the pasted contents, or an error message.
    rN)�urlopen)�	urlencode�text�1week)�code�lexer�expiryzhttps://bpa.st�ascii)�datar zbad response: %szhref="/raw/(\w+)"z/show/�zbad response: invalid format ('z'))�re�urllib.requestrB�urllib.parserCr#r7�decode�OSError�searchr)	rArLrBrC�params�url�response�exc_info�mrrrr;Es ���r;rc	Cs�|jjjdkr	dSd|jvr[|�dd�|jdD]C}z
|jjjdj}Wnt	y3|�
|�}Ynwt�}t|j|�}|�
|�|��}t|�sLJ�t|�}|�|�d|���qdSdS)Nrr4r5���z --> )rr,r�statsr:�longrepr�
reprtraceback�reprentries�reprfileloc�AttributeError�_getfailureheadlinerr�
toterminal�getvalue�lenr;r<)r�rep�msg�file�twr'r?rrr�pytest_terminal_summary^s&
�
�rf)�__doc__r/�ior�typingrr�pytest�_pytest.configrr�_pytest.config.argparsingr�
_pytest.stashr�_pytest.terminalr	�bytesr%r�hookimplr3r@r"r;rfrrrr�<module>s$