00I3dZddlZddlZddlZddlmZddlmZddlmZddlm Z ddl Z ddl m Z ddl mZdd lmZdd lmZejeZd ZGd d ZGddZdedefdZdS)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. N)Any)List)Optional)Type) expand_paths)base) application)config)get_style_guidecdeZdZdZdejddfdZedefdZ de de e fdZ dS) 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 r returnNc`|jJ||_|j|_|jj|_dS)zlInitialize the Report for the user. .. warning:: This should not be instantiated by users. N)guide _application _style_guidestats_statsselfr s /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/flake8/api/legacy.py__init__zReport.__init__)s7  ,,,''-'- c|jjS)z"Return the total number of errors.)r result_countrs r total_errorszReport.total_errors3s --r violationcJd|j|DS)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`` c@g|]}|jd|jd|jS) )count error_codemessage).0ss r z)Report.get_statistics..@sD   w 3 3 3 3 3 3   r)rstatistics_for)rrs rget_statisticszReport.get_statistics8s3  [// ::    r) __name__ __module__ __qualname____doc__app Applicationrpropertyintrstrrr)rrr r s  .CO......c...X.    S       rr c DeZdZdZdejddfdZedej fdZ ede e fdZ ddee e defd Zdd e d ee defd Z dd eeejddfdZ dd e deedeedeedef dZdS) 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 r rNc,||_|j|_dS)zInitialize our StyleGuide.N)rfile_checker_manager_file_checker_managerrs rrzStyleGuide.__init__Us'%0%E"""rc6|jjJ|jjS)zuReturn application's options. An instance of :class:`argparse.Namespace` containing parsed options. )roptionsrs rr:zStyleGuide.optionsZs"  (444 ((rc@|jjJ|jjjS)z+Return the extra arguments passed as paths.)rr: filenamesrs rpathszStyleGuide.pathscs% (444 (22rr=c|jjJ||jj_|j|jt |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. )rr:r< run_checks report_errorsr )rr=s r check_fileszStyleGuide.check_filesis_ (444.3!+ $$&&& '')))d'(((rfilenameparentcdtdtffd }||p,|duo(|tj||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. pathrc tt|gjjjjjjjj}| S)N)r=stdin_display_namefilename_patternsexcludeis_running_from_diff)tuplerr:rGrBrIdiff)rEr=rs rexcludedz%StyleGuide.excluded..excludedsS&'+|'F&*l&; L0)-): E9 rN)r2boolosrEjoin)rrBrCrMs` rrMzStyleGuide.excludedzso 3 4      x!! $  K88BGLL,J,J#K#K rreporterc(|dSt|tjstd||j|j_d|j_|jd|j_|j dS)z*Set up a formatter for this run of Flake8.Nzrsd  ......//////******!!!!!!g!! ) ) ) ) ) ) ) ) X{,{,{,{,{,{,{,{,|'#c'#j'#'#'#'#'#'#r