
    X-PhG                        d dl mZ d dlZd dl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 ej        dd            ZdddZ G d dej                  ZdS )    )annotationsN)Iterator)Path)_find_config_file)CONFIG_NAMESSHARED_CONFIG_NAMEStargetr   returnIterator[None]c              #     K   t          j                    }t          j        |            	 d V  t          j        |           d S # t          j        |           w xY wN)osgetcwdchdir)r	   dirs     \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mypy/test/test_config_parser.pyr   r      sT       )++CHV
s   A Apathcontent
str | NoneNonec                    | j         dk    r|d}|                     |           d S |d}|                     |           d S )Nz.tomlz[tool.mypy]
strict = truez[mypy]
strict = True)suffix
write_text)r   r   s     r   write_configr      sS    {g?2G     ?-G         c                  .    e Zd ZddZddZddZddZdS )	FindConfigFileSuiter
   r   c                   t          j                    5 }t          |          }|dz                                   t	          |          5  t                      }|J 	 d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )N.git)tempfileTemporaryDirectoryr   touchr   r   )self_tmpdirtmpdirresults       r   test_no_configz"FindConfigFileSuite.test_no_config&   s
   (** 	&g']]Ff_##%%%v & &*,,~~~~& & & & & & & & & & & & & & &	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&s5   6B
A*B*A.	.B1A.	2BB	Bc                   t           t          z   D ]_}t          j                    5 }t	          |          }||z  }t          |           |dz  }|                                 t          |          5  t                      }|J t	          |d                   	                                |	                                k    sJ |dz  }|
                                 t                      }|J |                                 t                      }|J |dz  }|
                                 t                      }|J 	 d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   ad S )Nchild   r   z.hg)r   r   r    r!   r   r   mkdirr   r   resolver"   unlink)	r#   namer$   r%   configr)   r&   githgs	            r   'test_parent_config_with_and_without_gitz;FindConfigFileSuite.test_parent_config_with_and_without_git.   s    #66 	* 	*D,.. *'g$V$$$(5\\ * *.00F!---q	??22448H8HHHHH&.CIIKKK.00F!>>>JJLLL.00F!---BHHJJJ.00F!>>>>%* * * * * * * * * * * * * * ** * * * * * * * * * * * * * *	* 	*s7   AE$2CEE$EE$EE$$E(	+E(	c                   t          j                    5 }t          |          }|dz  }|dz  }|dz  }|dz  }|dz  }|                                 ||fD ]}t	          |           t	          |           t	          |           t	          |           t          |          5  t                      }	|	J t          j        	                    |	d                   dk    sJ |
                                 t                      }	|	J t          j        	                    |	d                   dk    sJ |
                                 t                      }	|	J t          j        	                    |	d                   dk    sJ |
                                 t                      }	|	J t          j        	                    |	d                   dk    sJ 	 d d d            n# 1 swxY w Y   	 d d d            d S # 1 swxY w Y   d S )Npyproject.tomlz	setup.cfgmypy.iniz	.mypy.inir)   r*   )r    r!   r   r+   r   r   r   r   r   basenamer-   )
r#   r$   r%   	pyproject	setup_cfgmypy_inidot_mypyr)   cwdr&   s
             r   test_precedencez#FindConfigFileSuite.test_precedenceM   s   (** #	Fg']]F!11I,I
*H+HW$EKKMMM F FY'''Y'''X&&&X&&&3ZZ F F.00F!---7++F1I66*DDDDOO%%%.00F!---7++F1I66+EEEEOO%%%.00F!---7++F1I66:JJJJJ$$&&&.00F!---7++F1I66+EEEEE%F F F F F F F F F F F F F F FF#	F #	F #	F #	F #	F #	F #	F #	F #	F #	F #	F #	F #	F #	F #	F #	F #	F #	Fs7   BG<#D1G!G<!G%%G<(G%)G<<H H c                   t          j                    5 }t          |          }|dz  }|                                 |dz  }|dz  }t	          |           t	          |d           t          |          5  t                      }|J t          |d                                                   |                                k    sJ 	 d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr)   r5   r4    )r   r*   )r    r!   r   r+   r   r   r   r,   )r#   r$   r%   r)   parent_mypychild_pyprojectr&   s          r   test_precedence_missing_sectionz3FindConfigFileSuite.test_precedence_missing_sections   s   (** 	Jg']]FW$EKKMMM :-K#&66O%%%"5555u J J*,,)))F1I..00K4G4G4I4IIIIIIJ J J J J J J J J J J J J J J	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	Js7   A"C-6AC	C-C	C-C	C--C14C1N)r
   r   )__name__
__module____qualname__r'   r2   r<   rA    r   r   r   r   $   so        & & & &* * * *>$F $F $F $FLJ J J J J Jr   r   )r	   r   r
   r   r   )r   r   r   r   r
   r   )
__future__r   
contextlibr   r    unittestcollections.abcr   pathlibr   mypy.config_parserr   mypy.defaultsr   r   contextmanagerr   r   TestCaser   rE   r   r   <module>rO      s   " " " " " "     				   $ $ $ $ $ $       0 0 0 0 0 0 ; ; ; ; ; ; ; ;    ! ! ! ! !^J ^J ^J ^J ^J(+ ^J ^J ^J ^J ^Jr   