AlkantarClanX12
Current Path : /proc/self/root/opt/alt/python311/lib64/python3.11/__pycache__/ |
Current File : //proc/self/root/opt/alt/python311/lib64/python3.11/__pycache__/nntplib.cpython-311.pyc |
� c��f� � � � d Z ddlZddlZddlZddlZddlZddlZ ddlZdZn # e $ r dZY nw xY wddl mZ ddlm Z g d�Z ej ed� � � d Z G d� de� � Z G d � de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � ZdZdZh d�Zg d�Zddd�ZdZ ej dg d �� � Z ej d!g d"�� � Z!d#� Zd$� Z"dWd%�Z#dWd&�Z$dXd'�Z%erd(� Z& G d)� d*� � Z'er# G d+� d,e'� � Z(e�) d,� � ed-k �r,ddl*Z* e*j+ d.�/� � Z,e,�- d0d1d2d3�4� � e,�- d5d6d7d8�4� � e,�- d9d:d;e.d<e�d=e�d>��?� � e,�- d@dAdBe.dC�?� � e,�- dDdEdFddG�H� � e,�/ � � Z0e0j1 Z1e0j se1d;k reZ1 e'e0j2 e1�I� � Z3ne1d;k reZ1 e(e0j2 e1�I� � Z3e3�4 � � Z5dJe5v re3�6 � � e3�7 e0j7 � � \ Z8Z9Z:Z;Z< e=dKe<dLe9dMe:dNe;� � dO� Z> e? e.e;� � e0j@ z dPz � � Z:e3�A e:e;� � \ Z8ZBeBD ]�\ ZCZD eeDdQ � � �E dRdP� � d ZF eeDdS � � ZG e.eDd � � ZH e=dT�I eC e>eFdU� � e>eGdV� � eH� � � � ��e3�J � � dS dS )Ya� An NNTP client class based on: - RFC 977: Network News Transfer Protocol - RFC 2980: Common NNTP Extensions - RFC 3977: Network News Transfer Protocol (version 2) Example: >>> from nntplib import NNTP >>> s = NNTP('news') >>> resp, count, first, last, name = s.group('comp.lang.python') >>> print('Group', name, 'has', count, 'articles, range', first, 'to', last) Group comp.lang.python has 51 articles, range 5770 to 5821 >>> resp, subs = s.xhdr('subject', '{0}-{1}'.format(first, last)) >>> resp = s.quit() >>> Here 'resp' is the server response line. Error responses are turned into exceptions. To post an article from a file: >>> f = open(filename, 'rb') # file containing article, including header >>> resp = s.post(f) >>> For descriptions of all methods, read the comments in the code below. Note that all arguments and return values representing article numbers are strings, not numbers, since they are rarely used for calculations. � NTF)� decode_header)�_GLOBAL_DEFAULT_TIMEOUT)�NNTP� NNTPError�NNTPReplyError�NNTPTemporaryError�NNTPPermanentError�NNTPProtocolError� NNTPDataErrorr )� � )�removei c � � e Zd ZdZd� ZdS )r z%Base class for all nntplib exceptionsc �v � t j | g|�R � |d | _ d S # t $ r d| _ Y d S w xY w)Nr zNo response given)� Exception�__init__�response� IndexError)�self�argss �./opt/alt/python311/lib64/python3.11/nntplib.pyr zNNTPError.__init__e sW � ���4�'�$�'�'�'�'� 0� ��G�D�M�M�M��� 0� 0� 0�/�D�M�M�M�M� 0���s � # �8�8N)�__name__� __module__�__qualname__�__doc__r � � r r r c s) � � � � � �/�/�0� 0� 0� 0� 0r r c � � e Zd ZdZdS )r zUnexpected [123]xx replyN�r r r r r r r r r l s � � � � � �"�"��Dr r c � � e Zd ZdZdS )r z 4xx errorsNr r r r r r p � � � � � � ����Dr r c � � e Zd ZdZdS )r z 5xx errorsNr r r r r r t r! r r c � � e Zd ZdZdS )r z"Response does not begin with [1-5]Nr r r r r r x s � � � � � �,�,��Dr r c � � e Zd ZdZdS )r zError in response dataNr r r r r r | s � � � � � � � ��Dr r �w i3 > �100�101�211�215�220�221�222�224�225�230�231�282)�subject�from�datez message-id� references�:bytes�:linesr6 r7 )�bytes�lines� � GroupInfo)�group�last�first�flag�ArticleInfo)�number� message_idr9 c � � g }t | � � D ]Z\ }}t |t � � r+|� |� |pd� � � � �E|� |� � �[d� |� � S )zvTakes a unicode string representing a munged header value and decodes it as a (possibly non-ASCII) readable value.�ascii� )�_email_decode_header� isinstancer8 �append�decode�join)� header_str�parts�v�encs r r r � s| � � �E�&�z�2�2� � ���3��a���� ��L�L����#�.��1�1�2�2�2�2��L�L��O�O�O�O� �7�7�5�>�>�r c �� � g }| D ]�}|d dk r'|dd� � d� � \ }}}d|z }n|� d� � \ }}}|� � � }t � ||� � }|� |� � ��t }t |� � t |� � k rt d� � �|dt |� � � |k rt d� � �|S )z�Parse a list of string representing the response to LIST OVERVIEW.FMT and return a list of header/metadata names. Raises NNTPDataError if the response is not compliant (cf. RFC 3977, section 8.4).r �:� Nz$LIST OVERVIEW.FMT response too shortz*LIST OVERVIEW.FMT redefines default fields)� partition�lower�_OVERVIEW_FMT_ALTERNATIVES�getrH �_DEFAULT_OVERVIEW_FMT�lenr )r9 �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��Jr c �( � t t � � }g }| D ]�}i }|� d� � ^}}t |� � }t |� � D ]�\ } } | t |� � k r�|| }|� d� � }| |k r`|s^|dz } | r<| dt | � � � � � � | k rt d� � �| r| t | � � d� nd} | ||| <