Current File : //proc/self/root/lib/python3/dist-packages/twisted/web/__pycache__/_flatten.cpython-312.pyc
�

Ϫ�f�F���dZddlmZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZmZmZmZmZmZmZmZmZmZmZmZdd	lmZmZdd
lmZddlm Z ddl!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'dd
l(m)Z)m*Z*m+Z+ddl,m-Z-m.Z.ed�Z/eZ0	ee1e2e&e"e$e%ee0dfee0ee0ddfe#ee0eee0e3e0fe-f
Z4	dZ5dd�Z6dd�Z7				dd�Z8dd�Z9dd�Z:	d 							d!d�Z;d"d�Z<														d#d�Z=								d$d�Z>								d%d�Z?d&d�Z@y)'zu
Context-free flattener/serializer for rendering Python objects, possibly
complex or arbitrarily nested, as strings.
�)�annotations)�iscoroutine)�BytesIO)�exc_info)�
extract_tb)�
GeneratorType)�Any�Callable�	Coroutine�	Generator�List�Mapping�Optional�Sequence�Tuple�TypeVar�Union�cast)�Deferred�ensureDeferred)�nativeString)�Failure)�CDATA�CharRef�Comment�Tag�slot�voidElements)�FlattenerError�UnfilledSlot�UnsupportedType)�IRenderable�IRequest�T.Nic��t|t�r|jd�}|jdd�jdd�jdd�}|S)a�
    Escape some character or UTF-8 byte data for inclusion in an HTML or XML
    document, by replacing metacharacters (C{&<>}) with their entity
    equivalents (C{&amp;&lt;&gt;}).

    This is used as an input to L{_flattenElement}'s C{dataEscaper} parameter.

    @param data: The string to escape.

    @return: The quoted form of C{data}.  If C{data} is L{str}, return a utf-8
        encoded string.
    �utf-8�&s&amp;�<s&lt;�>s&gt;��
isinstance�str�encode�replace��datas �6/usr/lib/python3/dist-packages/twisted/web/_flatten.py�escapeForContentr2GsK���$����{�{�7�#���<�<��h�'�/�/��g�>�F�F�t�W�U�D��K�c�H�t|t�r|jd�S|S)aG
    Escape some character or UTF-8 byte data for inclusion in the top level of
    an attribute.  L{attributeEscapingDoneOutside} actually passes the data
    through unchanged, because L{writeWithAttributeEscaping} handles the
    quoting of the text within attributes outside the generator returned by
    L{_flattenElement}; this is used as the C{dataEscaper} argument to that
    L{_flattenElement} call so that that generator does not redundantly escape
    its text output.

    @param data: The string to escape.

    @return: The string, unchanged, except for encoding.
    r&)r+r,r-r/s r1�attributeEscapingDoneOutsider5Zs"���$����{�{�7�#�#��Kr3c���d�fd�}|S)aU
    Decorate a C{write} callable so that all output written is properly quoted
    for inclusion within an XML attribute value.

    If a L{Tag <twisted.web.template.Tag>} C{x} is flattened within the context
    of the contents of another L{Tag <twisted.web.template.Tag>} C{y}, the
    metacharacters (C{<>&"}) delimiting C{x} should be passed through
    unchanged, but the textual content of C{x} should still be quoted, as
    usual.  For example: C{<y><x>&amp;</x></y>}.  That is the default behavior
    of L{_flattenElement} when L{escapeForContent} is passed as the
    C{dataEscaper}.

    However, when a L{Tag <twisted.web.template.Tag>} C{x} is flattened within
    the context of an I{attribute} of another L{Tag <twisted.web.template.Tag>}
    C{y}, then the metacharacters delimiting C{x} should be quoted so that it
    can be parsed from the attribute's value.  In the DOM itself, this is not a
    valid thing to do, but given that renderers and slots may be freely moved
    around in a L{twisted.web.template} template, it is a condition which may
    arise in a document and must be handled in a way which produces valid
    output.  So, for example, you should be able to get C{<y attr="&lt;x /&gt;"
    />}.  This should also be true for other XML/HTML meta-constructs such as
    comments and CDATA, so if you were to serialize a L{comment
    <twisted.web.template.Comment>} in an attribute you should get C{<y
    attr="&lt;-- comment --&gt;" />}.  Therefore in order to capture these
    meta-characters, flattening is done with C{write} callable that is wrapped
    with L{writeWithAttributeEscaping}.

    The final case, and hopefully the much more common one as compared to
    serializing L{Tag <twisted.web.template.Tag>} and arbitrary L{IRenderable}
    objects within an attribute, is to serialize a simple string, and those
    should be passed through for L{writeWithAttributeEscaping} to quote
    without applying a second, redundant level of quoting.

    @param write: A callable which will be invoked with the escaped L{bytes}.

    @return: A callable that writes data with escaping.
    c�H���t|�jdd��y)N�"s&quot;)r2r.)r0�writes �r1�_writez*writeWithAttributeEscaping.<locals>._write�s���
��t�$�,�,�T�9�=�>r3)r0�bytes�return�None�)r9r:s` r1�writeWithAttributeEscapingr?ms���R?��Mr3c�h�t|t�r|jd�}|jdd�S)z�
    Escape CDATA for inclusion in a document.

    @param data: The string to escape.

    @return: The quoted form of C{data}. If C{data} is unicode, return a utf-8
        encoded string.
    r&�]]>s]]]]><![CDATA[>r*r/s r1�escapedCDATArB�s.���$����{�{�7�#���<�<�� 2�3�3r3c��t|t�r|jd�}|jdd�}|r
|dddk(r|dz
}|S)a�
    Within comments the sequence C{-->} can be mistaken as the end of the comment.
    To ensure consistent parsing and valid output the sequence is replaced with C{--&gt;}.
    Furthermore, whitespace is added when a comment ends in a dash. This is done to break
    the connection of the ending C{-} with the closing C{-->}.

    @param data: The string to escape.

    @return: The quoted form of C{data}. If C{data} is unicode, return a utf-8
        encoded string.
    r&�-->s--&gt;���N�-� r*r/s r1�escapedCommentrH�sJ���$����{�{�7�#���<�<��	�*�D���R�S�	�T�!������Kr3c�\�t|�D]}|��||vs�||cS|�|St|��)zK
    Find the value of the named slot in the given stack of slot data.
    )�reversedr )�name�slotData�default�	slotFrames    r1�
_getSlotValuerO�sG���h�'�!�	�� �T�Y�%6��T�?�"�!����N��4� � r3c�b���t�fd���d�fd�}d�fd�}�j||��S)z�
    Create a new L{Deferred} based on C{d} that will fire and fail with C{d}'s
    result or error, but will not modify C{d}'s callback type.
    c�$���j�S�N)�cancel)�_�ds �r1�<lambda>z_fork.<locals>.<lambda>�s
�������r3c�*���j|�|SrR)�callback)�result�d2s �r1rXz_fork.<locals>.callback�s���
���F���
r3c�*���j|�|SrR)�errback)�failurerZs �r1r\z_fork.<locals>.errback�s���
�
�
�7���r3)rYr$r<r$)r]rr<r)r�addCallbacks)rUrXr\rZs`  @r1�_forkr_�s/���
�3�4�B����N�N�8�W�%�
�Ir3c
#�����K�|||f									d��fd�
�d�fd�}t|ttf�r|||��yt|t�r,t	|j
�|j�}�|���yt|t�r,|d�|t|j��|d�yt|t�r,|d�|t|j��|d�yt|t��rÉj|j�|j}|�^|�t!d|�d	���|j#d
�}	d|	_|j%|�}
|
�|	�}�|����j'�y|j(s�|j*���y|d�t|j(t�r|j(j-d�}n|j(}||�|j.j1�D]V\}
}t|
t�r|
j-d�}
|d
|
zdz��|t2t5|�����|d��X|j*st7|�t8vr0|d��|j*t:���|d|zdz�y|d�yt|t<t>t@f�r|D]}�|����yt|tB�r(d|jDfz}||j-d��yt|tF�r|tI|����ytK|�rE|tGjLtOtPtFtRtTtRf|�����ytWjX|�r|j��}�||����yt[|���w)at
    Make C{root} slightly more flat by yielding all its immediate contents as
    strings, deferreds or generators that are recursive calls to itself.

    @param request: A request object which will be passed to
        L{IRenderable.render}.

    @param root: An object to be made flatter.  This may be of type C{unicode},
        L{str}, L{slot}, L{Tag <twisted.web.template.Tag>}, L{tuple}, L{list},
        L{types.GeneratorType}, L{Deferred}, or an object that implements
        L{IRenderable}.

    @param write: A callable which will be invoked with each L{bytes} produced
        by flattening C{root}.

    @param slotData: A L{list} of L{dict} mapping L{str} slot names to data
        with which those slots will be replaced.

    @param renderFactory: If not L{None}, an object that provides
        L{IRenderable}.

    @param dataEscaper: A 1-argument callable which takes L{bytes} or
        L{unicode} and returns L{bytes}, quoted as appropriate for the
        rendering context.  This is really only one of two values:
        L{attributeEscapingDoneOutside} or L{escapeForContent}, depending on
        whether the rendering context is within an attribute or not.  See the
        explanation in L{writeWithAttributeEscaping}.

    @return: An iterator that eventually writes L{bytes} to C{write}.
        It can yield other iterators or L{Deferred}s; if it yields another
        iterator, the caller will iterate it; if it yields a L{Deferred},
        the result of that L{Deferred} will be another generator, in which
        case it is iterated.  See L{_flattenTree} for the trampoline that
        consumes said values.
    c�$��t�||�||�SrR)�_flattenElement)�newRoot�dataEscaper�
renderFactoryr9�requestrLs    ��r1�	keepGoingz"_flattenElement.<locals>.keepGoings�����W�e�X�}�k�
�	
r3c�&��|j��SrR)�addCallback)rYrgs �r1�keepGoingAsyncz'_flattenElement.<locals>.keepGoingAsyncs����!�!�)�,�,r3s	<![CDATA[rAs<!--rDNz$Tag wants to be rendered by method "z)" but is not contained in any IRenderableFr(�asciirGs=")r9r8r)s</s />z&#%d;)re)
rc�Flattenablerd�$Callable[[Union[bytes, str]], bytes]re�Optional[IRenderable]r9�Callable[[bytes], object]r<z@Generator[Union[Flattenable, Deferred[Flattenable]], None, None])rY�Deferred[Flattenable]r<rp).r+r;r,rrOrKrMrrBr0rrHr�appendrL�render�
ValueError�clone�lookupRenderMethod�pop�tagName�childrenr-�
attributes�itemsr5r?rrr2�tuple�listrr�ordinalrr_r�
fromCoroutinerrrl�objectr"�
providedByr!)rf�rootr9rLrerdrj�	slotValue�rendererName�	rootClone�renderMethodrYrw�k�v�element�escapedrgs`  `             @r1rbrb�sn�����b=H�/<�+0�	
��
�9�
�-�
�)�	
�

J�
�-��$����%�
�k�$�� �	�D�$�	�!�$�)�)�X�t�|�|�D�	��	�"�"�	�D�%�	 �
�l��
�l�4�9�9�%�&�
�f�
�	�D�'�	"�
�g��
�n�T�Y�Y�'�(�
�f�
�	�D�#�	�����
�
�&��{�{���#��$� �:�<�.�I>�?����
�
�5�)�I�#�I��(�;�;�L�I�L�!�'�9�5�F��F�#�#��L�L�N���|�|��D�M�M�*�*��
�d���d�l�l�C�(��l�l�)�)�'�2�G��l�l�G�
�g���O�O�)�)�+�		�D�A�q��!�S�!��H�H�W�%���$��(�U�"�#���/�7Q�RW�7X��
�
�$�K�		��=�=�L��1��E��$�K��D�M�M�+;�<�<��%�'�/�D�(�)��&�M�	�D�5�$�
�6�	7��	%�G��G�$�$�	%�	�D�'�	"��T�\�\�O�+��
�g�n�n�W�%�&�	�D�(�	#��U�4�[�)�)�	�T�	���"�"��Y�x��4�f�k�I�J�D�Q�
�
�	
�

�	�	��	%����W�%����d�3�3��d�#�#�s�OO$c	��x��
��K�g�
d�d�
��fd�}d	�
��fd��t|||gdt�g}|rS	|dj}t|d�}t	|t
�r��|�d{���}|j
|�|r�S��y7� #t$r|j�Y�(t$r�}|j�g}|D]*}	|j
|	jjd��,|j
jd�t||tt�d���d}~wwxYw�w)
a�
    Make C{root} into an iterable of L{bytes} and L{Deferred} by doing a depth
    first traversal of the tree.

    @param request: A request object which will be passed to
        L{IRenderable.render}.

    @param root: An object to be made flatter.  This may be of type C{unicode},
        L{bytes}, L{slot}, L{Tag <twisted.web.template.Tag>}, L{tuple},
        L{list}, L{types.GeneratorType}, L{Deferred}, or something providing
        L{IRenderable}.

    @param write: A callable which will be invoked with each L{bytes} produced
        by flattening C{root}.

    @return: A C{Deferred}-returning coroutine that resolves to C{None}.
    rc�f���j|��t|�z
��tk\r��yyrR)rq�len�BUFFER_SIZE)�bs�buf�bufSize�flushBuffers ���r1�
bufferedWritez#_flattenTree.<locals>.bufferedWrite�s.����
�
�2���3�r�7����k�!��M�"r3c�N���dkDr�dj����dd�=d�yy)Nrr3)�join)r�r�r9s���r1r�z!_flattenTree.<locals>.flushBuffer�s+����Q�;��#�(�(�3�-� ��A���G�r3NrEr��)r�r;r<r=)r<r=)rbr2�gi_frame�nextr+rrq�
StopIterationrv�	Exception�f_localsrrr)
rfr�r9r��stack�framer��e�roots�	generatorr�r�r�s
  `       @@@r1�_flattenTreer�ss#�����(
�C��G���	���}�b�$�@P�Q�-�E��	"��"�I�&�&�E��5��9�o�G��'�8�,��
� '�-��
�L�L��!�'�,�M�(���	��I�I�K��	F��I�I�K��E�"�
B�	����Y�/�/�8�8��@�A�
B��L�L�����/�0� ��E�:�h�j��m�+D�E�E��
	F�sM�,D:�9B�,B
�-B�1D:�D:�
B�D7�(D:�*D7�2BD2�2D7�7D:c�.�tt|||��S)a
    Incrementally write out a string representation of C{root} using C{write}.

    In order to create a string representation, C{root} will be decomposed into
    simpler objects which will themselves be decomposed and so on until strings
    or objects which can easily be converted to strings are encountered.

    @param request: A request object which will be passed to the C{render}
        method of any L{IRenderable} provider which is encountered.

    @param root: An object to be made flatter.  This may be of type L{str},
        L{bytes}, L{slot}, L{Tag <twisted.web.template.Tag>}, L{tuple},
        L{list}, L{types.GeneratorType}, L{Deferred}, or something that
        provides L{IRenderable}.

    @param write: A callable which will be invoked with each L{bytes} produced
        by flattening C{root}.

    @return: A L{Deferred} which will be called back with C{None} when C{root}
        has been completely flattened into C{write} or which will be errbacked
        if an unexpected exception occurs.
    )rr�)rfr�r9s   r1�flattenr��s��2�,�w��e�<�=�=r3c���t��t||�j�}|j�fd��t	t
t|�S)a�
    Collate a string representation of C{root} into a single string.

    This is basically gluing L{flatten} to an L{io.BytesIO} and returning
    the results. See L{flatten} for the exact meanings of C{request} and
    C{root}.

    @return: A L{Deferred} which will be called back with a single UTF-8 encoded
        string as its result when C{root} has been completely flattened or which
        will be errbacked if an unexpected exception occurs.
    c�$���j�SrR)�getvalue)rT�ios �r1rVzflattenString.<locals>.<lambda>�s
���B�K�K�M�r3)rr�r9rirrr;)rfr�rUr�s   @r1�
flattenStringr��s<���
��B����r�x�x�(�A��M�M�)�*������#�#r3)r0zUnion[bytes, str]r<r;)r9ror<zCallable[[bytes], None]rR)rKr,rLz-Sequence[Optional[Mapping[str, Flattenable]]]rMzOptional[Flattenable]r<rl)rU�Deferred[T]r<r�)rf�Optional[IRequest]r�rlr9rorLz)List[Optional[Mapping[str, Flattenable]]]rernrdrmr<zMGenerator[Union[Generator[Any, Any, Any], Deferred[Flattenable]], None, None])rfr�r�rlr9ror<r=)rfr�r�rlr9ror<zDeferred[None])rfr�r�rlr<zDeferred[bytes])A�__doc__�
__future__r�inspectrr�r�sysr�	tracebackr�typesr�typingr	r
rrr
rrrrrrr�twisted.internet.deferrr�twisted.python.compatr�twisted.python.failurer�twisted.web._stanrrrrrr�twisted.web.errorrr r!�twisted.web.iwebr"r#r$�FlattenableRecursiver;r,rrlr�r2r5r?rBrHrOr_rbr�r�r�r>r3r1�<module>r�s���
�#���� ��
�
�
�
�<�.�*�N�N�K�K�2��C�L������	���	���	�
��
#�$��	��
�"�D�$�.�/���
!�"�
�h�+�,�f�6J�J�K���������&�&,�$�,��,�^4��.&*�!�

�!�;�!�#�!��	!�"�&N$�
�N$�
�N$�%�N$�8�	N$�
)�N$�6�
N$�S�N$�bF�
�F�'2�F�;T�F�	�F�R>�
�>�'2�>�;T�>��>�8$r3
¿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!