a
    `                     @   sf   d Z ddlmZ ddlZddlZddlZddlmZmZ G dd dej	Z
dd Zd	d
 Zdd ZdS )z4Module containing the logic for our debugging logic.    )print_functionN)DictListc                       s*   e Zd ZdZ fddZdddZ  ZS )DebugActionz+argparse action to print debug information.c                    s&   | d| _tt| j|i | dS )zInitialize the action.

        This takes an extra `option_manager` keyword argument which will be
        used to delay response.
        option_managerN)pop_option_managersuperr   __init__)selfargskwargs	__class__ 0lib/python3.9/site-packages/flake8/main/debug.pyr
      s    zDebugAction.__init__Nc                 C   s2   | j jsdS ttjt| j ddd tddS )z;Perform the argparse action for printing debug information.N   T)indentZ	sort_keysr   )r   registered_pluginsprintjsondumpsinformation
SystemExit)r   parser	namespacevaluesoption_stringr   r   r   __call__   s    zDebugAction.__call__)N)__name__
__module____qualname____doc__r
   r   __classcell__r   r   r   r   r   
   s   	r   c                 C   s*   | j t| t t t t ddS )z:Generate the information to be printed for the bug report.)python_implementationpython_versionsystem)versionZpluginsdependenciesplatform)r'   plugins_fromr(   r)   r$   r%   r&   r   r   r   r   r   %   s    r   c                 C   s   dd t | jD S )z'Generate the list of plugins installed.c                 S   s   g | ]}|j |j|jd qS ))pluginr'   Zis_local)namer'   local).0r,   r   r   r   
<listcomp>5   s
   z plugins_from.<locals>.<listcomp>)sortedr   r+   r   r   r   r*   3   s    r*   c                   C   s   g S )z0Generate the list of dependencies we care about.r   r   r   r   r   r(   ?   s    r(   )r"   Z
__future__r   argparser   r)   typingr   r   Actionr   r   r*   r(   r   r   r   r   <module>   s   