
    c                        d dl mZ d dlZd dlZd dlZd dlmZmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ ddZddZddZej        dd            Zd dZdS )!    )annotationsN)IteratorSequence)datetime)Path)PYLINT_HOME)get_python_pathex	Exceptionfilepathstrcrash_file_pathreturnr   c           
        t          t                    t          j                                        t          |                    z                                  }t          |d          5 }|                                }d d d            n# 1 swxY w Y   d}|	                                sd}|d|  d| d| j
        j         dz  }|t          j                    z  }|d	z  }	 t          |d
d          5 }|                    |           d d d            n# 1 swxY w Y   n<# t          $ r/}t!          d| d| d| dt"          j                   Y d }~nd }~ww xY w|S )Nutf8)encoding zFirst, please verify that the bug is not already filled:
https://github.com/PyCQA/pylint/issues/

Then create a new crash issue:
https://github.com/PyCQA/pylint/issues/new?assignees=&labels=crash%2Cneeds+triage&template=BUG-REPORT.yml

z
Issue title:
Crash ``z`` (if possible, be more specific about what made pylint crash)
Content:
When parsing the following file:

<!--
 If sharing the code is not an option, please state so,
 but providing only the stacktrace would still be helpful.
 -->

```python
z
```

pylint crashed with a ``z*`` and with the following stacktrace:
```
z```
az0Can't write the issue template for the crash in z because of: 'z'
Here's the content anyway:
.)file)r   r   r   nowstrftimer   resolveopenreadexists	__class____name__	traceback
format_excwriter   printsysstderr)r
   r   r   issue_template_pathffile_contenttemplateexcs           1lib/python3.11/site-packages/pylint/lint/utils.pyprepare_crash_reportr+      sL   [HLNN33C4H4HIIIgii  
h	(	(	(  Avvxx                             H%%''    
     .!   H& 	$&&&HH
%sV<<< 	GGH	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 
 
 
L?R L LL L@HL L L	
 	
 	
 	
 	
 	
 	
 	
 	

 sN   ,BBB%D% 7DD% DD%  D!D% %
E/%EEr%   c                    d|  d| dS )NzFatal error while checking 'zs'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in 'z'. )r   r%   s     r*   get_fatal_error_messager.   C   s0    	Wx 	W 	W?R	W 	W 	W    argsSequence[str]	list[str]c                   t          t          j                  }g }t                      }| D ]?}t	          |          }||vr*|                    |           |                    |           @|t          j        z   t          j        d d <   |S )N)listr#   pathsetr	   appendadd)r0   originalchangesseenargr5   s         r*   _patch_sys_pathr=   K   s    CH~~HG55D  s##t 	NN4   HHTNNNCH$CHQQQKOr/   Iterator[None]c              #     K   t          |           }	 dV  |t          j        dd<   dS # |t          j        dd<   w xY w)aF  Prepare 'sys.path' for running the linter checks.

    Within this context, each of the given arguments is importable.
    Paths are added to 'sys.path' in corresponding order to the arguments.
    We avoid adding duplicate directories to sys.path.
    `sys.path` is reset to its original value upon exiting this context.
    N)r=   r#   r5   )r0   r9   s     r*   fix_import_pathr@   Y   sQ       t$$Hhs   * =selfotherboolc                >    	  | j         |  dS # t          $ r Y dS w xY w)zChecks if self is relative to other.

    Backport of pathlib.Path.is_relative_to for Python <3.9
    TODO: py39: Remove this backport and use stdlib function.
    TF)relative_to
ValueError)rA   rB   s     r*   _is_relative_torG   i   s>    %  t   uus   
 
)r
   r   r   r   r   r   r   r   )r   r   r%   r   r   r   )r0   r1   r   r2   )r0   r1   r   r>   )rA   r   rB   r   r   rC   )
__future__r   
contextlibr#   r   collections.abcr   r   r   pathlibr   pylint.configr   pylint.lint.expand_modulesr	   r+   r.   r=   contextmanagerr@   rG   r-   r/   r*   <module>rO      s  
 # " " " " "     



     . . . . . . . .             % % % % % % 6 6 6 6 6 6. . . .b          
 
 
 
 
 
r/   