o
    ]’iÎ  ã                   @   s6   d dl mZmZmZ ddlmZ G dd„ dejƒZdS )é    )ÚDictÚListÚTupleé   )Ú	xmlwriterc                       s0  e Zd ZdZd2‡ fdd„Zdeddfdd„Zd	eeef ddfd
d„Z	de
eef ddfdd„Zd2dd„Zd2dd„Zd2dd„Zd2dd„Zd2dd„Zd2dd„Zd2dd„Zdedeeeef  ddfdd „Zd!eeef ddfd"d#„Zd2d$d%„Zd2d&d'„Zd2d(d)„Zd2d*d+„Zd2d,d-„Zd2d.d/„Zd2d0d1„Z‡  ZS )3ÚAppz8
    A class for writing the Excel XLSX App file.


    ÚreturnNc                    s&   t ƒ  ¡  g | _g | _i | _d| _dS )z
        Constructor.

        r   N)ÚsuperÚ__init__Ú
part_namesÚheading_pairsÚ
propertiesÚdoc_security©Úself©Ú	__class__© úS/var/www/html/stock_analysis/be/venv/lib/python3.10/site-packages/xlsxwriter/app.pyr
      s
   

zApp.__init__Ú	part_namec                 C   s   | j  |¡ d S ©N)r   Úappend)r   r   r   r   r   Ú_add_part_name)   ó   zApp._add_part_nameÚheading_pairc                 C   s8   |d sd S | j  d|d f¡ | j  d|d f¡ d S )Nr   Úlpstrr   Úi4)r   r   )r   r   r   r   r   Ú_add_heading_pair-   s   zApp._add_heading_pairr   c                 C   s
   || _ d S r   )r   )r   r   r   r   r   Ú_set_properties8   s   
zApp._set_propertiesc                 C   s†   |   ¡  |  ¡  |  ¡  |  ¡  |  ¡  |  ¡  |  ¡  |  ¡  |  ¡  |  	¡  |  
¡  |  ¡  |  ¡  |  ¡  |  d¡ |  ¡  d S )NÚ
Properties)Ú_xml_declarationÚ_write_propertiesÚ_write_applicationÚ_write_doc_securityÚ_write_scale_cropÚ_write_heading_pairsÚ_write_titles_of_partsÚ_write_managerÚ_write_companyÚ_write_links_up_to_dateÚ_write_shared_docÚ_write_hyperlink_baseÚ_write_hyperlinks_changedÚ_write_app_versionÚ_xml_end_tagÚ
_xml_closer   r   r   r   Ú_assemble_xml_fileB   s    
zApp._assemble_xml_filec                 C   s4   d}|d }|d }d|fd|fg}|   d|¡ d S )Nz6http://schemas.openxmlformats.org/officeDocument/2006/zextended-propertiesÚdocPropsVTypesÚxmlnszxmlns:vtr   )Ú_xml_start_tag)r   Úschemar2   Úxmlns_vtÚ
attributesr   r   r   r!   a   s   þzApp._write_propertiesc                 C   ó   |   dd¡ d S )NÚApplicationzMicrosoft Excel©Ú_xml_data_elementr   r   r   r   r"   n   r   zApp._write_applicationc                 C   s   |   d| j¡ d S )NÚDocSecurity)r:   r   r   r   r   r   r#   r   s   zApp._write_doc_securityc                 C   r7   )NÚ	ScaleCropÚfalser9   r   r   r   r   r$   v   r   zApp._write_scale_cropc                 C   s&   |   d¡ |  d| j¡ |  d¡ d S )NÚHeadingPairsÚvariant)r3   Ú_write_vt_vectorr   r.   r   r   r   r   r%   z   s   
zApp._write_heading_pairsc                 C   sB   g }|   d¡ | jD ]	}| d|f¡ q
|  d|¡ |  d¡ d S )NÚTitlesOfPartsr   )r3   r   r   r@   r.   )r   Ú
parts_datar   r   r   r   r&   €   s   

zApp._write_titles_of_partsÚ	base_typeÚvector_datac                 C   sf   dt |ƒfd|fg}|  d|¡ |D ]}|dkr|  d¡ |  |¡ |dkr+|  d¡ q|  d¡ d S )NÚsizeÚbaseTypez	vt:vectorr?   z
vt:variant)Úlenr3   Ú_write_vt_datar.   )r   rC   rD   r6   Úvt_datar   r   r   r@      s   
þ


€zApp._write_vt_vectorrI   c                 C   s   |   d|d › |d ¡ d S )Nzvt:r   r   r9   )r   rI   r   r   r   rH   £   s   zApp._write_vt_datac                 C   s   | j  dd¡}|  d|¡ d S )NÚcompanyÚ ÚCompany©r   Úgetr:   )r   rJ   r   r   r   r(   §   s   zApp._write_companyc                 C   s$   d| j vrd S |  d| j d ¡ d S )NÚmanagerÚManager)r   r:   r   r   r   r   r'   ¬   s   
zApp._write_managerc                 C   r7   )NÚLinksUpToDater=   r9   r   r   r   r   r)   ³   r   zApp._write_links_up_to_datec                 C   r7   )NÚ	SharedDocr=   r9   r   r   r   r   r*   ·   r   zApp._write_shared_docc                 C   s(   | j  d¡}|d u rd S |  d|¡ d S )NÚhyperlink_baseÚHyperlinkBaserM   )r   rS   r   r   r   r+   »   s   zApp._write_hyperlink_basec                 C   r7   )NÚHyperlinksChangedr=   r9   r   r   r   r   r,   Ä   r   zApp._write_hyperlinks_changedc                 C   r7   )NÚ
AppVersionz12.0000r9   r   r   r   r   r-   È   r   zApp._write_app_version)r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   Ústrr   r   Úintr   r   r   r0   r!   r"   r#   r$   r%   r&   r   r@   rH   r(   r'   r)   r*   r+   r,   r-   Ú__classcell__r   r   r   r   r      s8    







ÿÿ
þ





	r   N)Útypingr   r   r   rK   r   Ú	XMLwriterr   r   r   r   r   Ú<module>   s   	