VL idZddlmZddlZddlZddlZddlmZddl m Z ddl m Z ddlmZddlmZej&eZd ZGd d ZGd d ZddZy)zModule containing shims around Flake8 2.x behaviour. Previously, users would import :func:`get_style_guide` from ``flake8.engine``. In 3.0 we no longer have an "engine" module but we maintain the API from it. ) annotationsN)Any) expand_paths)base) application) parse_args)get_style_guidec2eZdZdZddZeddZddZy) Reporta"Public facing object that mimic's Flake8 2.0's API. .. note:: There are important changes in how this object behaves compared to the object provided in Flake8 2.x. .. warning:: This should not be instantiated by users. .. versionchanged:: 3.0.0 c|jJ||_|j|_|jj|_y)zlInitialize the Report for the user. .. warning:: This should not be instantiated by users. N)guide _application _style_guidestats_statsselfrs W/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/flake8/api/legacy.py__init__zReport.__init__'s?   ,,,''--''-- c.|jjS)z"Return the total number of errors.)r result_countrs r total_errorszReport.total_errors1s  ---rc|jj|Dcgc]*}|jd|jd|j,c}Scc}w)zGet the list of occurrences of a violation. :returns: List of occurrences of a violation formatted as: {Count} {Error Code} {Message}, e.g., ``8 E531 Some error message about the error``  )rstatistics_forcount error_codemessage)r violationss rget_statisticszReport.get_statistics6sP[[// : wwiqa { 3   s/ANrzapp.ApplicationreturnNone)r%int)r!strr% list[str])__name__ __module__ __qualname____doc__rpropertyrr#rrr r s% ...  rr ceZdZdZd dZed dZed dZd ddZd ddZ d ddZ d dd Z y) StyleGuideaDPublic facing object that mimic's Flake8 2.0's StyleGuide. .. note:: There are important changes in how this object behaves compared to the StyleGuide object provided in Flake8 2.x. .. warning:: This object should not be instantiated directly by users. .. versionchanged:: 3.0.0 c4||_|j|_y)zInitialize our StyleGuide.N)rfile_checker_manager_file_checker_managerrs rrzStyleGuide.__init__Ss'%0%E%E"rc^|jjJ|jjS)zuReturn application's options. An instance of :class:`argparse.Namespace` containing parsed options. )roptionsrs rr6zStyleGuide.optionsXs.   ((444  (((rcr|jjJ|jjjS)z+Return the extra arguments passed as paths.)rr6 filenamesrs rpathszStyleGuide.pathsas4  ((444  ((222rNc|jjJ||jj_|jj|jj t |jS)a)Run collected checks on the files provided. This will check the files passed in and return a :class:`Report` instance. :param paths: List of filenames (or paths) to check. :returns: Object that mimic's Flake8 2.0's Reporter class. )rr6r8 run_checks report_errorsr )rr9s r check_fileszStyleGuide.check_filesgse  ((444.3!!+ $$& '')d''((rc|dfd }||xs,|duxr&|tjj||S)a"Determine if a file is excluded. :param filename: Path to the file to check if it is excluded. :param parent: Name of the parent directory containing the file. :returns: True if the filename is excluded, False otherwise. ctt|gjjjjjj }| S)N)r9stdin_display_namefilename_patternsexclude)tuplerr6r@filenamerB)pathr9rs rexcludedz%StyleGuide.excluded..excludedsK&'+||'F'F&*ll&;&; LL00 E9 rN)rEr(r%bool)osrEjoin)rrDparentrFs` rrFzStyleGuide.excludedxs= ! $  K8BGGLL,J#K rcD|yt|tjs td||j|j _d|j _|j jd|j _|j jgy)z*Set up a formatter for this run of Flake8.Nz868 80!#"# ,,, ,  ,  ,rr1c tj}tg\|_|_|j}|j D]\}} t ||t|||!|j|j|jgt|S#t$rtjd|YwxYw)zProvision a StyleGuide for use. :param \*\*kwargs: Keyword arguments that provide some options for the StyleGuide. :returns: An initialized StyleGuide zCould not update option "%s")app Applicationrpluginsr6itemsgetattrsetattrAttributeErrorLOGerrormake_formatterrPrQr1)kwargsrr6keyvalues rr r s//#K/9"~,K,!!Glln; U ; GS ! GS% (;  ))"- k ""  ; II4c : ;sB''C C )rerr%r1)r- __future__rargparseloggingos.pathrHtypingrflake8.discover_filesrflake8.formattingrrM flake8.mainrr[flake8.options.parse_argsr getLoggerr*rb__all__r r1r r/rrrss] #./*0g! ) ) Xz,z,z#r