o
    tBhX                     @  sN  U d Z ddlmZ ddlmZmZmZmZ ddlm	Z	 ddl
ZddlZddlmZ ddlmZ ddlmZ dd	lmZmZmZmZmZ dd
lmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z< ddl=m>Z> ddl?m@Z@mAZAmBZBmCZC erddlDmEZE dZFdeGd< dZHdeGd< G dd dZId`d d!ZJdad'd(ZKdad)d*ZLdbd,d-ZMdcd1d2ZNddd4d5ZOded7d8ZPdfd<d=ZQdgd@dAZRdhdDdEZSdgdFdGZTdgdHdIZUdidMdNZVdjdPdQZWG dRdS dSe-eX ZYG dTdU dUe2eeI  ZZdkdWdXZ[dld[d\Z\dmd^d_Z]dS )nzType inference constraints.    )annotations)TYPE_CHECKINGIterableListSequence)FinalN)ArgTypeExpander)erase_typevars)map_instance_to_supertype)ARG_OPTARG_POSCONTRAVARIANT	COVARIANTArgKind)#TUPLE_LIKE_INSTANCE_NAMESAnyTypeCallableTypeDeletedType
ErasedTypeInstanceLiteralTypeNoneType
Overloaded
ParametersParamSpecTypePartialType
ProperType	TupleTypeTypeTypeAliasTypeTypedDictTypeTypeList	TypeOfAny	TypeQueryTypeType	TypeVarIdTypeVarTupleTypeTypeVarTypeTypeVisitorUnboundTypeUninhabitedType	UnionType
UnpackTypecallable_with_ellipsisget_proper_typehas_recursive_typeshas_type_varsis_named_instanceis_union_with_any)	TypeState)extract_unpackfind_unpack_in_listsplit_with_instancesplit_with_prefix_and_suffix)ArgumentInferContextr   
SUBTYPE_OF   SUPERTYPE_OFc                   @  sN   e Zd ZU dZded< dZded< dddZdddZdddZdddZ	dS )
ConstraintzpA representation of a type constraint.

    It can be either T <: type or T :> type (T is a type variable).
    r%   type_varr   r   targetopintreturnNonec                 C  s   || _ || _|| _d S Nr=   r?   r>   )selfr=   r?   r>    rF   g/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/mypy/constraints.py__init__L   s   
zConstraint.__init__strc                 C  s*   d}| j tkr	d}| j d| d| j S )Nz<:z:> )r?   r;   r=   r>   )rE   op_strrF   rF   rG   __repr__Q   s   
zConstraint.__repr__c                 C  s   t | j| j| jfS rC   )hashr=   r?   r>   rE   rF   rF   rG   __hash__W   s   zConstraint.__hash__otherobjectboolc                 C  s.   t |tsdS | j| j| jf|j|j|jfkS NF)
isinstancer<   r=   r?   r>   )rE   rP   rF   rF   rG   __eq__Z   s   
 zConstraint.__eq__N)r=   r%   r?   r@   r>   r   rA   rB   )rA   rI   )rA   r@   )rP   rQ   rA   rR   )
__name__
__module____qualname____doc____annotations__r?   rH   rL   rO   rU   rF   rF   rF   rG   r<   B   s   
 


r<   calleer   	arg_typesSequence[Type | None]	arg_kindslist[ArgKind]formal_to_actuallist[list[int]]contextr8   rA   list[Constraint]c              	   C  sz   g }t |}t|D ]0\}}|D ])}	||	 }
|
du rq||
||	 | j| | j| }t| j| |t}|| qq
|S )zlInfer type variable constraints for a callable and actual arguments.

    Return a list of constraints.
    N)	r   	enumerateexpand_actual_type	arg_namesr^   infer_constraintsr\   r;   extend)r[   r\   r^   r`   rb   constraintsmapperiactualsactualactual_arg_typeactual_typecrF   rF   rG   infer_constraints_for_callable`   s   rq   templater   rm   	directionr@   c                   sl   t  fddttjD rg S tr0tsg S tj f t |}tj  |S t |S )aD  Infer type constraints.

    Match a template type, which may contain type variable references,
    recursively against a type which does not contain (the same) type
    variable references. The result is a list of type constrains of
    form 'T is a supertype/subtype of x', where T is a type variable
    present in the template and x is a type without reference to type
    variables present in the template.

    Assume T and S are type variables. Now the following results can be
    calculated (read as '(template, actual) --> result'):

      (T, X)            -->  T :> X
      (X[T], X[Y])      -->  T <: Y and T :> Y
      ((T, T), (X, Y))  -->  T :> X and T :> Y
      ((T, S), (X, Y))  -->  T :> X and S :> Y
      (X[T], Any)       -->  T <: Any and T :> Any

    The constraints are represented as Constraint objects.
    c                 3  s4    | ]\}}t t |kot  t |kV  qd S rC   )r.   ).0tarm   rr   rF   rG   	<genexpr>   s    
z$infer_constraints.<locals>.<genexpr>)	anyreversedr3   	inferringr/   r0   append_infer_constraintspop)rr   rm   rs   resrF   rw   rG   rg   }   s   
rg   c           	        s  }t t   ttrtjjjddt tr&tjj jdd t tr3 jt	j
kr3g S ttr@tj gS tkr\ttr\g }jD ]}|t|  qN|S tkrxt trxg } jD ]}|t|| qj|S tkrt trt j}tfdd|D ddS tkrttrt fddjD dd}|r|S trt st S g S t S )NT)keep_erasedc                   s   g | ]}t | qS rF   infer_constraints_if_possible)rt   a_item)rs   rr   rF   rG   
<listcomp>       z&_infer_constraints.<locals>.<listcomp>)eagerc                   s   g | ]}t | qS rF   r   )rt   t_itemrm   rs   rF   rG   r      s    
F)r.   rT   r+   mypytypeopsmake_simplified_unionitemsr   type_of_anyr"   suggestion_enginer'   r<   idr9   rh   rg   r;   simplify_away_incomplete_typesany_constraintsr/   handle_recursive_unionacceptConstraintBuilderVisitor)	rr   rm   rs   orig_templater   r   r   r   resultrF   )rm   rs   rr   rG   r}      sP   


	


r}   list[Constraint] | Nonec                 C  sr   |t krtjt| |sdS |tkrtj|t| sdS |tkr3t| tr3tj|t| js3dS t	| ||S )a2  Like infer_constraints, but return None if the input relation is
    known to be unsatisfiable, for example if template=List[T] and actual=int.
    (In this case infer_constraints would return [], just like it would for
    an automatically satisfied relation like template=List[T] and actual=object.)
    N)
r9   r   subtypes
is_subtyper	   r;   rT   r'   upper_boundrg   )rr   rm   rs   rF   rF   rG   r      s   r   options!Sequence[list[Constraint] | None]list[list[Constraint]]c                 C  s8   g }| D ]}|du rqt dd |D r|| q|S )zDSelect only those lists where each item is a constraint against Any.Nc                 s  s     | ]}t t|jtV  qd S rC   )rT   r.   r>   r   rt   rp   rF   rF   rG   rx     s    z!select_trivial.<locals>.<genexpr>)allr|   )r   r   optionrF   rF   rG   select_trivial  s   
r   
constraintc                 C  s>   | j }t|r	| S ttj}t| j| jt	||g|j
|jS )z?Transform a constraint target into a union with given Any type.)r>   r2   r   r"   implementation_artifactr<   r=   r?   r+   
make_unionlinecolumn)r   r>   any_typerF   rF   rG   merge_with_any  s   
r   r+   c                 C  sD   dd | j D }dd | j D }tt|||p!tt|||S )Nc                 S  s   g | ]	}t |ts|qS rF   rT   r'   rt   ru   rF   rF   rG   r   -      z*handle_recursive_union.<locals>.<listcomp>c                 S  s   g | ]	}t |tr|qS rF   r   r   rF   rF   rG   r   .  r   )r   rg   r+   r   )rr   rm   rs   non_type_var_itemstype_var_itemsrF   rF   rG   r   '  s   r   list[list[Constraint] | None]r   rR   c                   s   |r
dd | D  ndd | D   sg S t  dkr d S t fdd dd D r2 d S t fd	d dd D rut }|rut |t  k rug } D ]}||v rZqS|durfd
d |D }nd}|| qStt||S g S )aE  Deduce what we can from a collection of constraint lists.

    It's a given that at least one of the lists must be satisfied. A
    None element in the list of options represents an unsatisfiable
    constraint and is ignored.  Ignore empty constraint lists if eager
    is true -- they are always trivially satisfiable.
    c                 S  s   g | ]}|r|qS rF   rF   rt   r   rF   rF   rG   r   =      z#any_constraints.<locals>.<listcomp>c                 S  s   g | ]}|d ur|qS rC   rF   r   rF   rF   rG   r   ?  r   r:   r   c                 3      | ]
}t  d  |V  qdS r   N)is_same_constraintsr   valid_optionsrF   rG   rx   G      z"any_constraints.<locals>.<genexpr>Nc                 3  r   r   )is_similar_constraintsr   r   rF   rG   rx   K  r   c                 S  s   g | ]}t |qS rF   )r   r   rF   rF   rG   r   W  r   )lenr   r   r|   r   list)r   r   trivial_optionsmerged_optionsr   merged_optionrF   r   rG   r   4  s,   r   xyc                   sP   | D ] t  fdd|D s dS q|D ] t  fdd| D s% dS qdS )Nc                 3      | ]}t  |V  qd S rC   is_same_constraintrt   c2c1rF   rG   rx   c      z&is_same_constraints.<locals>.<genexpr>Fc                 3  r   rC   r   r   r   rF   rG   rx   f  r   T)ry   r   r   rF   r   rG   r   a  s   r   r   r   c                 C  sN   t t| jtot t|jt}| j|jko&| j|jkp|o&tj| j|jS rC   )	rT   r.   r>   r   r=   r?   r   r   is_same_type)r   r   skip_op_checkrF   rF   rG   r   k  s   
r   c                 C  s   t | |o	t || S )a  Check that two lists of constraints have similar structure.

    This means that each list has same type variable plus direction pairs (i.e we
    ignore the target). Except for constraints where target is Any type, there
    we ignore direction as well.
    )_is_similar_constraintsr   rF   rF   rG   r   w  s   r   c                 C  sj   | D ]0}d}|D ]$}t t|jtpt t|jt}|j|jkr,|j|jks(|r,d} nq|s2 dS qdS )zCheck that every constraint in the first list has a similar one in the second.

    See docstring above for definition of similarity.
    FT)rT   r.   r>   r   r=   r?   )r   r   r   has_similarr   r   rF   rF   rG   r     s   
r   typesIterable[Type]
list[Type]c                 C  s   dd | D }|r|S t | S )Nc                 S  s   g | ]}t |r|qS rF   )is_complete_type)rt   typrF   rF   rG   r     r   z2simplify_away_incomplete_types.<locals>.<listcomp>)r   )r   completerF   rF   rG   r     s   r   r   c                 C  s   |  t S )zIs a type complete?

    A complete doesn't have uninhabited type components or (when not in strict
    optional mode) None components.
    )r   CompleteTypeVisitor)r   rF   rF   rG   r     s   r   c                      s(   e Zd Zd
 fddZddd	Z  ZS )r   rA   rB   c                   s   t  t d S rC   )superrH   r   rN   	__class__rF   rG   rH     s   zCompleteTypeVisitor.__init__ru   r*   rR   c                 C  s   dS rS   rF   )rE   ru   rF   rF   rG   visit_uninhabited_type     z*CompleteTypeVisitor.visit_uninhabited_type)rA   rB   )ru   r*   rA   rR   )rV   rW   rX   rH   r   __classcell__rF   rF   r   rG   r     s    r   c                   @  s  e Zd ZU dZded< dZdd	Zd[ddZd\ddZd]ddZd^ddZ	d_ddZ
d`ddZdadd Zdbd"d#Zdcd%d&Zddd(d)Zded+d,Zdfd.d/Zdgd1d2Zdhd4d5Zdid:d;Zdjd=d>ZdkdAdBZdldDdEZdmdGdHZdndJdKZdodMdNZdpdRdSZdqdTdUZdrdWdXZdYS )sr   z-Visitor class for inferring type constraints.r   rm   rs   r@   rA   rB   c                 C  s   || _ || _d S rC   r   )rE   rm   rs   rF   rF   rG   rH     s   
z!ConstraintBuilderVisitor.__init__rr   r)   rc   c                 C     g S rC   rF   rE   rr   rF   rF   rG   visit_unbound_type  r   z+ConstraintBuilderVisitor.visit_unbound_typer   c                 C  r   rC   rF   r   rF   rF   rG   	visit_any  r   z"ConstraintBuilderVisitor.visit_anyr   c                 C  r   rC   rF   r   rF   rF   rG   visit_none_type  r   z(ConstraintBuilderVisitor.visit_none_typer*   c                 C  r   rC   rF   r   rF   rF   rG   r     r   z/ConstraintBuilderVisitor.visit_uninhabited_typer   c                 C  r   rC   rF   r   rF   rF   rG   visit_erased_type  r   z*ConstraintBuilderVisitor.visit_erased_typer   c                 C  r   rC   rF   r   rF   rF   rG   visit_deleted_type  r   z+ConstraintBuilderVisitor.visit_deleted_typer   c                 C  r   rC   rF   r   rF   rF   rG   visit_literal_type  r   z+ConstraintBuilderVisitor.visit_literal_typer   c                 C     J d)NFzInternal errorrF   r   rF   rF   rG   visit_partial_type  s   z+ConstraintBuilderVisitor.visit_partial_typer'   c                 C  r   )NFzbUnexpected TypeVarType in ConstraintBuilderVisitor (should have been handled in infer_constraints)rF   r   rF   rF   rG   visit_type_var     z'ConstraintBuilderVisitor.visit_type_varr   c                 C  r   rC   rF   r   rF   rF   rG   visit_param_spec  s   z)ConstraintBuilderVisitor.visit_param_specr&   c                 C     t rC   NotImplementedErrorr   rF   rF   rG   visit_type_var_tuple  r   z-ConstraintBuilderVisitor.visit_type_var_tupler,   c                 C  r   rC   r   r   rF   rF   rG   visit_unpack_type  r   z*ConstraintBuilderVisitor.visit_unpack_typer   c                 C  s$   t | jtr| |j| jS td)Nz#Parameters cannot be constrained to)rT   rm   r   infer_against_anyr\   RuntimeErrorr   rF   rF   rG   visit_parameters  s   z)ConstraintBuilderVisitor.visit_parametersr   c                   sB  | j  }}g }t|ttfrZjjrZjjdgkrZtfddjjD sZjj	 t
jjd|dd}|d us=J t
j|t|rRt||| j}|| jj  |S t|trg|jd urg|j}t|trt|jd urt|j}t|tr~| j}t|tr|j}t|tr(| t}t|tsJ | jtkrcj jjrct j}|jjj}	t|	|j jD ]\}
}}t|
t r|
j!t"kr|t||| j |
j!t#kr|t||t$| j qt|
t%rXt|t%rXt&|}t|tr|j'}t(|j)p|j*}|j+|d}t|t,st|trG|j'}|+|j)t-|j)d  |j.t-|j.d  |j/t-|j/d  }|	t0|j1t2| qt|t%rW|	t0|j1t2| qt|
t3r`t4q|S | jt2kr jjjrt j}jjj}	jj5rt6|\}}}t6\}}}t7|}|d urt|t3r|	t0|j1t2t8t9| nt|tr|jjdkrt4t|t:rt4|| }|| }jj;d usJ jj<d usJ t=t>|	jj;jj<\}}}t9|| }	n|j}j}t|	||D ]\}
}}t|
t3rJ t|
t r8|
j!t"kr$|t||| j |
j!t#kr6|t||t$| j qt|
t%rt|t%rt&|}t|tr`|j'}t(|j)pY|j*}|j+|d}t|t,slt|tr|j'}|+|j)t-|j)d  |j.t-|j.d  |j/t-|j/d  }|	t0|j1t2| qt|t%r|	t0|j1t2| q|S jjr| jt2krtfddt?jjD st
j@ |rjj	 || A | jj  |S  jjr(| jtkr(t fd	dt? jjD s(t
j@| r( jj	  || A    jj  |S t|tBr5| Cj|S t|t:r^tDtEr^| jt2kr^|jFD ]}tjd
 |t2}|| qJ|S t|t:ru| jt2krutt
jGH|| jS t|t r|jIst|jJ| jS g S t|t%rt|jJ| jS t|t3rt4g S )N__call__c                 3      | ]} |kV  qd S rC   rF   r   rr   rF   rG   rx         z:ConstraintBuilderVisitor.visit_instance.<locals>.<genexpr>Tis_operator)from_concatenatebuiltins.tuplec                 3  r   rC   rF   r   r   rF   rG   rx     r   c                 3  r   rC   rF   )rt   rk   )instancerF   rG   rx     r   r   )Krm   rT   r   r   typeis_protocolprotocol_membersry   r{   r|   r   r   find_memberr   r	   rg   rs   rh   r~   fallbackr    as_anonymousr   r   r9   has_basefullnamer
   defn	type_varszipargsr'   variancer   r   neg_opr   r.   prefixrR   r\   r   copy_modifiedr   r   r^   rf   r<   r   r;   r&   r   has_type_var_tuple_typer6   r4   r!   r   r   type_var_tuple_prefixtype_var_tuple_suffixr7   tuplerz   is_protocol_implementation'infer_constraints_from_protocol_membersr   r   r1   r   r   r   tuple_fallbackvaluesr   )rE   rr   original_actualrm   r   callsubreserasedmappedtvarstvar
mapped_arginstance_argsuffixr  from_concatmapped_prefixmapped_middlemapped_suffixtemplate_prefixtemplate_middletemplate_suffixtemplate_unpackmapped_argstemplate_argstvars_prefix_tvars_suffixtemplate_argitemcbrF   )r   rr   rG   visit_instance  s`  















z'ConstraintBuilderVisitor.visit_instancer   subtyper   protocolc           	      C  s   g }|j jD ]@}tj|||}tj|||}|du s |du r$g   S |t||| j tjjtj	||j v rF|t||t
| j q|S )a]  Infer constraints for situations where either 'template' or 'instance' is a protocol.

        The 'protocol' is the one of two that is an instance of protocol type, 'subtype'
        is the type used to bind self during inference. Currently, we just infer constrains for
        every protocol member type (both ways for settable members).
        N)r   r   r   r   r   rh   rg   rs   IS_SETTABLEget_member_flagsr  )	rE   r   rr   r*  r+  r   memberinsttemprF   rF   rG   r    s   	z@ConstraintBuilderVisitor.infer_constraints_from_protocol_membersr   c                 C  s  |  }t| jtrg }| j  }| }|d u r5|js4t|j|jD ]\}}|t	||t
| j q#nx|j}t|j}| }	|	sttdd |jD }
t||
}|t|jt|j|j|d  |j|d  |j|d  t d n
|t|jt|	 |j|jd | |jd | |jd | d}t|j|jD ]\}}|t	||t
| j q|j|j}}|jd ur|j}|jd ur|j}|t	||| j |S t| jtr
| }ttj| jd}|d u r| |j| j}nt|jtt|||jg}|t	|j|| j |S t| jtr|  | j|S t| jt!r)t	|j| jj"| jS t| jt#rHt$j%j&d| j| jdd}|rFt	||| jS g S g S )	Nc                 S  s   g | ]
}|t tfv r|qS rF   )r   r   )rt   krF   rF   rG   r     s    z@ConstraintBuilderVisitor.visit_callable_type.<locals>.<listcomp>)r\   r^   rf   ret_type)r\   r^   rf   )
source_anyr   Tr   )'with_unpacked_kwargsrT   rm   r   
param_specis_ellipsis_argsr  r\   rh   rg   r  rs   r  r   r^   minr|   r<   r   r9   r  rf   r   r2  
type_guardr   r"   from_another_anyr   r-   r   r   infer_against_overloadedr$   r'  r   r   r   r   )rE   rr   r   cactualr5  ru   rv   r  
prefix_len
cactual_psmax_prefix_lencactual_prefixtemplate_ret_typecactual_ret_typer   r  rF   rF   rG   visit_callable_type  s   




z,ConstraintBuilderVisitor.visit_callable_type
overloadedr   c                 C  s   t ||}t||| jS rC   )find_matching_overload_itemrg   rs   )rE   rC  rr   r'  rF   rF   rG   r:  D  s   
z1ConstraintBuilderVisitor.infer_against_overloadedr   c                 C  sz  | j }t|to|jjdk}t|j}|d urot|j| }t|ts%J t|j}t|t	ro|r:t
|jdks:J t|ttfsC|ro|}t|trett|j|t
|j| d \}}	}|jt|	d}t|j| j|dgS t|trt
|jt
|jkr|jjjr|jjjrt|j|j| jS g }
tt
|jD ]}|
t|j| |j| | j q|
S t|tr| |j|S g S )Nr   r:   )r   rD   )rm   rT   r   r   r   r5   r   r.   r,   r&   r   r   r   r7   r
  r  r   r<   r   rs   partial_fallbackis_named_tuplerg   rangerh   r   )rE   rr   rm   is_varlength_tupleunpack_indexunpack_itemunpacked_typemodified_actualr$  actual_itemsr   rk   rF   rF   rG   visit_tuple_typeO  sN   





"
z)ConstraintBuilderVisitor.visit_tuple_typer    c                 C  sb   | j }t|tr!g }||D ]\}}}|t||| j q|S t|tr/| |j	
 |S g S rC   )rm   rT   r    r  rh   rg   rs   r   r   r   r  )rE   rr   rm   r   	item_nametemplate_item_typeactual_item_typerF   rF   rG   visit_typeddict_type  s   

z-ConstraintBuilderVisitor.visit_typeddict_typer+   c                 C  r   )NFz`Unexpected UnionType in ConstraintBuilderVisitor (should have been handled in infer_constraints)rF   r   rF   rF   rG   visit_union_type  r   z)ConstraintBuilderVisitor.visit_union_typer   c                 C  s   J d| )NFz!This should be never called, got rF   r   rF   rF   rG   visit_type_alias_type  s   z.ConstraintBuilderVisitor.visit_type_alias_typer   r   r   c                 C  s&   g }|D ]}| t||| j q|S rC   )rh   rg   rs   )rE   r   r   r   ru   rF   rF   rG   r     s   z*ConstraintBuilderVisitor.infer_against_anyc                 C  sH   t | jtrt|| j}n|j}g }|D ]}|t|| j| j q|S rC   )rT   rm   r   find_matching_overload_itemsr   rh   rg   rs   )rE   rr   r   r   ru   rF   rF   rG   visit_overloaded  s   z)ConstraintBuilderVisitor.visit_overloadedr$   c                 C  s   t | jtrt|j| jj| jS t | jtr#t|j| jjd j| jS t | jt	r3t|j| jj| jS t | jt
rBt|j| j| jS g S )Nr   )rT   rm   r   rg   r'  r2  rs   r   r   r$   r   r   rF   rF   rG   visit_type_type  s   z(ConstraintBuilderVisitor.visit_type_typeN)rm   r   rs   r@   rA   rB   )rr   r)   rA   rc   )rr   r   rA   rc   )rr   r   rA   rc   )rr   r*   rA   rc   )rr   r   rA   rc   )rr   r   rA   rc   )rr   r   rA   rc   )rr   r   rA   rc   )rr   r'   rA   rc   )rr   r   rA   rc   )rr   r&   rA   rc   )rr   r,   rA   rc   )rr   r   rA   rc   )rr   r   rA   rc   )
r   r   rr   r   r*  r   r+  r   rA   rc   )rr   r   rA   rc   )rC  r   rr   r   rA   rc   )rr   r   rA   rc   )rr   r    rA   rc   )rr   r+   rA   rc   )rr   r   rA   rc   )r   r   r   r   rA   rc   )rr   r   rA   rc   )rr   r$   rA   rc   )rV   rW   rX   rY   rZ   rH   r   r   r   r   r   r   r   r   r   r   r   r   r   r)  r  rB  r:  rN  rR  rS  rT  r   rV  rW  rF   rF   rF   rG   r     s:   
 














	 
Y

c

;



	
r   r?   c                 C  s&   | t krtS | tkrt S td|  )z,Map SubtypeOf to SupertypeOf and vice versa.zInvalid operator )r9   r;   
ValueError)r?   rF   rF   rG   r    s
   r  rC  r   c                 C  s8   | j }|D ]}tjj||tjjddr|  S q|d S )z.Disambiguate overload item against a template.T	is_compatignore_returnr   )r   r   r   is_callable_compatibler   )rC  rr   r   r'  rF   rF   rG   rD    s   rD  list[CallableType]c                 C  sJ   | j }g }|D ]}tjj||tjjddr|| q|s#|dd }|S )zMLike find_matching_overload_item, but return all matches, not just the first.TrY  N)r   r   r   r\  r   r|   )rC  rr   r   r   r'  rF   rF   rG   rU    s   
rU  )r[   r   r\   r]   r^   r_   r`   ra   rb   r8   rA   rc   )rr   r   rm   r   rs   r@   rA   rc   )rr   r   rm   r   rs   r@   rA   r   )r   r   rA   r   )r   r<   rA   r<   )rr   r+   rm   r   rs   r@   rA   rc   )r   r   r   rR   rA   rc   )r   rc   r   rc   rA   rR   )r   r<   r   r<   rA   rR   )r   r   rA   r   )r   r   rA   rR   )r?   r@   rA   r@   )rC  r   rr   r   rA   r   )rC  r   rr   r   rA   r]  )^rY   
__future__r   typingr   r   r   r   typing_extensionsr   mypy.subtypesr   mypy.typeopsmypy.argmapr   mypy.erasetyper	   mypy.maptyper
   
mypy.nodesr   r   r   r   r   
mypy.typesr   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/   r0   r1   r2   mypy.typestater3   mypy.typevartuplesr4   r5   r6   r7   
mypy.inferr8   r9   rZ   r;   r<   rq   rg   r}   r   r   r   r   r   r   r   r   r   r   r   rR   r   r   r  rD  rU  rF   rF   rF   rG   <module>   sR    %


'
P




-






	    

