o
    i                     @   sT   d dl mZ d dlZd dlZd dlZd dlmZ dd Zd
ddZG dd	 d	Z	dS )    )BytesION)settingsc              	   C   sN   ddl m} ddlm} z| |  }t|j}|W S  |tfy&   Y dS w )zp
    Load a templatetag library on multiple Django versions.

    Returns None if the library isn't loaded.
    r   )get_installed_libraries)InvalidTemplateLibraryN)django.template.backends.djangor   django.template.libraryr   	importlibimport_moduleregisterKeyError)libnamer   r   lib r   X/var/www/html/formularioweb/env/lib/python3.10/site-packages/django_extensions/compat.pyload_tag_library   s   
r   c                 C   s2   t tdd}|r|D ]}| |v r||    S q
|S )zRead template settings	TEMPLATESN)getattrr   )template_keydefaulttemplates_vartdictr   r   r   get_template_setting   s   r   c                   @   s0   e Zd ZdZejdfddZdd Zdd Zd	S )
UnicodeWriterz
    CSV writer which will write rows to CSV file "f",
    which is encoded in the given encoding.
    We are using this custom UnicodeWriter for python versions 2.x
    utf-8c                 K   s:   t  | _tj| jfd|i|| _|| _t| | _d S )Ndialect)r   queuecsvwriterstreamcodecsgetincrementalencoderencoder)selffr   encodingkwdsr   r   r   __init__0   s   zUnicodeWriter.__init__c                 C   sR   | j dd |D  | j }|d}| j|}| j| | j	d d S )Nc                 S   s   g | ]}| d qS )r   )encode).0sr   r   r   
<listcomp>7   s    z*UnicodeWriter.writerow.<locals>.<listcomp>r   r   )
r   writerowr   getvaluedecoder!   r'   r   writetruncate)r"   rowdatar   r   r   r+   6   s   

zUnicodeWriter.writerowc                 C   s   |D ]}|  | qd S N)r+   )r"   rowsr0   r   r   r   	writerowsB   s   zUnicodeWriter.writerowsN)	__name__
__module____qualname____doc__r   excelr&   r+   r4   r   r   r   r   r   )   s
    r   r2   )
ior   r   r   r   django.confr   r   r   r   r   r   r   r   <module>   s   

