File: //usr/lib/python3/dist-packages/twisted/mail/__pycache__/imap4.cpython-310.pyc
o
�bW: � @ s
d Z ddlZddlZddlZddlZddlZddlZddlZddl Z ddl
Z
ddlZddlm
Z
mZ ddlmZ ddlmZ ddlmZmZmZ ddlmZ ddlmZ dd lmZmZ dd
lmZm Z m!Z! ddl"m#Z# ddl$m%Z%m&Z&m'Z'm(Z(m)Z) dd
l*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z: ddl;m<Z=m>Z>m?Z@mAZBmCZDmEZFmGZHmIZJmKZLmMZNmOZOmPZQ ddlRmSZSmTZT ddlUmVZVmWZW ddlXmYZYmZZZm[Z[m\Z\m]Z] e^e_e`dd�d�a� ��Zbdd� Zcdd� ZdG dd� d�ZeG dd� d�ZfG dd� d�ZgG dd � d �ZhG d!d"� d"�Zid#Zjekee`d$�e`d%d&���Zld'ej el Zmem�nd(�Zoe�pd)eo d* �Zqekd+d,� e`d&�D ��ZreeF�G d-d.� d.eSjseTjt��Zue �v� ZweeF�G d/d0� d0eSjseTjt��Zxd�d1d2�Zyd3Zzd4Z{e|Z}d�d5d6�Z~d7d8� Zd9d:� Z�d�d;d<�Z�d=d>� Z�d?d@� Z�dAdB� Z�d�dCdD�Z�dEdF� Z�dGekdHekfdIdJ�Z�G dKdL� dL�Z�dMZ�dNdO� Z�dPdQ� Z�dRdS� Z�dTdU� Z�dVdW� Z�ee=�G dXdY� dY��Z�eeO�G dZd[� d[e���Z�d\d]d^d_d`da�Z�dbdc� Z�ddde� Z�dfdg� Z�dhdi� Z�djdk� Z�dldm� Z�dndo� Z�G dpdq� dq�Z�G drds� dse��Z�G dtdu� due��Z�G dvdw� dwe��Z�G dxdy� dye��Z�d�d{d|�Z�d}d~� Z�dd�� Z�d�d�� Z�G d�d�� d��Z�G d�d�� d��Z�G d�d�� d��Z�d�d�� Z�e�e�d�d�d�� �Z�d�d�� Z�d�d�� Z�d�d�d��Z�d�d�d��Z�G d�d�� d�ej��Z�G d�d�� d�ej��Z�e��e�e�e�e��Z�d�d�� Z�e��e�� g d��Z�dS )�a�
An IMAP4 protocol implementation
@author: Jp Calderone
To do::
Suspend idle timeout while server is processing
Use an async message parser instead of buffering in memory
Figure out a way to not queue multi-message client requests (Flow? A simple callback?)
Clarify some API docs (Query, etc)
Make APPEND recognize (again) non-existent mailboxes before accepting the literal
� N)�decodebytes�encodebytes)�BytesIO)�chain)�Any�List�cast)�implementer)�credentials)�UnauthorizedLogin�UnhandledCredentials)�defer�error�
interfaces)�
maybeDeferred)�CramMD5ClientAuthenticator�LOGINAuthenticator�LOGINCredentials�PLAINAuthenticator�PLAINCredentials)�IllegalClientResponse�IllegalIdentifierError�IllegalMailboxEncoding�IllegalOperation�IllegalQueryError�IllegalServerResponse�IMAP4Exception�MailboxCollision�MailboxException�MismatchedNesting�MismatchedQuoting�NegativeResponse�
NoSuchMailbox�NoSupportedAuthentication�ReadOnlyMailbox�UnhandledResponse)�IAccountIMAP�IClientAuthentication�ICloseableMailboxIMAP�IMailboxIMAP�IMailboxIMAPInfo�IMailboxIMAPListener�IMessageIMAP�IMessageIMAPCopier�IMessageIMAPFile�IMessageIMAPPart�INamespacePresenter�ISearchableIMAPMailbox)�basic�policies)�log�text)�_get_async_param�_matchingString� iterbytes�nativeString�
networkString� �
z/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Decc C s | |u r|S | S )z�
Swap C{this} with C{that} if C{this} is C{ifIs}.
@param this: The object that may be replaced.
@param that: The object that may replace C{this}.
@param ifIs: An object whose identity will be compared to
C{this}.
� )�this�that�ifIsr= r= �4/usr/lib/python3/dist-packages/twisted/mail/imap4.py�_swap` s rB c s � �fdd�| D �S )a�
Swap each element in each pair in C{of} with C{that} it is
C{ifIs}.
@param of: A list of 2-L{tuple}s, whose members may be the object
C{that}
@type of: L{list} of 2-L{tuple}s
@param ifIs: An object whose identity will be compared to members
of each pair in C{of}
@return: A L{list} of 2-L{tuple}s with all occurences of C{ifIs}
replaced with C{that}
c s( g | ]\}}t |�� �t |�� �f�qS r= )rB )�.0�first�second�r@ r? r= rA �
<listcomp>} s �z!_swapAllPairs.<locals>.<listcomp>r= )�ofr? r@ r= rF rA �
_swapAllPairsn s �rI c @ s� e Zd ZU dZg Zee ed<