Current File : //proc/self/root/usr/lib/python3/dist-packages/__pycache__/problem_report.cpython-312.pyc
�

�!fV�����dZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlmZmZmZdZdZGd�de�ZGd�d	e�ZGd
�de�Zdeed
eefd�Zded
efd�Zdeeded
eefd�Z d�Z!deeded
eefd�Z"deed
e#e$eee%ffd�Z&ejNGd�d��Z(Gd�d�Z)Gd�dejT�Z+y)z(Store, load, and handle problem reports.�N)�	Generator�Iterable�Iterators�s(�/�c�,��eZdZdZdedef�fd�Z�xZS)�MalformedProblemReportz�Raised when a problem report violates the crash report format.

    This exception might be raised when the keys of the report are not ASCII.
    �message�argsc�.��t�|�d|�d�g|���y)NzMalformed problem report: z$. Is this a proper .crash text file?)�super�__init__)�selfrr	�	__class__s   ��0/usr/lib/python3/dist-packages/problem_report.pyrzMalformedProblemReport.__init__,s+���
���(��	�22�
3�	
��	
�)�__name__�
__module__�__qualname__�__doc__�str�objectr�
__classcell__�rs@rrr&s ����

��
�F�
�
rrc��eZdZdZy)�_SizeLimitExceededz>Raised internally to signal a value that is too big to encode.N)rrrr�rrrr4s��Hrrc�J�eZdZdZdeeddfd�Zdeefd�Zdeefd�Zy)�_EntryParserz�Iterator over entries in RFC822 formatted files.

    This iterator reads ahead one line to determine the boundaries between
    the entries. Each returned entry is a line-based iterator.
    �iterator�returnNc�.�||_d|_d|_y)NT)r�	next_line�
entry_read)r
rs  rrz_EntryParser.__init__?s�� ��
�'+�����rc#��K�|jsJ�|j��d|_|jD]'}|jd�r|���||_d|_yd|_y�w)z$Iterate over all lines of one entry.N� T)r!r�
startswithr")r
�lines  r�entry_iteratorz_EntryParser.entry_iteratorDsa�����~�~��~��n�n������M�M�	�D����t�$��
�!%�������
	����s�A"A$c��|js|j�D]}�|jst|j�|_d|_|j�S)NF)r"r'r!�nextr)r
�_s  r�__next__z_EntryParser.__next__QsQ������(�(�*�
���
��~�~�!�$�-�-�0�D�N�����"�"�$�$r)	rrrrr�bytesrr'r+rrrrr8s>�����%���T��
�����%�(�5�/�%rr�entryrc#�K�|D]}	tj|����y#tj$r}t	t|��d�d}~wwxYw�w�N)�base64�	b64decode�binascii�Errorrr)r-r&�errors   r�_base64_decoderr5[sQ�����?��	?��"�"�4�(�(�?���~�~�	?�(��U��4�$�>��	?�s$�A�#�A�A�A�A�Ar&c���|d}d}|dzr|||dzz
}|dzr||dk7r|dz
}||dk7r�|dz
}|dzr||dk7r|dz
}||dk7r�|dz
}|dzr|dz
}||d	S)
z0Strip gzip header from line and return the rest.��
���r��Nr)r&�flags�offsets   r�_strip_gzip_headerr@cs�����G�E�
�F��q�y��$�v�,��"�"���q�y��6�l�a���a�K�F��6�l�a���!����r�z��6�l�a���a�K�F��6�l�a���!����q�y��!������=�r�
first_linec#��K�|j�}|��t|�}|D]M}|dkDrd��|jd�r|dd��|t|�dz
z
}�6|dd��|t|�dz
z
}�Oy�w)Nr�
r:���r=)�strip�len�endswith)r-rAr&�lengths    r�
_text_decoderrIws���������D�
�J�
��Y�F��$���A�:��K��=�=����q��*���c�$�i�!�m�#�F��q�r�(�N��c�$�i�!�m�#�F�$�s�A3A5c�n�	ddl}|j�S#t$r}td|�d��d�d}~wwxYw)Nrz$Failed to import zstandard library: z#. Please install python3-zstandard.)�	zstandard�ImportError�RuntimeError�ZstdDecompressor)rKr4s  r�_get_zstandard_decompressorrO�sP�����%�%�'�'�����2�5�'�:1�
2�
��	���s��	4�/�4�first_blockc#�K�t�j�}|j|���|D]}|j|����y�wr/)rO�
decompressobj�
decompress)r-rP�decompressor�blocks    r�_zstandard_decoderrV�sH����.�0�>�>�@�L�
�
!�
!�+�
.�.��-���%�%�e�,�,�-�s�AA	c�r�t|�}	|jdd�\}}	|j	d�}|j�d	k(}|rt|�}nt||�}|||fS#t$r!td|j	d���d��d�wxYw#t
$r}tt
|��d�d}~wwxYw)
z�Parse the given entry and return key and value.

    Return the key and a line iterator over the value. Also return a
    boolean if the entry is base64 encoded (i.e. is a binary value).
    �:r:zLine �backslashreplace)�errorsz? does not contain a colon for separating the key from the valueN�ASCIIsbase64)
r)�split�
ValueErrorr�decode�UnicodeDecodeErrorrrEr5rI)r-rA�key_in_bytes�first_line_value�keyr4�base64_encoded�value_iterators        r�_parse_entryre�s����e��J��+5�+;�+;�D�!�+D�(��'�;��!�!�'�*��&�+�+�-��:�N��(��/��&�u�.>�?�����.�.��%��$��J�%�%�-?�%�@�C�&�
'�
��		����;�$�S��Z�0�d�:��;�s"�A&�B�&*B�	B6�B1�1B6c�P�eZdZUdZeed<deddfd�Zd�Zdee	fd�Z
defd�Zy)	�CompressedFilez�Represents a ProblemReport value which points to a compressed file.

    The file is expected to be compressed with gzip or zstandard.
    �filenamerNc�H�||_t|jd�|_y)N�rb)rh�open�_compressed_file)r
rhs  rrzCompressedFile.__init__�s�� ��
� $�T�]�]�D� 9��rc�R�t|d�r|jj�yy)Nrl)�hasattrrl�close�r
s r�__del__zCompressedFile.__del__�s$���4�+�,��!�!�'�'�)�-rc#�RK�	|jjd�}|sy|���#�w)z?Iterate over the compressed content of the file in 1 MB chunks.�N)rl�read)r
rUs  r�iter_compressedzCompressedFile.iter_compressed�s/������)�)�.�.�w�7�E����K�	�s�%'c�b�tj|jtjd��S)z?Check if the compressed file is readable by the effective user.T)�
effective_ids)�os�accessrh�R_OKrps r�is_readablezCompressedFile.is_readable�s���y�y�������t�D�Dr)
rrrrr�__annotations__rrqrr,ru�boolr{rrrrgrg�sD���
�M�:��:��:�
*���%���E�T�Errgc	���eZdZdZ			ddedzdedzdedzddfd�Zdeddfd�Zdefd	�Z	defd
�Z
edeedeefd��Z
defd
�Zdej ddfd�Zdefd�Zdeefd�Zy)�CompressedValuez�Represent a ProblemReport value which is gzip or zstandard compressed.

    By default, compressed values are in gzip format. Earlier versions of
    problem_report used zlib format (without gzip header).
    N�value�name�compressed_valuerc�H�||_||_|r|j|�yy)zAInitialize an empty CompressedValue object with an optional name.N)r�r��	set_value)r
r�r�r�s    rrzCompressedValue.__init__�s'��!1�����	���N�N�5�!�rc���tj�}tj|jd|d��5}|j|�ddd�|j
�|_y#1swY�xYw)zSet uncompressed value.�wbr��mode�fileobj�mtimeN)�io�BytesIO�gzip�GzipFiler��write�getvaluer�)r
r��out�gzs    rr�zCompressedValue.set_value�sS���j�j�l��
�]�]�4�9�9�4��A�
F�	�"��H�H�U�O�	� #������	�	�s�A(�(A1c�H�|j�J�t|j�S)z=Return size of the compressed (but not base64 encoded) value.)r�rFrps r�get_compressed_sizez#CompressedValue.get_compressed_size�s%���$�$�0�0�0��4�(�(�)�)rc�4�|j�dzdzdzS)aReturn the size needed on disk to store the compressed value.

        The compressed value will be base64 encoded when written to disk
        which adds an overhead of 1/3 plus up to 2 bytes of padding. Additional
        spaces and newlines are ignored in this calculation.
        r=r7r9)r�rps r�get_on_disk_sizez CompressedValue.get_on_disk_size�s"���)�)�+�a�/�A�5��:�:rr-c#��K�t|d�}|�y|jt�rt||�Ed{���y|jt�rAtjt
j�}|jt|����n'tj�}|j|���|D]}|j|����|j���y7���w)z5Decode the given compressed value (iterator version).N)r)r%�ZSTANDARD_MAGIC_NUMBERrV�GZIP_HEADER_START�zlibrR�	MAX_WBITSrSr@�flush)r-rUrTs   r�decode_compressed_streamz(CompressedValue.decode_compressed_stream�s������U�D�!���=�����2�3�)�%��7�7�7�����-�.��-�-�t�~�~�o�>�L��)�)�*<�U�*C�D�D� �-�-�/�L��)�)�%�0�0��	1�E��)�)�%�0�0�	1�� � �"�"�
8�s�4C(�C&�B0C(c�\�|j�J�|jjt�r#t�j	|j�S|jjt
�rt
j|j�Stj|j�S)zReturn uncompressed value.)r�r%r�rOrSr�r�r�rps r�	get_valuezCompressedValue.get_values����$�$�0�0�0�� � �+�+�,B�C�.�0�;�;�D�<Q�<Q�R�R�� � �+�+�,=�>��?�?�4�#8�#8�9�9����t�4�4�5�5r�filec�N�|jsJ�|jjt�r:t�}|j	tj|j�|�y|jjt�retjtj|j���5}	|jd�}|sn|j|��&	ddd�y|jtj|j��y#1swY�8xYw)z5Write uncompressed value into given file-like object.N)r�rs)r�r%r�rO�copy_streamr�r�r�r�r�rtr�r�rS)r
r�rTr�rUs     rr�zCompressedValue.writes����$�$�$�$�� � �+�+�,B�C�6�8�L��$�$�R�Z�Z��0E�0E�%F��M��� � �+�+�,=�>����r�z�z�$�2G�2G�'H�I�
�R���G�G�G�,�E� ���J�J�u�%�	�
�

�
�	
�
�
�4�?�?�4�#8�#8�9�:�
�
�s�:)D�D$c���|jsJ�|jjt�r/tt	j
d|jdd�d�St
|j��S)z$Return length of uncompressed value.�<L���Nr)r�r%r��int�struct�unpackrFr�rps r�__len__zCompressedValue.__len__4s`���$�$�$�$�� � �+�+�,=�>��v�}�}�T�4�+@�+@���+E�F�q�I�J�J��4�>�>�#�$�$rc�>�|j�j�S)z.Behaves like splitlines() for a normal string.)r��
splitlinesrps rr�zCompressedValue.splitlines<s���~�~��*�*�,�,r)NNN)rrrrr,rrr�r�r�r��staticmethodrr�r��typing�BinaryIOr�r��listr�rrrrr�s����#��)-�	
"��t�|�
"��D�j�
"� �$�,�	
"�

�
"�/�u�/��/�*�S�*�
;�#�;��#����#�H�U�O�#��#�*	6�5�	6�;�&�/�/�;�d�;�*%��%�-�D��K�-rrc	�F��eZdZdZd,dededzddf�fd�
Zdeeddfd�Z		d-d	eje
jzd
ee
jdzdeedzddfd
�Zd	eje
jzdeeezdeddfd�Zdeefd�Zdedzfd�Zdefd�Zedeezdefd��Zedeezdeezfd��Z	d.deedzdeeeeezezezffd�Zd/d	e
jdeddfd�Zdedeeeeeffd�Z d	e
jdeddfd�Z!ed	e
jdedeeddfd ��Z"dede#eddffd!�Z$d	e
jdeddfd"�Z%d/d#ed$eddfd%�Z&				d0d&�Z'd'ed(ee(zezezezddfd)�Z)deefd*�Z*ed	e+ddfd+��Z,�xZ-S)1�
ProblemReportz1Class to store, load, and handle problem reports.N�problem_type�daterc�t��|�tj�}t�|�
||d��t	�|_y)z�Initialize a fresh problem report.

        problem_type can be 'Crash', 'Packaging', 'KernelCrash' or
        'KernelOops'. date is the desired date/time string; if
        None (default), the current local time is used.
        N)�ProblemType�Date)�time�asctimerr�set�old_keys)r
r�r�rs   �rrzProblemReport.__init__Ds2����<��<�<�>�D�
����t�D�E�#&�%��
r�tagsc��|j�}|j|�}djt|��|d<y)z/Add tags to the report. Duplicates are dropped.� �TagsN)�get_tags�union�join�sorted)r
r��current_tags�new_tagss    r�add_tagszProblemReport.add_tagsRs4���}�}����%�%�d�+���x�x��x� 0�1��V�rr��binary�
compressed�
key_filterc���|j|�|jj�|rt|�}nd}t	|�D]�}t|�\}}}|�||vr�|r�|durd|j|<n�|dk(r*t
|dj|���|j|<nn|jdjtj|���|j|<n-|jdj|��|j|<|���|j|�t|�dk(s��nt|jj��|_
y)a�Initialize problem report from a file-like object.

        If binary is False, binary data is not loaded; the dictionary key is
        created, but its value will be an empty string. If it is True, it is
        transparently uncompressed and available as dictionary byte array
        values. If binary is 'compressed', the compressed value is retained,
        and the dictionary value will be a CompressedValue object. This is
        useful if the compressed value is still useful (to avoid recompression
        if the file needs to be written back).

        file needs to be opened in binary mode.

        If key_filter is given, only those keys will be loaded.

        Files are in RFC822 format, but with case sensitive keys.
        NFr�r)r�r�r)�_assert_bin_mode�data�clearr�rrerr��_try_unicoder��removerF�keysr�)	r
r�r�r��remaining_keysr-rbrrcs	         r�loadzProblemReport.loadXs6��,	
���d�#��	�	����� ��_�N�!�N�!�$�'�	�E�,8��,?�)�C��>��)�c��.G����U�?�%)�D�I�I�c�N��|�+�%4� �3�8�8�H�3E�&�D�I�I�c�N�&*�%6�%6�����!I�!I�(�!S�T�&�D�I�I�c�N�
"&�!2�!2�3�8�8�H�3E�!F��	�	�#���)��%�%�c�*��~�&�!�+��/	�2�D�I�I�N�N�,�-��
r�bin_keys�	directoryc���|j|�t|t�r|g}t|�}i}t	|�D]�}t|�\}}}	||vr�|	||<|j
|�|	s�0tjj||�}
	t|
d�5}tj|�D]}|j|��	ddd���|rtddj|��d���d|j!�vr5|j#�D��cgc]\}}|dus�|��}}}t%|�d���y#1swY�sxYw#t$r}
td|
���|
�d}
~
wwxYwcc}}w)	z�Extract only given binary elements from the problem report.

        Binary elements like kernel crash dumps can be very big. This method
        extracts directly files without loading the report into memory.
        r�Nzunable to open zCannot find z, z
 in reportFz has no binary content)r��
isinstancerr�rrer�rx�pathr�rkrr�r��OSError�KeyError�values�itemsr])r
r�r�r��missing_keys�	b64_blockr-rbrrc�key_pathr�rUr4�item�elementr�s                 r�extract_keyszProblemReport.extract_keys�s��	
���d�#��h��$� �z�H��H�~���	�!�$�'�	G�E�,8��,?�)�C��>��,�&��+�I�c�N�����$�!���w�w�|�|�I�s�3�H�
G��(�D�)�)�S�!0�!I�!I�(�!S�)���	�	�%�(�)�)��	G�$��\�$�)�)�L�*A�)B�*�M�N�N��I�$�$�&�&�/8���/@�U�m�d�G�G�u�DT�T�U�E�U���w�&<�=�>�>�'�)�)���
G����z�:�;��F��
G��Vs<�E�,D9�E�E%�#E%�9E	�>E�	E"�E�E"c�X�d|vr
t�St|djd��S)zReturn the set of tags.r�r�)r�r\rps rr�zProblemReport.get_tags�s+������5�L��4��<�%�%�c�*�+�+rc�.�tjtj�}		tjtjd�t	tjtj|d���tjtj|�S#t$r'Ytjtj|�ywxYw#tjtj|�wxYw#tj$rYywxYw)zhGet timestamp (seconds since epoch) from Date field.

        Return None if it is not present.
        �Cr�N)
�locale�	getlocale�LC_TIME�	setlocaler�r��mktime�strptimer�r3)r
�
orig_ctimes  r�
get_timestampzProblemReport.get_timestamp�s����%�%�f�n�n�5�
�		�
=�� � �����5��4�;�;�t�}�}�T�&�\�'B�C�D�� � �����<���
��� � �����<�
��� � �����<���|�|�	��	�sB�AB"�=$C>�"	C�+C�,$C>�C�C�&C;�;C>�>D�Dc�&�d|j�vS)z~Check if the report has any keys which were not loaded.

        This could happen when using binary=False in load().
        N)r�rps r�has_removed_fieldsz ProblemReport.has_removed_fields�s��
�t�{�{�}�$�$r�stringc�t�t|t�r(|D]#}|dks�	t|�j�r�#yy)z0Check if the given strings contains binary data.� TF)r�r,�chr�isspace)r��cs  r�	is_binaryzProblemReport.is_binary�s9���f�e�$��
 ���r�6�#�a�&�.�.�"2��
 �rr�c��t|t�r#|j|�s	|jd�S|S#t$r|cYSwxYw)z*Try to convert bytearray value to Unicode.�UTF-8)r�r,r�r^r_)�clsr�s  rr�zProblemReport._try_unicode�sJ���e�U�#�C�M�M�%�,@�
��|�|�G�,�,����&�
���
�s�6�A�Ar�c#�RK�|r/tt|j��t|�z�}nt|j��}dD]*}||vs�|j|�|j	d|��,|D]%}|jd�r�||}|��|||f���'y�w)aIterate over all non-internal items sorted.

        The most interesting fields will be returned first. The remaining
        items will be returned in alphabetical order. Keys starting with
        an underscore are considered internal and are skipped. Also values
        that are None will be skipped.

        If keys is provided, only those keys will be iterated over.
        )�	Traceback�
StackTrace�Titler��Package�ExecutablePathrr*N)r�r�r�r��insertr%)r
r�rbr�s    r�sorted_itemszProblemReport.sorted_items�s�������#�d�i�i�k�*�S��Y�6�7�D��$�)�)�+�&�D�
�
	$�C��d�{����C� ����A�s�#�
	$��	!�C��~�~�c�"����I�E��}���t�C�y�.� �	!�s
�AB'�AB'�only_newc��|j|�|j|�\}}|D]}|j||��|D]}|j||��y)a�Write information into the given file-like object.

        If only_new is True, only keys which have been added since the last
        load() are written (i. e. those returned by new_keys()).

        If a value is a string, it is written directly. Otherwise it must be a
        tuple of the form (file, encode=True, limit=None, fail_on_empty=False).
        The first argument can be a file name or a file-like object,
        which will be read and its content will become the value of this key.
        'encode' specifies whether the contents will be
        gzip compressed and base64-encoded (this defaults to True). If limit is
        set to a positive integer, the file is not attached if it's larger
        than the given limit, and the entire key will be removed. If
        fail_on_empty is True, reading zero bytes will cause an OSError.

        file needs to be opened in binary mode.

        Files are written in RFC822 format.
        N)r��_get_sorted_keys�_write_ascii_item�)_write_binary_item_compressed_and_encoded)r
r�r�asckeys�binkeys�ks      rr�zProblemReport.writesi��(	
���d�#��0�0��:�����	,�A��"�"�4��+�	,��	D�A��:�:�4��C�	Drc�8�g}g}|jj�D]�}|r||jvr�|j|}t|d�r5|j	|�r|j|��R|j|��dt
|ttf�s%t|�dk\r|ds|j|���|j|���|j�d|vr#|jd�|jdd�|j�||fS)zySort keys into ASCII non-ASCII/binary attachment ones, so that
        the base64 ones appear last in the report
        �findr=r:r�r)
r�r�r�rnr��appendr�rgrrF�sortr�r�)r
rrrr�vs      rrzProblemReport._get_sorted_keys/s������������!�	"�A��A����.���	�	�!��A��q�&�!��>�>�!�$��N�N�1�%��N�N�1�%��q�>�?�"C�D���F�a�K��!�����q�!����q�!�#	"�&	�����G�#��N�N�=�)��N�N�1�m�,��������rrbc��|j|}t|d�s�t|�dk\r|d�|d}nd}t|�dk\xr|d}t|dd�r|dj�}n(t	|dd�5}|j�}ddd�|rt|�dk(rtd|z��|�t|�|kDr|j|=yt
|t�r|jd	�}|j|jd
��d|vr3|jd�|j|jdd
��n"|jd�|j|�|jd�y#1swY��xYw)Nr	r7r=r9rrtrj�did not get any data for field r�r[rCs:
 �
 s: )r�rnrFrtrkr�r�r�encoder��replace)r
r�rbr�limit�
fail_on_empty�fs       rrzProblemReport._write_ascii_itemOsX���I�I�c�N���q�&�!��1�v��{�q��t�/��!�������F�a�K�0�A�a�D�M��q��t�V�$��a�D�I�I�K���!�A�$��%�!������A�!���Q��1���?�#�E�F�F�� �S��V�e�^��I�I�c�N���a�������!�A��
�
�3�:�:�g�&�'��A�:��J�J�w���J�J�q�y�y���/�0��J�J�u���J�J�q�M��
�
�5��-!�!�s�>E?�?F�chunksc�f�|j�}	|j|�d�jd��|D]7}|jd�|jtj|���9|jd�y#t
$r$|j
|�|j|��wxYw)zCWrite out binary chunks as a base64-encoded RFC822 multiline field.z: base64r[rrCN)�tellr�rr0�	b64encode�	Exception�seek�truncate)r�rbr�reset_position�chunks     r�!_write_binary_item_base64_encodedz/ProblemReport._write_binary_item_base64_encodedvs���
�����		��J�J�#��h�'�.�.�w�7�8��
4���
�
�6�"��
�
�6�+�+�E�2�3�
4�
�J�J�u����	��I�I�n�%��M�M�.�)��	�s�A0B�-B0c	#�K�|j|}t|t�r|j�Ed{���yt|t�r|j
�J�|j
��ytdz|jd�zdz}|��tjd�}tjdtjtjtjd�}d}t|d�r>|t|�z
}tj||�}|j!|�}|�r	|���nd}t|�d	k\r
|d
�|d
}t|dd�r|d}	nt#|dd�}		|	j%d
�}
|t|
�z
}tj|
|�}|�||kDr|j|=t'd��|
r|j!|
�}|r|��nn�pt|dd�s|	j)�t|�dk\r'|d	r"|dk(rt+d|�dt-|d�����|j/�}
|
t1j2d|dz�z
}
|
t1j2d|dz�z
}
|
��y7��J�w)aGenerator taking the value out of self.data and outputing it
        in compressed chunks of binary data.

        Throws a _SizeLimitExceeded exception if the value exceeds its specified
        size limit, in which case it will also remove the value from self.data entirely.
        Ns�r��r�rr	r7r=rtrjrsz,Binary data bigger than the limit ({limit}b)r9rz from r�l��)r�r�rgrurr�r�rr��crc32�compressobj�DEFLATEDr��
DEF_MEM_LEVELrnrF�compressrkrtrror�rr�r��pack)r
rbr��gzip_header�crc�bc�size�outblockrrrUs           r�_generate_compressed_chunksz)ProblemReport._generate_compressed_chunks�su�����	�	�#����e�^�,��,�,�.�.�.���e�_�-��)�)�5�5�5��(�(�(���-�
.��j�j��!�
"��
�	����j�j��o��
�
�
�a���������AS�AS�UV�
W�����5�&�!��C��J��D��*�*�U�C�(�C��{�{�5�)�H�����E��5�z�Q��5��8�#7��a����u�Q�x��(��!�H����q��4�(������w�����E�
�"���j�j���,���$��e�|� �I�I�c�N�0�J����!�{�{�5�1�H��&���� �5��8�V�,����	��5�z�Q��5��8��1�9�!�9�#��f�S��q��]�O�T���
���
��
����T�3��#3�4�4��
����T�4�*�#4�5�5����E
/�s�3J�I?�I
Jc�h�	|j|||j|��y#t$rYywxYw)z?Write the binary keys with gzip compression and base64 encodingN)rr-r)r
r�rbs   rrz7ProblemReport._write_binary_item_compressed_and_encoded�s;��	��2�2��c�4�;�;�C�@�
��"�	��	�s�"%�	1�1�
reportfile�
keep_timesc��tj|�}	t|d�5}tj|d�|j	|�ddd�|r,tj
||j|jf�tj||j�y#1swY�XxYw#|r,tj
||j|jf�tj||j�wxYw)aAdd this report's data to an already existing report file.

        The file will be temporarily chmod'ed to 000 to prevent frontends
        from picking up a hal-updated report file. If keep_times
        is True, then the file's atime and mtime restored after updating.
        �abrN)	rx�statrk�chmodr��utime�st_atime�st_mtime�st_mode)r
r/r0�st�reports     r�add_to_existingzProblemReport.add_to_existing�s����W�W�Z�
 ��	-��j�$�'�
#�6�����Q�'��
�
�6�"�
#������b�k�k�2�;�;�%?�@��H�H�Z����,�

#�
#�������b�k�k�2�;�;�%?�@��H�H�Z����,�s#�B.�(B"�B.�"B+�'B.�.AC>c�~	�|j|�t|jj��}d}g}d|vr#|j	d�|jdd�|r6d}	|D]/}
|
|vs�|j	|
�|j|	|
�|	dz
}	�1|D�]}|r||vr�|j|}d}
t
|t�r|j}
�nt|d�s�d}
t|dd�r|d}nt|dd�}|jd	�r|j�}
notj�}tj |d
|d��5}	|jd�}|r|j#|�nn�'	ddd�|j%�}
|j'�n;|j)|�r*|jd	�r|}
nt||�j}
|
r�t*j,j.j1d
d�}|jd	�r|j3dd|��n|j3dd|d	z��|j5|
�t*j6j9|�|j;|����t=|�}t
|t>�r|jAdd�}t
|tB�sJ�t=|jE��}|dkr%|dk(r |jG�}||dz|zdzz
}��w|dkrK||krF||dzz
}|jd�s|dz
}||jI�jKdd�dzz
}���t*j,jLjO|d��}|j3dd|dz��|j;|���t*j,jLjO|d��}|j3dd�|jd|�t*j,jPjS�}|r*|jU�D]\}}|j3||��|D]}|jW|��|j#|jY�j[d��|j#d�y#1swY��5xYw)a�Write MIME/Multipart RFC 2822 formatted data into file.

        file must be a file-like object, not a path.  It needs to be opened in
        binary mode.

        If a value is a string or a CompressedValue, it is written directly.
        Otherwise it must be a tuple containing the source file and an optional
        boolean value (in that order); the first argument can be a file name or
        a file-like object, which will be read and its content will become the
        value of this key.  The file will be gzip compressed, unless the key
        already ends in .gz.

        attach_treshold specifies the maximum number of lines for a value to be
        included into the first inline text part. All bigger values (as well as
        all non-ASCII ones) will become an attachment, as well as text
        values bigger than 1 kB.

        Extra MIME preamble headers can be specified, too, as a dictionary.

        skip_keys is a set/list specifying keys which are filtered out and not
        written to the destination file.

        priority_fields is a set/list specifying the order in which keys should
        appear in the destination file.
        �r�rr:Nr	rtrjz.gzr�r�rs�applicationzx-gzipzContent-Disposition�
attachment)rhr�ri�z: �
z:
 z
 )�_charsetz.txt�inlinerC).r�r�r�r�r�r�r�rr�rnrkrGrtr�r�r�r�r�r�ror��email�mime�base�MIMEBase�
add_header�set_payload�encoders�
encode_base64r
rFr,r^rr��rstriprEr�text�MIMEText�	multipart�
MIMEMultipartr��attach�	as_stringr)r
r��attach_treshold�
extra_headers�	skip_keys�priority_fieldsr�rL�attachments�counter�priority_fieldrr�attach_valuerr�r�rU�attr+�lines�msg�as                       r�
write_mimezProblemReport.write_mime�s=��F	
���d�#��d�i�i�n�n�&�'�������D� ��K�K�
�&��K�K��=�)���G�"1�
!��!�T�)��K�K��/��K�K���8��q�L�G�	
!��M	,�A��Q�)�^���	�	�!��A��L��!�_�-� �1�1���Q��'�!���1�Q�4��(��!��A��Q�q�T�4�(�A��:�:�e�$�#$�6�6�8�L��*�*�,�C����q�t�S��J�&�b�"�$%�F�F�7�O�E�$� "����� %�#�
!&�
&�$'�<�<�>�L����	�����"��:�:�e�$�#$�L�#2�1�a�#8�#I�#I�L���j�j�o�o�.�.�}�h�G���:�:�e�$��N�N�#8�,�QR�N�S��N�N�-�|�a�%�i�#������-����,�,�S�1��"�"�3�'��1�v���a��'�����)�4�A�!�!�S�)�)�)��A�L�L�N�+���4�<�E�Q�J����
�A��A��H�q�L�4�/�/�D��T�\�e��&>��A��J�&�D��:�:�d�+��T�	���A�G�G�I�-�-�d�E�:�T�A�A�D� �*�*�/�/�2�2�1�w�2�G�C��N�N�-�|�a�&�j�#�� �&�&�s�+�[M	,�`�j�j�o�o�&�&�t�g�&�>�����,�h�7����1�c�"��j�j�"�"�0�0�2���%�+�+�-�
%���1����q�!�$�
%��	�A��J�J�q�M�	�	
�
�
�3�=�=�?�)�)�'�2�3��
�
�5��K&�&�s�)R2�2R<	rrc��t|d�sJ�|jdd�jdd�jdd�j�std|�d���t	|t
tf�szt|d�snt	|t�rOt|�dk(s#t|�d	k\r3t|�d
kr%|ddvrt|dd�st|dd
�std|�d���|jj||�S)N�isalnum�.r=�-r*zkey 'zT' contains invalid characters (only numbers, letters, '.', '_', and '-' are allowed)r:r=r9>FTrrtzvalue for key z7 must be a string, CompressedValue, or a file reference)rnrr`r]r�rgr�tuplerF�	TypeErrorr��__setitem__)r
rrs   rrezProblemReport.__setitem__�s	���q�)�$�$�$��y�y��b�!�)�)�#�r�2�:�:�3��C�K�K�M����s�J�K��
�
�q�>�?�;�<��q�)�$��1�e�$���F�a�K��A��!���A��!���!��
�8M��Q�q�T�9�-���1��v�1F�� ���$'�(��
�
�y�y�$�$�Q��*�*rc�b�t|jj��|jz
S)z�Return newly added keys.

        Return the set of keys which have been added to the report since it
        was constructed or loaded.
        )r�r�r�r�rps r�new_keyszProblemReport.new_keys�s#���4�9�9�>�>�#�$�t�}�}�4�4rc�*�t|d�rJd��y)z0Assert that given file object is in binary mode.�encodingz"file stream must be in binary modeN)rn)r�s rr�zProblemReport._assert_bin_mode�s���4��,�R�.R�R�,�,r)�CrashN)TNr/)F)�NNN).rrrrrrrr�r�r�r�r�r}�Literalr�r�r�r�r�r�r�r�r,r��classmethodr�rrcrr�r�r�rrrrr-rr;r^rgrergrr�rrs@rr�r�As���;�(�S�(�#��*�(�PT�(�2�X�c�]�2�t�2�7;�+/�	6.��m�m�f�o�o�-�6.��v�~�~�l�3�3�6.��S�M�D�(�	6.�

�6.�p(?��m�m�f�o�o�-�(?��3�-�#�%�(?��	(?�

�(?�T,�#�c�(�,��s�T�z��$%�D�%���%�#�+��$����������������,0�#!��S�M�D�(�#!�	�%��e�o�5��;�e�C�D�E�	F�#!�JD�&�/�/�D�T�D�d�D�< �� �%��S�	�4��9�8L�2M� �@%�f�o�o�%�C�%�D�%�N���o�o��$'��19�%���	
���� M�s�M�y���d�AR�7S�M�^
��O�O�
�*-�
�	
�
�-�#�-�4�-�D�-�(����
R�h+��+���/�/�A�C�G�%�O�+�	
�+�<5�#�c�(�5��S�v�S�$�S��Srr�),rr0r2�collections�dataclasses�email.encodersrC�email.mime.base�email.mime.multipart�email.mime.textr�r�r�rxr�r�r�r��collections.abcrrrr�r�r]rrMrrr,r5r@rIrOrVrcrr}re�	dataclassrgr�UserDictr�rrr�<module>rwsX��.����������	�
�	�
��
��9�9�$��,��
�Z�
�I��I� %�8� %�F?�8�E�?�?�x���?��U��u��($��%��$�e�$����$�	(�-�h�u�o�-�E�-�h�u�o�-�/����/�E�#�x����2L�,M�/�<
���E�E��E�<h-�h-�Vo	S�K�(�(�o	Sr
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!