File: //lib/python3.10/email/__pycache__/headerregistry.cpython-310.pyc
o
    E�hMQ  �                   @   s�  d Z ddlmZ ddlmZ ddlmZ ddlmZ G dd� d�ZG dd	� d	�Z	G d
d� de
�Zdd
� ZG dd� d�Z
G dd� de
�ZG dd� d�ZG dd� de�ZG dd� d�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� d�ZG d d!� d!�ZG d"d#� d#e�ZG d$d%� d%e�ZG d&d'� d'�ZG d(d)� d)�Zi d*e�d+e�d,e�d-e�d.e�d/e�d0e�d1e�d2e�d3e�d4e�d5e�d6e�d7e�d8e�d9e�d:e�eeed;��ZG d<d=� d=�Zd>S )?z�Representing and manipulating email headers via custom objects.
This module provides an implementation of the HeaderRegistry API.
The implementation is designed to flexibly follow RFC5322 rules.
�    )�MappingProxyType)�utils)�errors)�_header_value_parserc                   @   s^   e Zd Zddd�Zedd� �Zedd� �Zed	d
� �Zedd� �Zd
d� Z	dd� Z
dd� ZdS )�Address� Nc                 C   s�   d� td||||f��}d|v sd|v rtd��|durC|s |r$td��t�|�\}}|r5td�||���|jr=|jd �|j}|j	}|| _
|| _|| _dS )	a�  Create an object representing a full email address.
        An address can have a 'display_name', a 'username', and a 'domain'.  In
        addition to specifying the username and domain separately, they may be
        specified together by using the addr_spec keyword *instead of* the
        username and domain keywords.  If an addr_spec string is specified it
        must be properly quoted according to RFC 5322 rules; an error will be
        raised if it is not.
        An Address object has display_name, username, domain, and addr_spec
        attributes, all of which are read-only.  The addr_spec and the string
        value of the object are both quoted according to RFC5322 rules, but
        without any Content Transfer Encoding.
        r   N�
�
z8invalid arguments; address parts cannot contain CR or LFz=addrspec specified when username and/or domain also specifiedz6Invalid addr_spec; only '{}' could be parsed from '{}'r   )
�join�filter�
ValueError�	TypeError�parser�
get_addr_spec�format�all_defects�
local_part�domain�
_display_name�	_username�_domain)�self�display_name�usernamer   �	addr_spec�inputs�a_s�rest� r   �+/usr/lib/python3.10/email/headerregistry.py�__init__   s(   ��
zAddress.__init__c                 C   �   | j S �N�r   �r   r   r   r   r   8   �   zAddress.display_namec                 C   r!   r"