a
    Lcòfâ  ã                   @   s0   d dl mZ dd„ fdd„ZG dd„ deƒZdS )	é    )ÚBaseCommandc                 C   s   |   d¡p|  ¡  S )NÚ_)Ú
startswithÚisupper)Úk© r   úi/home/httpd/docs/test/DocsMgr/lib/python3.9/site-packages/django/core/management/commands/diffsettings.pyÚ<lambda>   ó    r	   c                    s   ‡ ‡fdd„t ˆ ƒD ƒS )z2Convert a module namespace to a Python dictionary.c                    s$   i | ]}ˆ|ƒs|t tˆ |ƒƒ“qS r   )ÚreprÚgetattr)Ú.0r   ©ÚmoduleZ	omittabler   r   Ú
<dictcomp>   r
   z"module_to_dict.<locals>.<dictcomp>)Údirr   r   r   r   Úmodule_to_dict   s    r   c                   @   s4   e Zd ZdZg Zdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚCommandzWDisplays differences between the current settings.py and Django's
    default settings.c                 C   s6   |j dddd� |j dddd� |j d	d
ddd� d S )Nz--allÚ
store_truezfDisplay all settings, regardless of their value. In "hash" mode, default values are prefixed by "###".)ÚactionÚhelpz	--defaultÚMODULEzvThe settings module to compare the current settings against. Leave empty to compare against Django's default settings.)Úmetavarr   z--outputÚhash©r   Zunifieda  Selects the output format. 'hash' mode displays each changed setting, with the settings that don't appear in the defaults followed by ###. 'unified' mode prefixes the default setting with a minus sign, followed by the changed setting prefixed with a plus sign.)ÚdefaultÚchoicesr   )Úadd_argument)ÚselfÚparserr   r   r   Úadd_arguments   s     üüûzCommand.add_argumentsc           	      K   sv   ddl m}m}m} |js"| ¡  t|jƒ}|d }t|rB||ƒn|ƒ}| j| j	dœ|d  }d 
|||fi |¤Ž¡S )Nr   )ÚSettingsÚglobal_settingsÚsettingsr   r   ÚoutputÚ
)Zdjango.confr!   r"   r#   Z
configuredÚ_setupr   Z_wrappedÚoutput_hashÚoutput_unifiedÚjoin)	r   Úoptionsr!   r"   r#   Úuser_settingsr   Údefault_settingsZoutput_funcr   r   r   Úhandle-   s    
ÿþýzCommand.handlec                 K   s|   g }t |ƒD ]j}||vr0| d||| f ¡ q|| || krX| d||| f ¡ q|d r| d||| f ¡ q|S )Nz%s = %s  ###z%s = %sÚallz### %s = %s)ÚsortedÚappend©r   r+   r,   r*   r$   Úkeyr   r   r   r'   ?   s    zCommand.output_hashc              	   K   sª   g }t |ƒD ]˜}||vr8| | j d||| f ¡¡ q|| || kr†| | j d||| f ¡¡ | | j d||| f ¡¡ q|d r| d||| f ¡ q|S )Nz	+ %s = %sz	- %s = %sr.   z	  %s = %s)r/   r0   ÚstyleÚSUCCESSÚERRORr1   r   r   r   r(   K   s     ÿÿÿzCommand.output_unifiedN)	Ú__name__Ú
__module__Ú__qualname__r   Zrequires_system_checksr    r-   r'   r(   r   r   r   r   r   	   s   r   N)Zdjango.core.management.baser   r   r   r   r   r   r   Ú<module>   s   