o
    fF                     @   s  d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dlm
Z
mZ g dZG dd deZG dd dZe ZG dd	 d	Ze ZG d
d dZe Zei ZG dd dZedZedZedZdZdZdZe dZdd Z G dd dZ!G dd dZ"G dd dZ#eedddddeddd Z$d!d" Z%d#d$ Z&dded%d&d'Z'd(d) Z(d*d+ Z)d,d- Z*d.d/ Z+d0d1 Z,d2d3 Z-d4d5 Z.d6d7 Z/d8d9 Z0d:d; Z1d<d= Z2d>d? Z3d@dA Z4dBdC Z5dDdE Z6dFdG Z7dHdI Z8dJdK Z9i dLddMddNddOddPe7dQddRe8dSddTe8dUe9dVe8dWe9dXe8dYe9dZe8d[e9Z:d\d] Z;d^d_ Z<d`da Z=dbdc Z>d~ddddddddddddddde	dfdgZ?dhdi Z@djdk ZAdldm ZBeCdndodpZDdqdr ZEeFdsdtduZGdvdw ZHdxddddddddddddddddydzd{ZId|d} ZJdS )    N)FunctionTypeGenericAlias)	dataclassfieldFieldFrozenInstanceErrorInitVarKW_ONLYMISSINGfieldsasdictastuplemake_dataclassreplaceis_dataclassc                   @      e Zd ZdS )r   N__name__
__module____qualname__ r   r   "/usr/lib/python3.10/dataclasses.pyr      s    r   c                   @   s   e Zd Zdd ZdS )_HAS_DEFAULT_FACTORY_CLASSc                 C   s   dS )Nz	<factory>r   selfr   r   r   __repr__      z#_HAS_DEFAULT_FACTORY_CLASS.__repr__N)r   r   r   r   r   r   r   r   r      s    r   c                   @   r   )_MISSING_TYPENr   r   r   r   r   r          r   c                   @   r   )_KW_ONLY_TYPENr   r   r   r   r   r      r   r   c                   @   s   e Zd Zdd Zdd ZdS )_FIELD_BASEc                 C   
   || _ d S Nnamer   r$   r   r   r   __init__      
z_FIELD_BASE.__init__c                 C   s   | j S r"   r#   r   r   r   r   r      s   z_FIELD_BASE.__repr__N)r   r   r   r&   r   r   r   r   r   r       s    r    _FIELD_FIELD_CLASSVAR_FIELD_INITVAR__dataclass_fields____dataclass_params____post_init__z^(?:\s*(\w+)\s*\.)?\s*(\w+)c                    s"   t   t fdd}|S )Nc              	      sL   t | t f}| v rdS  | z| }W  | |S  | w )Nz...)id_thread	get_identadddiscard)r   keyresultrepr_runninguser_functionr   r   wrapper   s   


z _recursive_repr.<locals>.wrapper)set	functoolswraps)r7   r8   r   r5   r   _recursive_repr   s   
r<   c                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	r   typec                 C   r!   r"   r=   )r   r>   r   r   r   r&      r'   zInitVar.__init__c                 C   s8   t | jtrt | jts| jj}nt| j}d| dS )Nzdataclasses.InitVar[])
isinstancer>   r   r   repr)r   	type_namer   r   r   r      s   

zInitVar.__repr__c                 C   s   t |S r"   )r   )clsr>   r   r   r   __class_getitem__  s   zInitVar.__class_getitem__N)r   r   r   	__slots__r&   r   rD   r   r   r   r   r      s
    r   c                   @   s4   e Zd ZdZdd Zedd Zdd Zee	Z
dS )	r   )r$   r>   defaultdefault_factoryrA   hashinitcomparemetadatakw_only_field_typec	           	      C   sX   d | _ d | _|| _|| _|| _|| _|| _|| _|d u rtnt	
|| _|| _d | _d S r"   )r$   r>   rF   rG   rI   rA   rH   rJ   _EMPTY_METADATAtypesMappingProxyTyperK   rL   rM   )	r   rF   rG   rI   rA   rH   rJ   rK   rL   r   r   r   r&     s   
zField.__init__c                 C   s^   d| j d| jd| jd| jd| jd| jd| jd| jd	| jd
| j	d| j
 dS )NzField(name=z,type=z	,default=z,default_factory=z,init=,repr=z,hash=z	,compare=z
,metadata=z	,kw_only=z,_field_type=))r$   r>   rF   rG   rI   rA   rH   rJ   rK   rL   rM   r   r   r   r   r   .  s.   	
zField.__repr__c                 C   s,   t t| jdd }|r|| j|| d S d S )N__set_name__)getattrr>   rF   )r   ownerr$   funcr   r   r   rS   F  s   zField.__set_name__N)r   r   r   rE   r&   r<   r   rS   classmethodr   rD   r   r   r   r   r     s    
r   c                   @   s    e Zd ZdZdd Zdd ZdS )_DataclassParamsrI   rA   eqorderunsafe_hashfrozenc                 C   s(   || _ || _|| _|| _|| _|| _d S r"   rY   )r   rI   rA   rZ   r[   r\   r]   r   r   r   r&   Y  s   
z_DataclassParams.__init__c                 C   s6   d| j d| jd| jd| jd| jd| jdS )Nz_DataclassParams(init=rQ   z,eq=z,order=z,unsafe_hash=z,frozen=rR   rY   r   r   r   r   r   a  s   z_DataclassParams.__repr__N)r   r   r   rE   r&   r   r   r   r   r   rX   P  s    rX   TrF   rG   rI   rA   rH   rJ   rK   rL   c              	   C   s.   | t ur|t urtdt| |||||||S )a  Return an object to identify dataclass fields.

    default is the default value of the field.  default_factory is a
    0-argument function called to initialize a field's value.  If init
    is true, the field will be a parameter to the class's __init__()
    function.  If repr is true, the field will be included in the
    object's repr().  If hash is true, the field will be included in the
    object's hash().  If compare is true, the field will be used in
    comparison functions.  metadata, if specified, must be a mapping
    which is stored but not otherwise examined by dataclass.  If kw_only
    is true, the field will become a keyword-only parameter to
    __init__().

    It is an error to specify both default and default_factory.
    z/cannot specify both default and default_factory)r
   
ValueErrorr   r^   r   r   r   r   o  s
   r   c                 C   s$   t dd | D t dd | D fS )Nc                 s   s     | ]}|j r|js|V  qd S r"   rI   rL   .0fr   r   r   	<genexpr>      z(_fields_in_init_order.<locals>.<genexpr>c                 s   s     | ]}|j r|jr|V  qd S r"   r`   ra   r   r   r   rd     re   )tupler   r   r   r   _fields_in_init_order  s   rh   c                    s(   |sdS dd  fdd|D  dS )N()(,c                    s   g | ]
}  d |j  qS ).r#   ra   obj_namer   r   
<listcomp>      z_tuple_str.<locals>.<listcomp>,))join)rn   r   r   rm   r   
_tuple_str  s    rs   )globalslocalsreturn_typec          
      C   s   |d u ri }d}|t ur||d< d}d|}ddd |D }d|  d	| d
| d| }d| }d| d| d|  }i }	t|||	 |	d di |S )N _return_typez->_return_typerk   
c                 s   s    | ]}d | V  qdS )z  Nr   )rb   br   r   r   rd         z_create_fn.<locals>.<genexpr>z def rj   rR   z:
, zdef __create_fn__(z):
z	
 return __create_fn__r   )r
   rr   keysexec)
r$   argsbodyrt   ru   rv   return_annotationtxt
local_varsnsr   r   r   
_create_fn  s   
r   c                 C   s0   | rd| d|d| dS | d| d| S )Nz*__dataclass_builtins_object__.__setattr__(rk   rR   rl   =r   )r]   r$   value	self_namer   r   r   _field_assign  s   r   c                 C   s   d| j  }| jtur+| jr | j||< | d| j  d| j  }n6| j||< | d}n+| jrE| jtu r7| j }n| jturD| j||< | j }n|rT| jturT| j||< |}nd S | jtu r]d S t|| j ||S )N_dflt_z() if z is _HAS_DEFAULT_FACTORY else ri   )r$   rG   r
   rI   rF   rM   r*   r   )rc   r]   rt   r   slotsdefault_namer   r   r   r   _field_init  s2   







r   c                 C   sV   | j tu r| jtu rd}n| j turd| j }n| jtur d}| j d| j | S )Nrw   z=_dflt_z=_HAS_DEFAULT_FACTORYz:_type_)rF   r
   rG   r$   )rc   rF   r   r   r   _init_param  s   

r   c                 C   s  d}|D ]}	|	j r!|	jtu r|	jtu sd}q|r!td|	jdqdd | D }
|
tttd g }| D ]}	t	|	||
||}|rG|
| q6|rbdd	d
 | D }|
| dt d| d |sgdg}dd |D }|r~|dg7 }|dd |D 7 }td|g| ||
|d dS )NFTznon-default argument z follows default argumentc                 S   s   i | ]
}d |j  |jqS )_type_)r$   r>   ra   r   r   r   
<dictcomp>#  rp   z_init_fn.<locals>.<dictcomp>)r
   _HAS_DEFAULT_FACTORY__dataclass_builtins_object__rk   c                 s   s     | ]}|j tu r|jV  qd S r"   )rM   r*   r$   ra   r   r   r   rd   4  s    
z_init_fn.<locals>.<genexpr>rl   rj   rR   passc                 S      g | ]}t |qS r   r   ra   r   r   r   ro   <      z_init_fn.<locals>.<listcomp>*c                 S   r   r   r   ra   r   r   r   ro   B  r   r&   )ru   rt   rv   )rI   rF   r
   rG   	TypeErrorr$   updater   objectr   appendrr   _POST_INIT_NAMEr   )r   
std_fieldskw_only_fieldsr]   has_post_initr   rt   r   seen_defaultrc   ru   
body_linesline
params_str_init_paramsr   r   r   _init_fn  sH   


r   c                 C   s2   t dddddd | D  d g|d}t|S )	Nr   r   z(return self.__class__.__qualname__ + f"(r|   c                 S   s    g | ]}|j  d |j  dqS )z={self.z!r}r#   ra   r   r   r   ro   O  s    z_repr_fn.<locals>.<listcomp>z)"rt   )r   rr   r<   )r   rt   fnr   r   r   _repr_fnK  s   
r   c                 C   sp   | t d}|rdddd |D  d }nd}tdd	d
| dddf||dtddd
| dddf||dfS )N)rC   r   rj   rk   c                 s   s    | ]}t |jV  qd S r"   )rA   r$   ra   r   r   r   rd   Z  r{   z'_frozen_get_del_attr.<locals>.<genexpr>rq   ri   __setattr__)r   r$   r   z if type(self) is cls or name in :z> raise FrozenInstanceError(f"cannot assign to field {name!r}")z)super(cls, self).__setattr__(name, value))ru   rt   __delattr__r%   z; raise FrozenInstanceError(f"cannot delete field {name!r}")z"super(cls, self).__delattr__(name))r   rr   r   )rC   r   rt   ru   
fields_strr   r   r   _frozen_get_del_attrV  s2   

r   c                 C   s$   t | ddd| | | dg|dS )N)r   otherz%if other.__class__ is self.__class__:z return zreturn NotImplementedr   )r   )r$   op
self_tupleother_tuplert   r   r   r   _cmp_fno  s   r   c                 C   s$   t d| }tddd| dg|dS )Nr   __hash__r   zreturn hash(rR   r   )rs   r   )r   rt   r   r   r   r   _hash_fn}  s   
r   c                 C   s$   | |j u pt| |ju o| j|j u S r"   )ClassVarr>   _GenericAlias
__origin__)a_typetypingr   r   r   _is_classvar  s   

r   c                 C   s   | |j u pt| |j u S r"   )r   r>   r   dataclassesr   r   r   _is_initvar  s   
r   c                 C   s
   | |j u S r"   )r	   r   r   r   r   _is_kw_only  r'   r   c           	      C   s   t | }|rAd }|d}|stj|jj}ntj|j}|r2|j||u r2tj|jj}|rA|||d|rAdS dS )N      TF)_MODULE_IDENTIFIER_REmatchgroupsysmodulesgetr   __dict__)	
annotationrC   a_moduler   is_type_predicater   r   module_namemoduler   r   r   _is_type  s   
)
r   c                 C   s~  t | |t}t|tr|}nt|tjrt}t|d}||_||_t	|_
tjd}|rDt||sAt|jtrDt|j| ||jtrDt|_
|j
t	u rftjt }t||sct|jtrft|j| ||jtrft|_
|j
ttfv r{|jtur{td|j d|j
t	tfv r|jtu r||_n|j
tu sJ |jturtd|j d|j
t	u rt|jtttfrtdt|j d|j d|S )	N)rF   r   field z cannot have a default factoryz$ is a ClassVar but specifies kw_onlyzmutable default z for field z$ is not allowed: use default_factory)rT   r
   r@   r   rO   MemberDescriptorTyper   r$   r>   r(   rM   r   r   r   r   strr   r   r)   r   r   r   r*   rG   r   rL   rF   listdictr9   r_   )rC   a_namer   default_kw_onlyrF   rc   r   r   r   r   r   
_get_field  sX   








	


r   c                 C   s"   t |tr| j d|j |_|S )Nrl   )r@   r   r   r   )rC   r   r   r   r   _set_qualname1  s   
r   c                 C   s(   || j v rdS t| | t| || dS )NTF)r   r   setattr)rC   r$   r   r   r   r   _set_new_attribute8  s
   

r   c                 C   s   d S r"   r   rC   r   rt   r   r   r   _hash_set_noneG  r   r   c                 C   s   dd |D }t | t||S )Nc                 S   s(   g | ]}|j d u r|jrn|j r|qS r"   )rH   rJ   ra   r   r   r   ro   K  s   ( z_hash_add.<locals>.<listcomp>)r   r   )rC   r   rt   fldsr   r   r   	_hash_addJ  s   r   c                 C   s   t d| j )Nz-Cannot overwrite attribute __hash__ in class )r   r   r   r   r   r   _hash_exceptionN  s   r   )FFFF)FFFT)FFTF)FFTT)FTFF)FTFT)FTTF)FTTT)TFFF)TFFT)TFTF)TFTT)TTFF)TTFT)TTTF)TTTTc
           %      C   s0  i }
| j tjv rtj| j  j}ni }t| tt|||||| d}d}| jddd D ]"}t|t	d }|d urMd}|
 D ]}||
|j< q=t|tjrMd}q+| jdi }g }d}tjt }| D ]/\}}t||syt|trt|| ||jtr|rt|dd}d}qb|t| ||| qb|D ]%}||
|j< tt| |jd tr|jtu rt| |j qt| |j|j q| j D ]\}}t|tr||vrt|dq|r|r|std|s|rtd	t| t	|
 | jd
t}|tu p|d u od| jv  }|r|stddd |

 D }t|\}}|r8t| t}t | dt!|||||d|
v r2dnd||	 dd |

 D }|rTdd |D }t | dt"|| |rudd |D }t#d|} t#d|}!t | dt$dd| |!|d |rdd |D }t#d|} t#d|}!dD ]\}}"t | |t$||"| |!|drtd| d| j dq|rt%| ||D ]}#t | |#j|#rtd|#j d| j qt&t'|t'|t'||f }$|$r|$| ||| _(t| ds| jtt)*| +dd  | _,|r	t | d!t-d"d# |D  |	rt.| |} t/0|  | S )$NFr   T__annotations__z3 is KW_ONLY, but KW_ONLY has already been specifiedz& is a field but has no type annotationz5cannot inherit non-frozen dataclass from a frozen onez5cannot inherit frozen dataclass from a non-frozen oner   __eq__z eq must be true if order is truec                 S   s   g | ]}|j ttfv r|qS r   )rM   r(   r*   ra   r   r   r   ro     s    z"_process_class.<locals>.<listcomp>r&   r   __dataclass_self__c                 S   s   g | ]	}|j tu r|qS r   rM   r(   ra   r   r   r   ro     s    c                 S      g | ]}|j r|qS r   )rA   ra   r   r   r   ro         r   c                 S   r   r   rJ   ra   r   r   r   ro     r   r   z==r   c                 S   r   r   r   ra   r   r   r   ro   #  r   ))__lt__<)__le__z<=)__gt__>)__ge__z>=zCannot overwrite attribute z
 in class z). Consider using functools.total_ordering__doc__z -> Nonerw   __match_args__c                 s       | ]}|j V  qd S r"   r#   ra   r   r   r   rd   J      z!_process_class.<locals>.<genexpr>)1r   r   r   r   r   _PARAMSrX   __mro__rT   _FIELDSvaluesr$   r]   r   r   itemsr   r@   r   r   r	   r   r   r   r   rF   r
   delattrr_   rh   hasattrr   r   r   r   rs   r   r   _hash_actionboolr   inspect	signaturer   r   rf   
_add_slotsabcupdate_abstractmethods)%rC   rI   rA   rZ   r[   r\   r]   
match_argsrL   r   r   rt   any_frozen_basehas_dataclass_basesrz   base_fieldsrc   cls_annotations
cls_fieldsKW_ONLY_seenr   r$   r>   r   
class_hashhas_explicit_hashall_init_fieldsstd_init_fieldskw_only_init_fieldsr   
field_listr   r   r   r   r   hash_actionr   r   r   _process_classq  s  













r  c                    s    fddt  D S )Nc                    s   g | ]}t  |jqS r   )rT   r$   ra   r   r   r   ro   Y  s    z'_dataclass_getstate.<locals>.<listcomp>rg   r   r   r   r   _dataclass_getstateX  s   r  c                 C   s,   t t| |D ]\}}t| |j| qd S r"   )zipr   r   r   r$   )r   stater   r   r   r   r   _dataclass_setstate\  s   r  c                 C   s   d| j v rt| j dt| j }tdd t| D }||d< |D ]}||d  q#|dd  t| dd }t| | j| j	|} |d urI|| _
|rQt| _t| _| S )NrE   z already specifies __slots__c                 s   r   r"   r#   ra   r   r   r   rd   l  r   z_add_slots.<locals>.<genexpr>r   r   )r   r   r   r   rf   r   poprT   r>   	__bases__r   r  __getstate__r  __setstate__)rC   	is_frozencls_dictfield_names
field_namequalnamer   r   r   r   b  s    

r   F	rI   rA   rZ   r[   r\   r]   r   rL   r   c      	      	      s0    f	dd}
| du r|
S |
| S )a  Returns the same class as was passed in, with dunder methods
    added based on the fields defined in the class.

    Examines PEP 526 __annotations__ to determine fields.

    If init is true, an __init__() method is added to the class. If
    repr is true, a __repr__() method is added. If order is true, rich
    comparison dunder methods are added. If unsafe_hash is true, a
    __hash__() method function is added. If frozen is true, fields may
    not be assigned to after instance creation. If match_args is true,
    the __match_args__ tuple is added. If kw_only is true, then by
    default all fields are keyword-only. If slots is true, an
    __slots__ attribute is added.
    c                    s   t |  
S r"   )r  )rC   	rZ   r]   rI   rL   r   r[   rA   r   r\   r   r   wrap  s   zdataclass.<locals>.wrapNr   )rC   rI   rA   rZ   r[   r\   r]   r   rL   r   r  r   r  r   r     s   r   c                 C   s>   zt | t}W n ty   tddw tdd | D S )zReturn a tuple describing the fields of this dataclass.

    Accepts a dataclass or an instance of one. Tuple elements are of
    type Field.
    z0must be called with a dataclass type or instanceNc                 s   s    | ]
}|j tu r|V  qd S r"   r   ra   r   r   r   rd     s    zfields.<locals>.<genexpr>)rT   r   AttributeErrorr   rf   r   )class_or_instancer   r   r   r   r     s   
r   c                 C   s   t t| tS )z2Returns True if obj is an instance of a dataclass.)r   r>   r   )objr   r   r   _is_dataclass_instance  s   r!  c                 C   s*   t | trt | ts| nt| }t|tS )zEReturns True if obj is a dataclass or an instance of a
    dataclass.)r@   r>   r   r   r   )r   rC   r   r   r   r     s    
r   dict_factoryc                C      t | stdt| |S )a  Return the fields of a dataclass instance as a new dictionary mapping
    field names to field values.

    Example usage:

      @dataclass
      class C:
          x: int
          y: int

      c = C(1, 2)
      assert asdict(c) == {'x': 1, 'y': 2}

    If given, 'dict_factory' will be used instead of built-in dict.
    The function applies recursively to field values that are
    dataclass instances. This will also look into built-in containers:
    tuples, lists, and dicts.
    z0asdict() should be called on dataclass instances)r!  r   _asdict_inner)r   r#  r   r   r   r        
r   c                    s   t | r"g }t| D ]}tt| |j }||j|f q
 |S t| tr9t| dr9t	|  fdd| D  S t| t
tfrMt	|  fdd| D S t| trat	|  fdd|  D S t| S )N_fieldsc                       g | ]}t | qS r   r%  rb   vr"  r   r   ro     r   z!_asdict_inner.<locals>.<listcomp>c                 3       | ]}t | V  qd S r"   r)  r*  r"  r   r   rd     r{   z _asdict_inner.<locals>.<genexpr>c                 3   (    | ]\}}t | t | fV  qd S r"   r)  rb   kr+  r"  r   r   rd     s    )r!  r   r%  rT   r$   r   r@   rf   r   r>   r   r   r   copydeepcopy)r   r#  r4   rc   r   r   r"  r   r%    s   

r%  tuple_factoryc                C   r$  )a  Return the fields of a dataclass instance as a new tuple of field values.

    Example usage::

      @dataclass
      class C:
          x: int
          y: int

    c = C(1, 2)
    assert astuple(c) == (1, 2)

    If given, 'tuple_factory' will be used instead of built-in tuple.
    The function applies recursively to field values that are
    dataclass instances. This will also look into built-in containers:
    tuples, lists, and dicts.
    z1astuple() should be called on dataclass instances)r!  r   _astuple_inner)r   r3  r   r   r   r     r&  r   c                    s   t | rg }t| D ]}tt| |j }|| q
 |S t| tr6t| dr6t	|  fdd| D  S t| t
tfrJt	|  fdd| D S t| tr^t	|  fdd|  D S t| S )Nr'  c                    r(  r   r4  r*  r2  r   r   ro   (  r   z"_astuple_inner.<locals>.<listcomp>c                 3   r,  r"   r5  r*  r2  r   r   rd   -  r{   z!_astuple_inner.<locals>.<genexpr>c                 3   r-  r"   r5  r.  r2  r   r   rd   /  s    )r!  r   r4  rT   r$   r   r@   rf   r   r>   r   r   r   r0  r1  )r   r3  r4   rc   r   r   r2  r   r4    s   

r4  r   )bases	namespacerI   rA   rZ   r[   r\   r]   r   rL   r   c                   s  du ri t  }i  i |D ]^}t|tr|}d}n"t|dkr&|\}}nt|dkr6|\}}}||< ntd|t|trF| sMtd|t|rYtd|||v rdtd||| | |< q fd	d
}t	
| |i |}t|||||||	|
||d
S )a  Return a new dynamically created dataclass.

    The dataclass name will be 'cls_name'.  'fields' is an iterable
    of either (name), (name, type) or (name, type, Field) objects. If type is
    omitted, use the string 'typing.Any'.  Field objects are created by
    the equivalent of calling 'field(name, type [, Field-info])'.

      C = make_dataclass('C', ['x', ('y', int), ('z', int, field(init=False))], bases=(Base,))

    is equivalent to:

      @dataclass
      class C(Base):
          x: 'typing.Any'
          y: int
          z: int = field(init=False)

    For the bases and namespace parameters, see the builtin type() function.

    The parameters init, repr, eq, order, unsafe_hash, and frozen are passed to
    dataclass().
    Nz
typing.Anyr      zInvalid field: z'Field names must be valid identifiers: z"Field names must not be keywords: zField name duplicated: c                    s    |   |    | d< d S )Nr   )r   )r   annotationsdefaultsr7  r   r   exec_body_callbackn  s   

z*make_dataclass.<locals>.exec_body_callbackr  )r9   r@   r   lenr   isidentifierkeyword	iskeywordr1   rO   	new_classr   )cls_namer   r6  r7  rI   rA   rZ   r[   r\   r]   r   rL   r   seenitemr$   tpspecr<  rC   r   r9  r   r   5  s:   






r   c                K   s   t | stdt| t D ];}|jtu rq|js)|j|v r(t	d|j dq|j|vrJ|jt
u rA|jtu rAt	d|jdt| |j||j< q| jdi |S )a,  Return a new object replacing specified fields with new values.

    This is especially useful for frozen classes.  Example usage:

      @dataclass(frozen=True)
      class C:
          x: int
          y: int

      c = C(1, 2)
      c1 = replace(c, x=3)
      assert c1.x == 3 and c1.y == 2
      z1replace() should be called on dataclass instancesr   zC is declared with init=False, it cannot be specified with replace()zInitVar z! must be specified with replace()Nr   )r!  r   rT   r   r   rM   r)   rI   r$   r_   r*   rF   r
   	__class__)r   changesrc   r   r   r   r   }  s   


r   r"   )Krer   r0  rO   r   r?  builtinsr:   r   r/   r   r   __all__r  r   r   r   r   r
   r   r	   rP   rN   r    r(   r)   r*   r   r   r   compiler   r<   r   r   rX   r   rh   rs   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r   r   r   r!  r   r   r   r%  rf   r   r4  r   r   r   r   r   r   <module>   s     

@	<<;_	
 h
")H