sDˠ&.ddlmZddlZddlZddlZddlZddlmZmZddl m Z ddl m Z ddl m Z ddlmZddZd dZd!dZd"dZejd#dZejd$dZd%dZdS)&) annotationsN)IteratorSequence)datetime)Path) PYLINT_HOMEdiscover_package_pathex Exceptionfilepathstrcrash_file_pathreturnrc tttjt |z }t|d5}|}dddn #1swxYwYd}| sd}|d|d|d|j j dz }|tj z }|d z } t|d d5}||dddn #1swxYwYn<#t$r/}t!d |d |d |dt"jYd}~nd}~wwxYw|S)Nutf8)encodingzFirst, 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: ```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)rrrnowstrftimerresolveopenreadexists __class____name__ traceback format_excwriter printsysstderr)r r rissue_template_pathf file_contenttemplateexcs /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/lint/utils.pyprepare_crash_reportr,sL [HLNN33C4H4HIII gii h ( ( ( Avvxx                H  % % ' '   .!H& $&&&H H %sV < < <  GGH                        L?R L L L L@H L L L          sN,B  BB%D%7D D%DD% D!D%% E/%EEr&cd|d|dS)NzFatal 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/Ds0 Wx W W?R W W Wargs Sequence[str] list[str]cltjdtdtd|DS)Na_patch_sys_path has been deprecated because it relies on auto-magic package path discovery which is implemented by get_python_path that is deprecated. Use _augment_sys_path and pass additional sys.path entries as an argument obtained from discover_package_path. stacklevelc.g|]}t|gSr.r .0args r+ z#_patch_sys_path..Vs#MMM3C<<MMMr0)warningswarnDeprecationWarning_augment_sys_pathr1s r+_patch_sys_pathrBLsG M !   MMMMM N NNr0additional_pathscttj}g}t}|D]0}||vr*||||1|tjztjdd<|S)N)listr$pathsetappendadd)rCoriginalchangesseenadditional_paths r+r@r@YswCH~~HG 55D+&& $ & & NN? + + + HH_ % % %CH$CHQQQK Or0Iterator[None]c#Ktjdtdtd|D5dVddddS#1swxYwYdS)aFPrepare '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. afix_import_path has been deprecated because it relies on auto-magic package path discovery which is implemented by get_python_path that is deprecated. Use augmented_sys_path and pass additional sys.path entries as an argument obtained from discover_package_path.r5r6c.g|]}t|gSr.r r9s r+r<z#fix_import_path..xs#LLL23;;LLLr0N)r=r>r?augmented_sys_pathrAs r+fix_import_pathrRfs M !   LLtLLL M M sA  AAc#Kt|} dV|tjdd<dS#|tjdd<wxYw)zHAugment 'sys.path' by adding non-existent entries from additional_paths.N)r@r$rF)rCrJs r+rQrQ|sR!!122H  h s*=selfotherboolc> |j|dS#t$rYdSwxYw)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)rTrUs r+_is_relative_torZs> %  t uus  )r r r rrrrr)r rr&rrr)r1r2rr3)rCr2rr3)r1r2rrN)rCr2rrN)rTrrUrrrV) __future__r contextlibr$r r=collections.abcrrrpathlibr pylint.configrpylint.lint.expand_modulesr r,r/rBr@contextmanagerrRrQrZr.r0r+rbs^ #""""" ........%%%%%%<<<<<<....b O O O O     *       r0