File: //lib/python3/dist-packages/future/backports/email/__pycache__/_policybase.cpython-310.pyc
o
    ,�]79  �                   @   s�   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 dd	lZdd
lm
Z
 ddlmZ ddlmZ g d
�ZG dd� de�Zdd� Zdd� ZG dd� de
eje��ZeG dd� de��Ze� Zd	S )zwPolicy framework for the email package.
Allows fine grained feature control of how the package parses and emits data.
�    )�unicode_literals)�print_function)�division)�absolute_import)�super)�str)�with_metaclassN)�header)�charset)�_has_surrogates)�Policy�Compat32�compat32c                       s@   e Zd ZdZ� fdd�Zdd� Zdd� Zdd	� Zd
d� Z�  Z	S )�_PolicyBasea�  Policy Object basic framework.
    This class is useless unless subclassed.  A subclass should define
    class attributes with defaults for any values that are to be
    managed by the Policy object.  The constructor will then allow
    non-default values to be set for these attributes at instance
    creation time.  The instance will be callable, taking these same
    attributes keyword arguments, and returning a new instance
    identical to the called instance except for those values changed
    by the keyword arguments.  Instances may be added, yielding new
    instances with any non-default values from the right hand
    operand overriding those in the left hand operand.  That is,
        A + B == A(<non-default values of B>)
    The repr of an instance can be used to reconstruct the object
    if and only if the repr of the values can be used to reconstruct
    those values.
    c                    sF   |� � D ]\}}t| |�rtt| ��||� qtd�|| jj���dS )z�Create new Policy, possibly overriding some defaults.
        See class docstring for a list of overridable attributes.
        �*{!r} is an invalid keyword argument for {}N)	�items�hasattrr   r   �__setattr__�	TypeError�format�	__class__�__name__)�self�kw�name�value�r   � �D/usr/lib/python3/dist-packages/future/backports/email/_policybase.py�__init__0   s   
���z_PolicyBase.__init__c                 C   s*   dd� | j �� D �}d�| jjd�|��S )Nc                 S   s   g | ]
\}}d � ||��qS )z{}={!r})r   )�.0r   r   r   r   r   �
<listcomp>?   s    �z(_PolicyBase.__repr__.<locals>.<listcomp>z{}({})z, )�__dict__r   r   r   r   �join)r   �argsr   r   r   �__repr__>