
    j                     (    d dl Z ddZd Zd Zd ZdS )	    N2   -c                     t          d|t          |           z
            dz  }d||z   d|  d||z   }t          |           dS )a  
    Formatting output used for the CLI

    :param header_text: The text to be displayed
    :type header_text: str
    :param width: total width of the display
    :type width: int
    :param char: which char to be used as a filler
    :type char: str
    r      
 N)maxlenprint)header_textwidthcharpaddingformatted_headers        [/home/ubuntu/.hermes/hermes-agent/venv/lib/python3.11/site-packages/apkInspector/helpers.pypretty_print_headerr      s`     !US---..!3GKD7NKK[KK4'>KK	
    c                     	 t          | d          5 }|                    |           ddd           n# 1 swxY w Y   t          d|             dS # t          $ r }t          d|  d|            Y d}~dS d}~ww xY w)z
    Write data to file

    :param data: the actual data
    :type data: bytes
    :param filename: file to be saved in
    :type filename: str
    wbNzData saved to zError while saving data to z: )openwriter   	Exception)filenamedataoutput_filees       r   save_data_to_filer      s    =(D!! 	$[d###	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$)x))***** = = =;H;;;;<<<<<<<<<=s2   A 4A 8A 8A 
A=A88A=c                     t          | d          5 }t          j        ||d           ddd           dS # 1 swxY w Y   dS )z
    Simple method to save a dictionary as JSON into the filename.

    :param filename: the name of the file to be saved as
    :type filename: str
    :param dictionary: the dictionary to be saved as JSON
    :type dictionary: dict
    w   )indentN)r   jsondump)r   
dictionaryh_files      r   save_to_jsonr&   %   s     
h		 0	*fQ////0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0s   6::c                 V    ddddddd                     fd| D                       S )	z
    Escaping characters that cant be included within an XML file.

    :param data: The string to escape
    :type data: str
    :return: The escaped output
    :rtype: str
    z&lt;z&gt;z&amp;z&quot;z&apos;)<>&"' c              3   D   K   | ]}                     ||          V  d S )N)get).0creplacementss     r   	<genexpr>z&escape_xml_entities.<locals>.<genexpr>B   s3      88a<##Aq))888888r   )join)r   r2   s    @r   escape_xml_entitiesr5   2   sI      L 7788884888888r   )r   r   )r"   r   r   r&   r5    r   r   <module>r7      sY        = = ="
0 
0 
09 9 9 9 9r   