Your IP : 13.59.5.179


Current Path : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/nntplib.cpython-311.opt-2.pyc

�

c��f����	ddlZddlZddlZddlZddlZddlZ	ddlZdZn
#e$rdZYnwxYwddl	m
ZddlmZgd�Z
ejed���d	ZGd
�de��ZGd�d
e��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZdZdZhd�Zgd�Zddd�ZdZejdgd���Zejd gd!���Z d"�Z
d#�Z!dVd$�Z"dVd%�Z#dWd&�Z$erd'�Z%Gd(�d)��Z&er#Gd*�d+e&��Z'e
�(d+��ed,k�r,ddl)Z)e)j*d-�.��Z+e+�,d/d0d1d2�3��e+�,d4d5d6d7�3��e+�,d8d9d:e-d;e�d<e�d=��>��e+�,d?d@dAe-dB�>��e+�,dCdDdEddF�G��e+�.��Z/e/j0Z0e/jse0d:kreZ0e&e/j1e0�H��Z2ne0d:kreZ0e'e/j1e0�H��Z2e2�3��Z4dIe4vre2�5��e2�6e/j6��\Z7Z8Z9Z:Z;e<dJe;dKe8dLe9dMe:��dN�Z=e>e-e:��e/j?z
dOz��Z9e2�@e9e:��\Z7ZAeAD]�\ZBZCe
eCdP���DdQdO��dZEe
eCdR��ZFe-eCd��ZGe<dS�HeBe=eEdT��e=eFdU��eG������e2�I��dSdS)X�NTF)�
decode_header)�_GLOBAL_DEFAULT_TIMEOUT)�NNTP�	NNTPError�NNTPReplyError�NNTPTemporaryError�NNTPPermanentError�NNTPProtocolError�
NNTPDataErrorr)��
)�removeic��eZdZ	d�ZdS)rc�v�tj|g|�R�	|d|_dS#t$rd|_YdSwxYw)NrzNo response given)�	Exception�__init__�response�
IndexError)�self�argss  �./opt/alt/python311/lib64/python3.11/nntplib.pyrzNNTPError.__init__esW����4�'�$�'�'�'�'�	0� ��G�D�M�M�M���	0�	0�	0�/�D�M�M�M�M�	0���s�
#�8�8N)�__name__�
__module__�__qualname__r��rrrcs&������/�0�0�0�0�0rrc��eZdZ	dS)rN�rrrrrrrrls������"��Drrc��eZdZ	dS)rNrrrrrrp���������Drrc��eZdZ	dS)r	Nrrrrr	r	tr rr	c��eZdZ	dS)r
Nrrrrr
r
xs������,��Drr
c��eZdZ	dS)rNrrrrrr|s������ ��Drr�wi3>�100�101�211�215�220�221�222�224�225�230�231�282)�subject�from�datez
message-id�
references�:bytes�:linesr5r6)�bytes�lines�
�	GroupInfo)�group�last�first�flag�ArticleInfo)�number�
message_idr8c��	g}t|��D]Z\}}t|t��r+|�|�|pd�����E|�|���[d�|��S)N�ascii�)�_email_decode_header�
isinstancer7�append�decode�join)�
header_str�parts�v�encs    rrr�s���@��E�&�z�2�2�����3��a����	��L�L����#�.��1�1�2�2�2�2��L�L��O�O�O�O�
�7�7�5�>�>�rc��	g}|D]�}|ddkr'|dd��d��\}}}d|z}n|�d��\}}}|���}t�||��}|�|����t
}t
|��t
|��krtd���|dt
|���|krtd���|S)Nr�:�z$LIST OVERVIEW.FMT response too shortz*LIST OVERVIEW.FMT redefines default fields)�	partition�lower�_OVERVIEW_FMT_ALTERNATIVES�getrG�_DEFAULT_OVERVIEW_FMT�lenr)r8�fmt�line�name�_�suffix�defaultss       r�_parse_overview_fmtr]�s���$�
�C�������7�c�>�>�"�1�2�2�h�0�0��5�5�O�D�!�V���:�D�D�#�n�n�S�1�1�O�D�!�V��z�z�|�|��)�-�-�d�D�9�9���
�
�4�����$�H�
�3�x�x�#�h�-�-����B�C�C�C�
�>�C��M�M�>��h�&�&��H�I�I�I��Jrc�*�	tt��}g}|D]�}i}|�d��^}}t|��}t	|��D]�\}	}
|	t|��kr�||	}|�d��}|	|kr`|s^|dz}
|
r<|
dt|
������|
krtd���|
r|
t|
��d�nd}
|
|||	<��|�||f����|S)N�	rOz: z?OVER/XOVER response doesn't include names of additional headers)	rVrU�split�int�	enumerate�
startswithrRrrG)r8rW�data_process_func�
n_defaults�overviewrX�fields�article_number�tokens�i�token�
field_name�is_metadata�hs              r�_parse_overviewro�sG����*�+�+�J��H��2�2����"&�*�*�T�"2�"2�����^�,�,��!�&�)�)�	#�	#�H�A�u��C��H�H�}�}���Q��J�$�/�/��4�4�K��J���{����%���G�U�7�C��F�F�7�^�1�1�3�3�q�8�8�'�)F�G�G�G�*/�9��c�!�f�f�g�g���T��"�F�3�q�6�N�N������0�1�1�1�1��Orc��	|�|dd�}|dd�}t|dd���}t|dd���}t|dd���}t|dd���}t|dd���}t|dd���}|dkr|dz
}n|dkr|d	z
}tj||||||��S)
Ni�������������Fi��dil)ra�datetime)�date_str�time_str�hours�minutes�seconds�year�month�days        r�_parse_datetimer��s�������B�C�C�=���C�R�C�=�����!�����E��(�1�Q�3�-� � �G��(�1�2�2�,���G��x����}���D����B��� � �E�

�h�r�s�s�m�
�
�C��b�y�y������	
����������T�5�#�u�g�w�G�G�Grc���	t|tj��sd}nd�|��}|j}|r|dz}d�||��}nd�||��}||fS)N�000000z({0.hour:02d}{0.minute:02d}{0.second:02d}rvz{0:02d}{1.month:02d}{1.day:02d}z{0:04d}{1.month:02d}{1.day:02d})rFrw�formatr})�dt�legacyry�yrxs     r�_unparse_datetimer�s�����b�(�+�,�,�I����=�D�D�R�H�H��
��A�
�C�
��G��4�;�;�A�r�B�B���4�;�;�A�r�B�B���X��rc�\�	|�tj��}|�||���S)N)�server_hostname)�ssl�_create_stdlib_context�wrap_socket)�sock�context�hostnames   r�_encrypt_onr�s5��	��?��0�2�2�G��"�"�4��"�B�B�Brc��eZdZdZdZeddddefd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�ZeZd
�Zd�Zd8d�Zd�Zd9d�Zd�Zd9d�Zd9d�Zd�Zd�Zd�Zdd�d�Zdd�d�Zd9dd�d�Zd�Zd�Zd�Z d �Z!dd�d!�Z"d"�Z#d#�Z$d9d$�Z%d%�Z&d&�Z'd9d'�Z(d9dd�d(�Z)d9dd�d)�Z*d9dd�d*�Z+d+�Z,dd�d,�Z-dd�d-�Z.dd�d.�Z/d/�Z0d0�Z1d1�Z2d2�Z3d3�Z4d4�Z5d:d5�Z6d6�Z7e8rd9d7�Z9dSdS);rzutf-8�surrogateescapeNFc��	||_||_|�|��|_d|_	|j�d��|_|�|��|s|r|�|||��dSdS#|jr|j���|j����xYw)N�rwb)	�host�port�_create_socketr��file�makefile�
_base_init�login�close)rr�r��user�password�
readermode�usenetrc�timeouts        rrz
NNTP.__init__;s���	�"��	���	��'�'��0�0��	���	�		��	�*�*�5�1�1�D�I��O�O�J�'�'�'��
5�x�
5��
�
�4��8�4�4�4�4�4�
5�
5��	��y�
"��	���!�!�!��I�O�O�������s�AB�<Cc�*�	d|_|���|_d|_|���d|_|r?d|jvr6|���|jsd|_|���d|_d|_dS)NrF�READER)	�	debugging�_getresp�welcome�_caps�getcapabilities�readermode_afterauth�_setreadermode�tls_on�
authenticated)rr�s  rr�zNNTP._base_init^s���	�����}�}�������
�������%*��!��	'�(�$�*�4�4����!�!�!��,�
'�!��
��$�$�&�&�&�
���#����rc��|S�Nr�rs r�	__enter__zNNTP.__enter__�s���rc����fd�}|��rs	����n#ttf$rYnwxYw|��r����dSdS#|��r����wwxYwdS)Nc�$��t�d��S)Nr�)�hasattrr�s�r�<lambda>zNNTP.__exit__.<locals>.<lambda>�s���w�t�V�4�4�r)�quit�OSError�EOFError�_close)rr�is_connecteds`  r�__exit__z
NNTP.__exit__�s����4�4�4�4���<�>�>�	"�
"��	�	�������X�&�
�
�
���
���� �<�>�>�"��K�K�M�M�M�M�M�"�"��<�<�>�>�"��K�K�M�M�M�M�"����
	"�	"s!�'�A �;�A �;�A � !Bc��|�|std���tjd||j|j��tj|j|jf|��S)Nz0Non-blocking socket (timeout=0) is not supportedznntplib.connect)�
ValueError�sys�auditr�r��socket�create_connection)rr�s  rr�zNNTP._create_socket�sS����w���O�P�P�P��	�#�T�4�9�d�i�@�@�@��'���D�I�(>��H�H�Hrc�d�	|jr"tdt|j����|jS)Nz	*welcome*)r��print�reprr�r�s r�
getwelcomezNNTP.getwelcome�s2��	.�
�>�A�5��d�4�<�.@�.@�A�A�A��|�rc�b�	|j��d|_d|_	|���\}}||_d|vr-t	tt|d����|_d|vr d�|d��|_n#ttf$r
i|_YnwxYw|jS)NrP�VERSION�IMPLEMENTATION� )
r��nntp_version�nntp_implementation�capabilities�max�maprarIr	r)r�resp�capss   rr�zNNTP.getcapabilities�s���	��:�� !�D��'+�D�$�
P�!�.�.�0�0�
��d�
"��
���$�$�),�C��T�)�_�,E�,E�(F�(F�D�%�#�t�+�+�/2�x�x��=M�8N�/O�/O�D�,���'�(:�;�
 �
 �
 ���
�
�
�
 �����z�s�B�B'�&B'c��	||_dSr�)r�)r�levels  r�set_debuglevelzNNTP.set_debuglevel�s��	H�
����rc��	tjd||��|tz}|jdkrt	dt|����|j�|��|j���dS)Nznntplib.putlinerPz*put*)	r�r��_CRLFr�r�r�r��write�flush�rrXs  r�_putlinez
NNTP._putline�ss��	3��	�#�T�4�0�0�0��e�|���>�A���u�W�d�4�j�j�9�9�9��	��������	�������rc��	|jrtdt|����|�|j|j��}|�|��dS)Nz*cmd*)r�r�r��encode�encoding�errorsr�r�s  r�_putcmdzNNTP._putcmd�sS��	0��>�5�5��$�t�*�*�5�5�5��{�{�4�=�$�+�6�6���
�
�d�����rTc�r�	|j�tdz��}t|��tkrt	d���|jdkrt
dt|����|st�|r9|dd�tkr|dd�}n|dd�tvr
|dd�}|S)NrPz
line too longz*get*rt���)
r��readline�_MAXLINErVrr�r�r�r�r�)r�
strip_crlfrXs   r�_getlinez
NNTP._getline�s���	#��y�!�!�(�A�+�.�.���t�9�9�x�����0�0�0��>�A����'�4��:�:�&�&�&��#�8�^��	!��B�C�C�y�E�!�!��C�R�C�y����b�c�c��e�#�#��C�R�C�y���rc�F�	|���}|jrtdt|����|�|j|j��}|dd�}|dkrt|���|dkrt|���|dvrt|���|S)Nz*resp*rP�4�5�123)
r�r�r�r�rHr�r�rr	r
)rr��cs   rr�z
NNTP._getresp�s���	%��}�}�����>�6�5��4��:�:�6�6�6��{�{�4�=�$�+�6�6����!��H����8�8�$�T�*�*�*���8�8�$�T�*�*�*��E�>�>�#�D�)�)�)��rc��	d}	t|ttf��rt|d��x}}|���}|dd�t
vrt
|���g}|�]dtzdf}	|�d��}||vrn5|�	d��r
|dd�}|�
|���OnSd}	|���}||krn5|�	d��r
|dd�}|�|���P|r|���n#|r|���wwxYw||fS)N�wbr�.s.
rPFs..)
rF�strr7�openr��	_LONGRESPrr�r�rcr�rGr�)rr��
openedFiler�r8�terminatorsrX�
terminators        r�_getlongrespzNNTP._getlongresp�s���	��
� 	#��$��e��-�-�
5�$(��t�$4�$4�4�
�T��=�=�?�?�D��B�Q�B�x�y�(�(�$�T�*�*�*��E���#�e�|�V�4��%��=�=��/�/�D��{�*�*�����u�-�-�(�#�A�B�B�x���J�J�t�$�$�$�
%��
"�
�'��=�=�?�?�D��z�)�)�����u�-�-�(�#�A�B�B�x���L�L��&�&�&�
'��
#�� � �"�"�"����
#�� � �"�"�"�"�
#�����U�{�s�DD2�2Ec�V�	|�|��|���Sr�)r�r�r�s  r�	_shortcmdzNNTP._shortcmds'��	,����T�����}�}���rc�X�	|�|��|�|��Sr��r�r�)rrXr�s   r�_longcmdz
NNTP._longcmd!s-��	0����T����� � ��&�&�&rc���	��|����|��\}}|�fd�|D��fS)Nc�P��g|]"}|��j�j����#Sr)rHr�r�)�.0rXrs  �r�
<listcomp>z'NNTP._longcmdstring.<locals>.<listcomp>.s;���(�(�(���k�k�$�-���=�=�(�(�(rr�)rrXr�r��lists`    r�_longcmdstringzNNTP._longcmdstring'sf���	�	
���T�����&�&�t�,�,�
��d��(�(�(�(�"&�(�(�(�(�	(rc���		|jS#t$rYnwxYw	|�d��\}}t|��}n#t$rt
dd�}YnwxYw||_|S)NzLIST OVERVIEW.FMT)�_cachedoverviewfmt�AttributeErrorr�r]r	rU)rr�r8rWs    r�_getoverviewfmtzNNTP._getoverviewfmt1s���	8�	��*�*���	�	�	��D�	����	-��-�-�.A�B�B�K�D�%�
&�e�,�,�C�C��	"�	+�	+�	+�'����*�C�C�C�	+����
#&����
s�
�
��A�A�Ac��d�|D��S)Nc�D�g|]}t|������Sr)r:r`)r�rXs  rr�z#NNTP._grouplist.<locals>.<listcomp>Ds%��;�;�;�T�	�4�:�:�<�<�(�;�;�;rr)rr8s  r�
_grouplistzNNTP._grouplistBs��;�;�U�;�;�;�;rc��	i}|�d��\}}|D]}|���^}}|||<�||fS)N�CAPABILITIES)r�r`)rr�r�r8rXrYris       rr�zNNTP.capabilitiesFsZ��	����)�)�.�9�9���e��	 �	 �D� �J�J�L�L�M�D�6��D��J�J��T�z�r)r�c�l�	t|tjtjf��s,td�|jj�����t||jdk��\}}d�||��}|�	||��\}}||�
|��fS)N�Athe date parameter must be a date or datetime object, not '{:40}'rqzNEWGROUPS {0} {1})rFrwr3�	TypeErrorr��	__class__rr�r�r�r)rr3r�rxry�cmdr�r8s        r�	newgroupszNNTP.newgroupsTs���	��$����
� >�?�?�	?���$�f�T�^�%<�=�=�?�?�
?�/�t�T�5F��5J�K�K���(�!�(�(��8�<�<���)�)�#�t�4�4���e��T�_�_�U�+�+�+�+rc�:�	t|tjtjf��s,td�|jj�����t||jdk��\}}d�|||��}|�	||��S)NrrqzNEWNEWS {0} {1} {2})
rFrwr3r	r�r
rr�r�r�)rr;r3r�rxryrs       r�newnewszNNTP.newnewsds���	��$����
� >�?�?�	?���$�f�T�^�%<�=�=�?�?�
?�/�t�T�5F��5J�K�K���(�#�*�*�5�(�H�E�E���"�"�3��-�-�-rc�x�	|�d|z}nd}|�||��\}}||�|��fS)NzLIST ACTIVE �LIST)r�r)r�
group_patternr��commandr�r8s      rr�z	NNTP.listtsP��	��$�$�}�4�G�G��G��)�)�'�4�8�8���e��T�_�_�U�+�+�+�+rc�x�tjd��}|�d|z��\}}|�d��s|�d|z��\}}i}|D]O}|�|�����}|r$|�dd��\}	}
|s|
cS|
||	<�P|r||fSdS)Nz^(?P<group>[^ 	]+)[ 	]+(.*)$zLIST NEWSGROUPS r(zXGTITLE rPrqrD)�re�compiler�rc�search�stripr;)rr�
return_all�line_patr�r8�groups�raw_line�matchrY�descs           r�_getdescriptionszNNTP._getdescriptions�s����:�>�?�?���)�)�*<�}�*L�M�M���e����u�%�%�	J��-�-�j�=�.H�I�I�K�D�%����	$�	$�H��O�O�H�N�N�$4�$4�5�5�E��
$�"�[�[��A�.�.�
��d�!� ��K�K�K�#��t����	���<���2rc�0�	|�|d��S)NF�r)rr;s  r�descriptionzNNTP.description�s��		7��$�$�U�E�2�2�2rc�0�	|�|d��S)NTr )rrs  r�descriptionszNNTP.descriptions�s��5��$�$�]�D�9�9�9rc��	|�d|z��}|�d��st|���|���}dx}x}}t	|��}|dkrD|d}|dkr6|d}|dkr(|d}|dkr|d���}|t
|��t
|��t
|��|fS)NzGROUP r'rrPrqrrr)r�rcrr`rVrRra)rrYr��words�countr=r<�ns        rr;z
NNTP.group�s���	��~�~�h��o�.�.�����u�%�%�	'� ��&�&�&��
�
���� � �� �����J�J���q�5�5��!�H�E��1�u�u��a����q�5�5� ��8�D��1�u�u�$�Q�x�~�~�/�/���S��Z�Z��U���S��Y�Y��<�<rc�0�	|�d|��S)N�HELP)r�)rr�s  r�helpz	NNTP.help�s��	��"�"�6�4�0�0�0rc��	|�d��st|���|���}t|d��}|d}|||fS)N�22rPrq)rcrr`ra)rr�r%�art_numrAs     r�
_statparsezNNTP._statparse�s[��	*����t�$�$�	'� ��&�&�&��
�
�����e�A�h�-�-���1�X�
��W�j�(�(rc�X�	|�|��}|�|��Sr�)r�r.)rrXr�s   r�_statcmdz
NNTP._statcmd�s(��=��~�~�d�#�#�����t�$�$�$rc��	|r(|�d�|����S|�d��S)NzSTAT {0}�STAT)r0r�)r�message_specs  r�statz	NNTP.stat�sC��	��	)��=�=��!2�!2�<�!@�!@�A�A�A��=�=��(�(�(rc�.�	|�d��S)N�NEXT�r0r�s r�nextz	NNTP.next����I��}�}�V�$�$�$rc�.�	|�d��S)N�LASTr7r�s rr<z	NNTP.last�r9rc��	|�||��\}}|�|��\}}}|t|||��fSr�)r�r.r?)rrXr�r�r8r-rAs       r�_artcmdzNNTP._artcmd�sK��@��m�m�D�$�/�/���e�$(�O�O�D�$9�$9�!��g�z��[��*�e�<�<�<�<rc�d�	|�d�|��}nd}|�||��S)NzHEAD {0}�HEAD�r�r=�rr3r�rs    r�headz	NNTP.head��=��	��#��#�#�L�1�1�C�C��C��|�|�C��&�&�&rc�d�	|�d�|��}nd}|�||��S)NzBODY {0}�BODYr@rAs    r�bodyz	NNTP.bodyrCrc�d�	|�d�|��}nd}|�||��S)NzARTICLE {0}�ARTICLEr@rAs    r�articlezNNTP.articles=��	��#��&�&�|�4�4�C�C��C��|�|�C��&�&�&rc�.�	|�d��S)N�SLAVE)r�r�s r�slavez
NNTP.slave$s��	��~�~�g�&�&�&rc����	tjd���|�d�||��|��\}}�fd��|�fd�|D��fS)Nz^([0-9]+) ?(.*)
?zXHDR {0} {1}c�b����|��}|r|�dd��n|S)NrPrq)rr;)rX�m�pats  �r�
remove_numberz NNTP.xhdr.<locals>.remove_number5s-����	�	�$���A�$%�/�1�7�7�1�a�=�=�=�4�/rc�&��g|]
}�|����Srr)r�rXrQs  �rr�zNNTP.xhdr.<locals>.<listcomp>8s#���<�<�<�d�m�m�D�)�)�<�<�<r)rrr�r�)r�hdrr�r�r�r8rPrQs      @@r�xhdrz	NNTP.xhdr*s����	��j�-�.�.���)�)�.�*?�*?��S�*I�*I�4�P�P���e�	0�	0�	0�	0�	0��<�<�<�<�e�<�<�<�<�<rc��	|�d�||��|��\}}|���}|t||��fS)Nz
XOVER {0}-{1})r�r�rro)r�start�endr�r�r8rWs       r�xoverz
NNTP.xover:s]��	��)�)�/�*@�*@���*L�*L�*.�0�0���e��"�"�$�$���_�U�C�0�0�0�0rc�*�	d|jvrdnd}t|ttf��r!|\}}|d�||pd��z
}n
|�|dz|z}|�||��\}}|���}|t||��fS)N�OVER�XOVERz {0}-{1}rDr�)r�rF�tupler�r�r�rro)	rr3r�rrVrWr�r8rWs	         r�overz	NNTP.overHs���	� �$�*�,�,�f�f�'���l�U�D�M�2�2�	+�%�J�E�3��:�$�$�U�C�I�2�6�6�6�C�C�
�
%���)�l�*�C��)�)�#�t�4�4���e��"�"�$�$���_�U�C�0�0�0�0rc�Z�	|�d��}|�d��st|���|���}t	|��dkrt|���|d}t	|��dkrt|���|t
|d��fS)N�DATE�111rqrP�)r�rcrr`rVrr�)rr��elemr3s    rr3z	NNTP.datecs���	�
�~�~�f�%�%�����u�%�%�	'� ��&�&�&��z�z�|�|���t�9�9��>�>���%�%�%��A�w���t�9�9��?�?���%�%�%��_�T�4�0�0�0�0rc�B�|�|��}|�d��st|���t|tt
f��r|���}|D]m}|�t��s|�	d��tz}|�d��rd|z}|j
�|���n|j
�d��|j
���|�
��S)N�3r9r�s.
)r�rcrrFr7�	bytearray�
splitlines�endswithr��rstripr�r�r�r�)rr�fr�rXs     r�_postz
NNTP._postts����~�~�g�&�&�����s�#�#�	'� ��&�&�&��a�%��+�,�,�	������A�
�	"�	"�D��=�=��'�'�
4��{�{�7�+�+�e�3�����t�$�$�
#��d�{���I�O�O�D�!�!�!�!��	����!�!�!��	�������}�}���rc�0�	|�d|��S)N�POST)rj)r�datas  r�postz	NNTP.post�s��	1��z�z�&�$�'�'�'rc�V�	|�d�|��|��S)Nz	IHAVE {0})rjr�)rrArms   r�ihavez
NNTP.ihave�s,��	O��z�z�+�,�,�Z�8�8�$�?�?�?rc��	|jr|j���|`|j���dS#|j���wxYwr�)r�r�r�r�s rr�zNNTP._close�sX��	��y�
��	���!�!�!��I��I�O�O�������D�I�O�O�������s	�"?�Ac��		|�d��}|���n#|���wxYw|S)N�QUIT)r�r�)rr�s  rr�z	NNTP.quit�sC��	1�	��>�>�&�)�)�D��K�K�M�M�M�M��D�K�K�M�M�M�M�����s	�-�Ac���|jrtd���|s|std���	|rF|sDddl}|���}|�|j��}|r|d}|d}n#t
$rYnwxYw|sdS|�d|z��}|�d��rM|st|���|�d|z��}|�d��st|���d|_
|���|jr:d	|j
vr3|�
��d|_
|���dSdSdS)
NzAlready logged in.z7At least one of `user` and `usenetrc` must be specifiedrrqzauthinfo user �381zauthinfo pass �281r�)r�r��netrc�authenticatorsr�r�r�rcrr	r�r�r�r�)rr�r�r�rw�credentials�authr�s        rr�z
NNTP.login�s�����	3��1�2�2�2��	K�H�	K��I�K�K�
K�
		��
'��
'�����#�k�k�m�m��"�1�1�$�)�<�<���'���7�D�#�A�w�H����	�	�	��D�	�����	��F��~�~�.��5�6�6���?�?�5�!�!�	3��
3�$�T�*�*�*��~�~�&6��&A�B�B�����u�-�-�3�,�T�2�2�2���
��������$�	#����)C�)C����!�!�!��D�J�� � �"�"�"�"�"�		#�	#�)C�)Cs�AA4�4
B�Bc���	|�d��|_dS#t$rYdSt$r.}|j�d��rd|_n�Yd}~dSd}~wwxYw)Nzmode reader�480T)r�r�r	rrrcr�)r�es  rr�zNNTP._setreadermode�s���
	��>�>�-�8�8�D�L�L�L��!�	�	�	��D�D�!�	�	�	��z�$�$�U�+�+�
�,0��)�)��*�)�)�)�)�)�����	���s��
A"�	A"�#A�A"c���	|jrtd���|jrtd���|�d��}|�d��r||j���t|j||j	��|_|j�
d��|_d|_d|_|���dStd���)NzTLS is already enabled.z+TLS cannot be started after authentication.�STARTTLS�382r�TzTLS failed to start.)r�r�r�r�rcr�r�r�r�r�r�r�r�r)rr�r�s   r�starttlsz
NNTP.starttls�s���
�
�{�
<� �!:�;�;�;��!�
P� �!N�O�O�O��>�>�*�-�-�D����u�%�%�

8��	���!�!�!�'��	�7�D�I�F�F��	� �I�.�.�u�5�5��	�"���"��
��$�$�&�&�&�&�&�� 6�7�7�7r)Tr�)NNT):rrrr�r��	NNTP_PORTrrr�r�r�r�r�r�r��debugr�r�r�r�r�r�r�r�rrr�rrr�rr!r#r;r*r.r0r4r8r<r=rBrFrIrLrTrXr]r3rjrnrpr�r�r�r��	_have_sslr�rrrrr+s��������H�
�F�"+�$�� �5�0�!�!�!�!�F #� #� #�D���	"�	"�	"�I�I�I�������,���
�E�����������"��� ,�,�,�,�\���'�'�'�'�(�(�(�(����"<�<�<����'+�,�,�,�,�,� ,0�.�.�.�.�.� 
,�t�
,�
,�
,�
,�
,����.3�3�3�:�:�:�=�=�=�4 �1�1�1�1�1�)�)�)�%�%�%�
)�)�)�)�%�%�%�%�%�%�=�=�=�=�'�d�'�'�'�'�'�'�d�'�'�'�'�'�'��'�'�'�'�'�'�'�'�&*�=�=�=�=�=� )-�1�1�1�1�1�*.�1�1�1�1�1�61�1�1�"���*(�(�(�@�@�@�������'#�'#�'#�'#�R����8�	8�	8�	8�	8�	8�	8�8�8rrc�8��eZdZedddddef�fd�	Z�fd�Z�xZS)�NNTP_SSLNFc		�f��	||_t���|||||||��dSr�)�ssl_context�superr)
rr�r�r�r�r�r�r�r�r
s
         �rrzNNTP_SSL.__init__�sG���
� +�D���G�G���T�4��x��%�w�
0�
0�
0�
0�
0rc���t���|��}	t||j|j��}|S#|����xYwr�)r�r�r�r�r�r�)rr�r�r
s   �rr�zNNTP_SSL._create_socketsU����7�7�)�)�'�2�2�D�
�"�4��)9�4�9�E�E��
���	
��
�
�������s�A�A)rrr�
NNTP_SSL_PORTrrr��
__classcell__)r
s@rr�r��sh�������&3���$�#�e�3�		0�		0�		0�		0�		0�		0�	�	�	�	�	�	�	�	�	rr��__main__zJ        nntplib built-in demo - display the latest articles in a newsgroup)r!z-gz--groupzgmane.comp.python.generalz3group to fetch messages from (default: %(default)s))�defaultr*z-sz--serverz
news.gmane.ioz+NNTP server hostname (default: %(default)s)z-pz--portr�zNNTP port number (default: z / �))r��typer*z-nz
--nb-articles�
z2number of articles to fetch (default: %(default)s)z-Sz--ssl�
store_truezuse NNTP over SSL)�actionr�r*)r�r�r�Group�haszarticles, range�toc�L�t|��|kr|d|dz
�dz}|S)Nrrz...)rV)�s�lims  r�cutr�6s,���q�6�6�C�<�<��(�3��7�(��e�#�A��rrPr2�<r1z{:7} {:20} {:42} ({})��*r�)F)Jrr��collectionsrwr��warningsr�r��ImportError�email.headerrrEr�__all__�_deprecatedrr�rrrrr	r
rr�r�r�rUrSr��
namedtupler:r?r]ror�r�r�rr�rG�argparse�ArgumentParser�parser�add_argumentra�
parse_argsrr��serverr�r�r�r�r;r�r&r=r<rYr�r�r��nb_articlesrX�	overviews�artnumr]r`�authorr1r8r�r�rrr�<module>r�s`���B
�	�	�	�
�
�
�
���������
�
�
�
�������J�J�J��I�I�������I�I�I�����
?�>�>�>�>�>�*�*�*�*�*�*�
�
�
�����X�g�.�.�.�.���0�0�0�0�0�	�0�0�0�	�	�	�	�	�Y�	�	�	�	�	�	�	�	��	�	�	�	�	�	�	�	��	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�I�	�	�	�
�	��
�

�

�

�	� O�O�O��
�
����	��"�K�"�;�#E�#E�#E�
G�
G�	�%�k�$�]�%F�%F�%F�H�H��
	�	�	����2����:H�H�H�H�,����4
�C�
C�
C�
C�K8�K8�K8�K8�K8�K8�K8�K8�\
�������4����.�N�N�:�����z����O�O�O�
$�X�
$�2N�O�O�O�F�
����i�1L�R��T�T�T�
����j�/�J��L�L�L�
����h����FO�i�i�Q^�Q^�Q^�_��a�a�a�
����o�r��Q��S�S�S�
����g�l�E�0��2�2�2������D��9�D��8�2��2�:�:��D��D�d�k��-�-�-����2�:�:� �D��H�$�+�D�1�1�1�������D��T���	�
�
����%&�W�W�T�Z�%8�%8�"�D�%���d�	�E�'�4���'8�%��t�L�L�L����

�C���D�	�	�D�,�,�q�0�1�1�E��g�g�e�T�*�*�O�D�)�!��������t�F�|�,�,�2�2�3��:�:�1�=���-��Y��0�0����D��N�#�#��
��%�,�,��c�c�&�"�o�o�s�s�7�B�'7�'7��@�@�	�	�	�	��F�F�H�H�H�H�H�a�s�"�,�,

?>