U
    aE                     @   s  d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZmZ d dlmZ d dlmZmZ d d	lmZ d d
lmZmZ d dlmZ eddgdZdhZee
dd Zee
dd Zee
dd Zee
dd Zee
dd Z ee
dd Z!ee
dd Z"ee
dd Z#ee
d d! Z$ee
d"d# Z%ee
d$d% Z&ee
d&d' Z'ee
d(d) Z(ee
d*d+ Z)ee
d,d- Z*dS ).    N)Local)apps)ImproperlyConfigured)setting_changed)connectionsrouter)ConnectionRouter)Signalreceiver)timezoneFORMAT_SETTINGSreset_format_cache)emptytemplatecontext)Zproviding_argsZ	DATABASESc                  K   s$   | d dkr ddl m} t |_d S )NsettingZCACHESr   )caches)Zdjango.core.cacher   r   Z_caches)kwargsr    r   /home/adriano.carvalho/ftp/files/BrinquedotecaVirtual/brinquedotecavirtual/venv/lib/python3.8/site-packages/django/test/signals.pyclear_cache_handlers   s    r   c                  K   s^   | d dkrZddl m} |  ddlm} |  ddlm} |  ddlm} i |_	d S )Nr   INSTALLED_APPSr   
get_finder)get_commands)get_app_template_dirs
trans_real)
"django.contrib.staticfiles.findersr   cache_clearZdjango.core.managementr   Zdjango.template.utilsr   django.utils.translationr   _translations)r   r   r   r   r   r   r   r   update_installed_apps!   s    r#   c               	   K   s   | d dkrNt tdrD| d r.| d tjd< ntjdd  t  tj  | d dkrt	
 D ]H}z|`W n tk
r   Y nX z|`W n tk
r   Y nX |  qbd S )Nr   	TIME_ZONEtzsetvalueZTZ>   USE_TZr$   )hasattrtimeosenvironpopr%   r   Zget_default_timezoner    r   allAttributeErrorZtimezone_nameZensure_timezone)r   connr   r   r   update_connections_time_zone2   s$    

r0   c                  K   s   | d dkrt  jt_d S )Nr   ZDATABASE_ROUTERS)r   Zroutersr   r   r   r   r   clear_routers_cacheN   s    r2   c                  K   sp   | d dkrlddl m} z|`W n tk
r4   Y nX d |_i |_ddlm} |j	  ddl
m} |	  d S )Nr   >   DEBUGFILE_CHARSETr   	TEMPLATESr   )engines)Engine)get_default_renderer)Zdjango.templater6   Z	templatesr.   Z
_templatesZ_enginesZdjango.template.enginer7   get_defaultr    Zdjango.forms.renderersr8   )r   r6   r7   r8   r   r   r   reset_template_enginesT   s    
r:   c                  K   s"   | d dkrddl m} i |_d S )Nr   ZSERIALIZATION_MODULESr   )serializers)Zdjango.corer;   Z_serializers)r   r;   r   r   r   clear_serializers_cachei   s    r<   c                  K   sR   | d dkr&ddl m} d |_t |_| d dkrNddl m} i |_|j  d S )Nr   >   LANGUAGE_CODE	LANGUAGESLOCALE_PATHSr   r   >   r>   r?   )r!   r   _defaultr   _activer"   Zcheck_for_languager    )r   r   r   r   r   language_changedp   s    rB   c                  K   s"   | d t ks| d dkrt  d S )Nr   ZUSE_THOUSAND_SEPARATORr   r1   r   r   r   localize_settings_changed|   s    rC   c                  K   s"   | d dkrddl m} t|_d S )Nr   ZDEFAULT_FILE_STORAGEr   )default_storage)Zdjango.core.files.storagerD   r   _wrapped)r   rD   r   r   r   file_storage_changed   s    rF   c                  K   s.   | d r*| d t kr*tjd| d  dd d S )NZenterr   z6Overriding setting %s can lead to unexpected behavior.   )
stacklevel)COMPLEX_OVERRIDE_SETTINGSwarningswarnr1   r   r   r   complex_setting_changed   s    rL   c                  K   s.   | d dkr*ddl m}m} |  |d  d S )Nr   ZROOT_URLCONFr   )clear_url_cachesset_urlconf)Zdjango.urlsrM   rN   )r   rM   rN   r   r   r   root_urlconf_changed   s    rO   c                  K   s"   | d dkrddl m} t|_d S )Nr   >   STATIC_ROOTSTATICFILES_STORAGE
STATIC_URLr   )staticfiles_storage)Z"django.contrib.staticfiles.storagerS   r   rE   )r   rS   r   r   r   static_storage_changed   s    rT   c                  K   s$   | d dkr ddl m} |  d S )Nr   >   STATICFILES_DIRSrP   r   r   )r   r   r    )r   r   r   r   r   static_finders_changed   s    rV   c                  K   s$   | d dkr ddl m} |  d S )Nr   ZAUTH_PASSWORD_VALIDATORSr   )get_default_password_validators)Z'django.contrib.auth.password_validationrW   r    )r   rW   r   r   r    auth_password_validators_changed   s    rX   c                  K   s   | d dkrt   zddlm} | }W n tk
r>   Y n\X ddlm} ||_ddlm} ||_ddlm	} ||_ddl
m} ||_dd	lm} ||_d S )
Nr   ZAUTH_USER_MODELr   )get_user_model)backends)forms)modwsgi)changepassword)views)r   clear_cacheZdjango.contrib.authrY   r   rZ   	UserModelr[   Zdjango.contrib.auth.handlersr\   Z'django.contrib.auth.management.commandsr]   r^   )r   rY   r`   rZ   r[   r\   r]   r^   r   r   r   user_model_swapped   s"    
ra   )+r*   r)   rJ   Zasgiref.localr   Zdjango.appsr   Zdjango.core.exceptionsr   Zdjango.core.signalsr   Z	django.dbr   r   Zdjango.db.utilsr   Zdjango.dispatchr	   r
   Zdjango.utilsr   Zdjango.utils.formatsr   r   Zdjango.utils.functionalr   Ztemplate_renderedrI   r   r#   r0   r2   r:   r<   rB   rC   rF   rL   rO   rT   rV   rX   ra   r   r   r   r   <module>   sX   













	
