Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/tornado/__pycache__/escape.cpython-39.pyc
Ðазад
a _�h5 � @ s d Z ddlZddlZddlZddlZddlmZ ddl Z ddl m Z mZmZm Z mZmZ e�d�Zdddd d d�Ze eef ed�d d�Ze eef ed�dd�Zeed�dd�Ze eef ed�dd�Zeed�dd�Zd?e eef eed�dd�Ze jd@e eef deed�dd��Ze jdAe eef eeed�dd��ZdBe eef ee ee eef d�d d�ZdCeeee eee f d"�d#d$�Zeed�fZ e jeed�d%d&��Z!e jeed�d'd&��Z!e jddd�d(d&��Z!e deef ee d�d)d&�Z!eed�fZ"e jeed�d*d+��Z#e jeed�d,d+��Z#e jddd�d-d+��Z#e deef ee d�d.d+�Z#e#Z$e#Z%e#Z&eed/�d0d1�Z'e�e#d2��Z(d!d3d!d4d5gfe eef ee eeegef f eee ed6�d7d8�Z)e j*ed9�d:d;�Z+e eef d<�d=d>�Z,e,� Z-dS )Dz�Escaping/unescaping methods for HTML, JSON, URLs, and others. Also includes a few other miscellaneous string manipulation functions that have crept in over time. � N)�unicode_type)�Union�Any�Optional�Dict�List�Callablez[&<>"']z&z<z>z"z')�&�<�>�"�')�value�returnc C s t �dd� t| ��S )a0 Escapes a string so it is valid within HTML or XML. Escapes the characters ``<``, ``>``, ``"``, ``'``, and ``&``. When used in attribute values the escaped strings must be enclosed in quotes. .. versionchanged:: 3.2 Added the single quote to the list of escaped characters. c S s t | �d� S )Nr )�_XHTML_ESCAPE_DICT�group)�match� r �~/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/tornado/escape.py�<lambda>7 � zxhtml_escape.<locals>.<lambda>)�_XHTML_ESCAPE_RE�sub� to_basestring�r r r r �xhtml_escape+ s �r c C s t �dtt| ��S )z!Un-escapes an XML-escaped string.z&(#?)(\w+?);)�rer �_convert_entity�_unicoder r r r �xhtml_unescape; s r c C s t �| ��dd�S )z%JSON-encodes the given Python object.z</z<\/)�json�dumps�replacer r r r �json_encodeC s r# c C s t �t| ��S )zcReturns Python objects for the given JSON string. Supports both `str` and `bytes` inputs. )r �loadsr r r r r �json_decodeN s r% c C s t �dd| ��� S )z>Replace all sequences of whitespace chars with a single space.z[\x00-\x20]+� )r r �stripr r r r �squeezeV s r( T)r �plusr c C s |rt jjnt jj}|t| ��S )ai Returns a URL-encoded version of the given value. If ``plus`` is true (the default), spaces will be represented as "+" instead of "%20". This is appropriate for query strings but not for the path component of a URL. Note that this default is the reverse of Python's urllib module. .. versionadded:: 3.1 The ``plus`` argument )�urllib�parse� quote_plus�quote�utf8)r r) r- r r r � url_escape[ s r/ )r �encodingr) r c C s d S �Nr �r r0 r) r r r �url_unescapej s r3 �utf-8c C s d S r1 r r2 r r r r3 o s c C sP |du r(|rt | ��dd�} tj�| �S |r4tjjntjj}|t | �|d�S dS )a^ Decodes the given value from a URL. The argument may be either a byte or unicode string. If encoding is None, the result will be a byte string. Otherwise, the result is a unicode string in the specified encoding. If ``plus`` is true (the default), plus signs will be interpreted as spaces (literal plus signs must be represented as "%2B"). This is appropriate for query strings and form-encoded values but not for the path component of a URL. Note that this default is the reverse of Python's urllib module. .. versionadded:: 3.1 The ``plus`` argument N�+r&