Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/werkzeug/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/werkzeug/__pycache__/utils.cpython-312.pyc

�

'ٜg�`��(�ddlmZddlZddlZddlZddlZddlZddlZddlZ	ddl
Z
ddlmZddlmZddl
mZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZe	j@rddl!m"Z"ddl#m$Z$ddl%m&Z&e	jNd�Z(ejRd�Z*ejRd�Z+ddddhd�e,d�D��d�e,d�D��Z-Gd�de.e	j^e(�Z0Gd �d!ee�Z1Gd"�d#ee�Z2hd$�Z3d/d%�Z4d0d&�Z5	d1							d2d'�Z6d3d4d(�Z7										d5																									d6d)�Z8										d7d*�Z9d8d9d+�Z:	d:							d;d,�Z;Gd-�d.e<�Z=y)<�)�annotationsN)�datetime)�time)�quote)�adler32)�escape�)�_DictAccessorProperty)�_missing)�_TAccessorValue)�Headers)�NotFound)�RequestedRangeNotSatisfiable)�	safe_join)�	wrap_file)�WSGIEnvironment)�Request��Response�_Tz	&([^;]+);z[^A-Za-z0-9_.-]�CON�PRN�AUX�NULc#�&K�|]	}d|�����y�w)�COMN���.0�is  �9/usr/local/lib/python3.12/site-packages/werkzeug/utils.py�	<genexpr>r"*�����#��A��A�3�i�����
c#�&K�|]	}d|�����y�w)�LPTNrrs  r!r"r"+r#r$c�R��eZdZdZ		d							d�fd�
Zdd�Zd	d
d�Zdd�Z�xZS)�cached_propertyazA :func:`property` that is only evaluated once. Subsequent access
    returns the cached value. Setting the property sets the cached
    value. Deleting the property clears the cached value, accessing it
    again will evaluate it again.

    .. code-block:: python

        class Example:
            @cached_property
            def value(self):
                # calculate something important here
                return 42

        e = Example()
        e.value  # evaluates
        e.value  # uses cache
        e.value = 16  # sets cache
        del e.value  # clears cache

    If the class defines ``__slots__``, it must add ``_cache_{name}`` as
    a slot. Alternatively, it can add ``__dict__``, but that's usually
    not desirable.

    .. versionchanged:: 2.1
        Works with ``__slots__``.

    .. versionchanged:: 2.0
        ``del obj.name`` clears the cached value.
    c���t�|�||��|xs|j|_d|j��|_|j|_y)N)�doc�_cache_)�super�__init__�__name__�	slot_name�
__module__)�self�fget�namer+�	__class__s    �r!r.zcached_property.__init__NsD���	����3��'��-��
�
��
�"�4�=�=�/�2����/�/���c�~�t|d�r||j|j<yt||j|�y�N�__dict__)�hasattrr9r/�setattrr0)r2�obj�values   r!�__set__zcached_property.__set__Ys.���3�
�#�*/�C�L�L����'��C�����/r6c�>�|�|St|dd�}|�!|j|jt�}nt||jt�}|turE|j|�}|�||j|j<|St||j|�|Sr8)�getattr�getr/rr0r3r9r;)r2r<�type�obj_dictr=s     r!�__get__zcached_property.__get___s����;��K��3�
�D�1���� ���T�]�]�H�=�E��C�����:�E��H���I�I�c�N�E��#�.3����T�]�]�+�����T�^�^�U�3��r6c��t|d�r|j|j=yt||jt
�yr8)r:r9r/r;r0r�r2r<s  r!�
__delete__zcached_property.__delete__ts,���3�
�#����T�]�]�+��C�����2r6)NN)r3zt.Callable[[t.Any], _T]r4�
str | Noner+rH�return�None)r<�objectr=rrIrJ�N)r<rKrBrBrIr)r<rKrIrJ)	r/r1�__qualname__�__doc__r.r>rDrG�
__classcell__�r5s@r!r)r)/sK����B ��		*�%�	*��	*��		*�

�	*�0��*3r6r)c��eZdZdZdZdd�Zy)�environ_propertya�Maps request attributes to environment variables. This works not only
    for the Werkzeug request object, but also any other class with an
    environ attribute:

    >>> class Test(object):
    ...     environ = {'key': 'value'}
    ...     test = environ_property('key')
    >>> var = Test()
    >>> var.test
    'value'

    If you pass it a second value it's used as default if the key does not
    exist, the third one can be a converter that takes a value and converts
    it.  If it raises :exc:`ValueError` or :exc:`TypeError` the default value
    is used. If no default value is provided `None` is used.

    Per default the property is read only.  You have to explicitly enable it
    by passing ``read_only=False`` to the constructor.
    Tc��|jSrL)�environrFs  r!�lookupzenviron_property.lookup�����{�{�r6N)r<rrIr)r/r1rMrN�	read_onlyrUrr6r!rRrR{s���(�I�r6rRc��eZdZdZdd�Zy)�header_propertyz(Like `environ_property` but for headers.c��|jSrL)�headersrFs  r!rUzheader_property.lookup�rVr6N)r<zRequest | ResponserIr
)r/r1rMrNrUrr6r!rYrY�s
��2�r6rY>�application/sql�application/xml�application/xml-dtd�application/ecmascript�application/javascript�&application/xml-external-parsed-entityc�j�|jd�s|tvs|jd�r|d|��z
}|S)aLReturns the full content type string with charset for a mimetype.

    If the mimetype represents text, the charset parameter will be
    appended, otherwise the mimetype is returned unchanged.

    :param mimetype: The mimetype to be used as content type.
    :param charset: The charset to be appended for text mimetypes.
    :return: The content type.

    .. versionchanged:: 0.15
        Any type that ends with ``+xml`` gets a charset, not just those
        that start with ``application/``. Known text types such as
        ``application/javascript`` are also given charsets.
    ztext/z+xmlz
; charset=)�
startswith�_charset_mimetypes�endswith)�mimetype�charsets  r!�get_content_typerh�s?�� 	���G�$��)�)����V�$��j��	�*�*���Or6c	��tjd|�}|jdd�jd�}tj
tjjfD]}|s�|j|d�}�ttjddj|j����jd�}tjdk(r/|r-|jd	�d
j!�t"vrd|��}|S)atPass it a filename and it will return a secure version of it.  This
    filename can then safely be stored on a regular file system and passed
    to :func:`os.path.join`.  The filename returned is an ASCII only string
    for maximum portability.

    On windows systems the function also makes sure that the file is not
    named after one of the special device files.

    >>> secure_filename("My cool movie.mov")
    'My_cool_movie.mov'
    >>> secure_filename("../../../etc/passwd")
    'etc_passwd'
    >>> secure_filename('i contain cool \xfcml\xe4uts.txt')
    'i_contain_cool_umlauts.txt'

    The function might return an empty filename.  It's your responsibility
    to ensure that the filename is unique and that you abort or
    generate a random filename if the function returned an empty one.

    .. versionadded:: 0.5

    :param filename: the filename to secure
    �NFKD�ascii�ignore� ��_z._�nt�.r)�unicodedata�	normalize�encode�decode�os�sep�path�altsep�replace�str�_filename_ascii_strip_re�sub�join�split�stripr4�upper�_windows_device_files)�filenamerws  r!�secure_filenamer��s���0�$�$�V�X�6�H����w��1�8�8��A�H��v�v�r�w�w�~�~�%����'�'��S�1�H�&��+�/�/��C�H�H�X�^�^�=M�4N�O�P�V�V���H�	���4����N�N�3���"�(�(�*�.C�C��x�j�>���Or6c�n�|�ddlm}t|�}|d|�d|�d�|d��}||jd<|S)	aaReturns a response object (a WSGI application) that, if called,
    redirects the client to the target location. Supported codes are
    301, 302, 303, 305, 307, and 308. 300 is not supported because
    it's not a real redirect and 304 because it's the answer for a
    request with a request with defined If-Modified-Since headers.

    .. versionadded:: 0.6
       The location can now be a unicode string that is encoded using
       the :func:`iri_to_uri` function.

    .. versionadded:: 0.10
        The class used for the Response object can now be passed in.

    :param location: the location the response should redirect to.
    :param code: the redirect status code. defaults to 302.
    :param class Response: a Response class to use when instantiating a
        response. The default is :class:`werkzeug.wrappers.Response` if
        unspecified.
    r	rz�<!doctype html>
<html lang=en>
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to the target URL: <a href="z">z</a>. If not, click the link.
z	text/html)rf�Location)�wrappersrrr[)�location�coder�
html_location�responses     r!�redirectr��s[��,��&��8�$�M��	�
"�?�"�]�O�3R�	T�	
��	�H�$,�H���Z� ��Or6c��|djd�d}|sd}n|�d�}|jd�}|r|�d|��}t||�S)aLRedirect to the current URL with a slash appended.

    If the current URL is ``/user/42``, the redirect URL will be
    ``42/``. When joined to the current URL during response
    processing or by the browser, this will produce ``/user/42/``.

    The behavior is undefined if the path ends with a slash already. If
    called unconditionally on a URL, it may produce a redirect loop.

    :param environ: Use the path and query from this WSGI environment
        to produce the redirect URL.
    :param code: the status code for the redirect.

    .. versionchanged:: 2.1
        Produce a relative URL that only modifies the last segment.
        Relevant when the current path has multiple segments.

    .. versionchanged:: 2.1
        The default status code is 308 instead of 301. This preserves
        the request method and body.
    �	PATH_INFO�/�z./�QUERY_STRING�?)�
rpartitionrAr�)rTr��tail�new_path�query_strings     r!�append_slash_redirectr�s_��,�;��*�*�3�/��2�D�����V�1�:���;�;�~�.�L���Z�q���/���H�d�#�#r6c�d�|
�ddlm}|}
d}
d}d}d}t�}t|tj
tf�st|d�r�tjd|�}|�!tjj||�}
ntjj|�}
t	j|
�}|j}|j}n|}|�!|
�tjj!|
�}|�?|�t#d��t%j&|�\}}|�d}|�|s|j)d|�|�1	|j+d	�d
|i}|rdnd}|j(d|fi|��n
|rt#d��|	r
|
�|
|d<d}nu|�
t7|
d�}nZt|t8j:�r|j=�j>}n%t|t8j@�rtCd��tE||�}|
|||d��}|�||_#|�||_$n	|�||_$d|jJ_&tO|�r||
�}|�S|dkDr"d|jJ_&d|jJ_(||jJ_)tUtW�|z�|_,t|t�r|j[|�n9|r7|
�5t]|
j+��dz}|j[|�d|�d|���|r@	|j_|d|��}|jddk(r|jfjidd�|S#t,$rPt/j0d|�}|j+d	d�j3d	�}t5|d
��}|d|��d�}Y��AwxYw#t`$r|�|jc��wxYw) a3Send the contents of a file to the client.

    The first argument can be a file path or a file-like object. Paths
    are preferred in most cases because Werkzeug can manage the file and
    get extra information from the path. Passing a file-like object
    requires that the file is opened in binary mode, and is mostly
    useful when building a file in memory with :class:`io.BytesIO`.

    Never pass file paths provided by a user. The path is assumed to be
    trusted, so a user could craft a path to access a file you didn't
    intend. Use :func:`send_from_directory` to safely serve user-provided paths.

    If the WSGI server sets a ``file_wrapper`` in ``environ``, it is
    used, otherwise Werkzeug's built-in wrapper is used. Alternatively,
    if the HTTP server supports ``X-Sendfile``, ``use_x_sendfile=True``
    will tell the server to send the given path, which is much more
    efficient than reading it in Python.

    :param path_or_file: The path to the file to send, relative to the
        current working directory if a relative path is given.
        Alternatively, a file-like object opened in binary mode. Make
        sure the file pointer is seeked to the start of the data.
    :param environ: The WSGI environ for the current request.
    :param mimetype: The MIME type to send for the file. If not
        provided, it will try to detect it from the file name.
    :param as_attachment: Indicate to a browser that it should offer to
        save the file instead of displaying it.
    :param download_name: The default name browsers will use when saving
        the file. Defaults to the passed file name.
    :param conditional: Enable conditional and range responses based on
        request headers. Requires passing a file path and ``environ``.
    :param etag: Calculate an ETag for the file, which requires passing
        a file path. Can also be a string to use instead.
    :param last_modified: The last modified time to send for the file,
        in seconds. If not provided, it will try to detect it from the
        file path.
    :param max_age: How long the client should cache the file, in
        seconds. If set, ``Cache-Control`` will be ``public``, otherwise
        it will be ``no-cache`` to prefer conditional caching.
    :param use_x_sendfile: Set the ``X-Sendfile`` header to let the
        server to efficiently send the file. Requires support from the
        HTTP server. Requires passing a file path.
    :param response_class: Build the response using this class. Defaults
        to :class:`~werkzeug.wrappers.Response`.
    :param _root_path: Do not use. For internal use only. Use
        :func:`send_from_directory` to safely send files under a path.

    .. versionchanged:: 2.0.2
        ``send_file`` only sets a detected ``Content-Encoding`` if
        ``as_attachment`` is disabled.

    .. versionadded:: 2.0
        Adapted from Flask's implementation.

    .. versionchanged:: 2.0
        ``download_name`` replaces Flask's ``attachment_filename``
         parameter. If ``as_attachment=False``, it is passed with
         ``Content-Disposition: inline`` instead.

    .. versionchanged:: 2.0
        ``max_age`` replaces Flask's ``cache_timeout`` parameter.
        ``conditional`` is enabled and ``max_age`` is not set by
        default.

    .. versionchanged:: 2.0
        ``etag`` replaces Flask's ``add_etags`` parameter. It can be a
        string to use instead of generating one.

    .. versionchanged:: 2.0
        If an encoding is returned when guessing ``mimetype`` from
        ``download_name``, set the ``Content-Encoding`` header.
    Nr	r�
__fspath__zt.Union[os.PathLike[str], str]z�Unable to detect the MIME type because a file name is not available. Either set 'download_name', pass a path instead of a file, or set 'mimetype'.zapplication/octet-streamzContent-Encodingrkr�rjrlz!#$&+-.^_`|~)�safezUTF-8'')r�z	filename*�
attachment�inlinezContent-Dispositionz]No name provided for attachment. Either set 'download_name' or pass a path instead of a file.z
X-Sendfile�rbz3Files must be opened in binary mode or use BytesIO.T)rfr[�direct_passthroughrl���-)�
accept_ranges�complete_lengthi0z
x-sendfile)5r�rr
�
isinstancerv�PathLiker{r:�t�castrxr~�abspath�stat�st_size�st_mtime�basename�	TypeError�	mimetypes�
guess_type�setrt�UnicodeEncodeErrorrrrsrur�open�io�BytesIO�	getbuffer�nbytes�
TextIOBase�
ValueErrorr�content_length�
last_modified�
cache_control�no_cache�callable�public�max_age�intr�expires�set_etagr�make_conditionalr�close�status_coder[�pop)�path_or_filerTrf�
as_attachment�
download_name�conditional�etagr�r��use_x_sendfile�response_class�
_root_pathrrx�file�size�mtimer[r��encoding�names�simple�quotedr=�data�rv�checks                           r!�	send_filer�?s���l��&�!���D�#�D��D��E��i�G��,����c� 2�3�w��l�8��v�v�>��M���!��7�7�<�<�
�L�9�D��7�7�?�?�<�0�D��w�w�t�}���|�|���
�
�������!1����(�(��.�
���� ��>��
�'�1�1�-�@���(���1�H���
��K�K�*�H�5�� �		0�� � ��)� ��/�E� -��8������)�5�:�E�:�	��
A�
�	
�
�$�*� $�������<���d�#�D�
��b�j�j�
)��>�>�#�*�*�D�
��b�m�m�
,��R�S�S���$�'��	��x��T�
�B��� ���� �(���	�	� ��� $�B��������$�-�����Q�;�(,�B���%�&*�B���#�#*���� ����'�)�*��
��$���
���D��	
�$�"�����
�&��3��
���u�g�Q�t�f�A�e�W�-�.��	��$�$�W�D�RV�$�W�B��>�>�S� ��J�J�N�N�<��.�
�I��["�	J� �*�*�6�=�A�F��]�]�7�H�5�<�<�W�E�F��=�~�>�F�!'���x�6H�I�E�	J��D,�	����
�
���		�s�8L6�5N�6AN�N�N/c�8�ttj|�tj|��}|�
t��d|vr#tjj|d|�}tjj
|�s
t��t||fi|��S)a�Send a file from within a directory using :func:`send_file`.

    This is a secure way to serve files from a folder, such as static
    files or uploads. Uses :func:`~werkzeug.security.safe_join` to
    ensure the path coming from the client is not maliciously crafted to
    point outside the specified directory.

    If the final path does not point to an existing regular file,
    returns a 404 :exc:`~werkzeug.exceptions.NotFound` error.

    :param directory: The directory that ``path`` must be located under. This *must not*
        be a value provided by the client, otherwise it becomes insecure.
    :param path: The path to the file to send, relative to ``directory``. This is the
        part of the path provided by the client, which is checked for security.
    :param environ: The WSGI environ for the current request.
    :param kwargs: Arguments to pass to :func:`send_file`.

    .. versionadded:: 2.0
        Adapted from Flask's implementation.
    r�)rrv�fspathrrxr~�isfiler�)�	directoryrxrT�kwargs�path_strs     r!�send_from_directoryr�s|��4����9�-�r�y�y���?�H����j���v���7�7�<�<��|� 4�h�?��
�7�7�>�>�(�#��j���X�w�1�&�1�1r6c���|jdd�}		t|�tj|S#t$rd|vr�YnwxYw|jdd�\}}t|t
�t�|g�}	t||�S#t$r}t	|�d�d}~wwxYw#t$r=}|s1t||�jtj�d�d�Yd}~yd}~wwxYw)aCImports an object based on a string.  This is useful if you want to
    use import paths as endpoints or something similar.  An import path can
    be specified either in dotted notation (``xml.sax.saxutils.escape``)
    or with a colon as object delimiter (``xml.sax.saxutils:escape``).

    If `silent` is True the return value will be `None` if the import fails.

    :param import_name: the dotted name for the object to import.
    :param silent: if set to `True` import errors are ignored and
                   `None` is returned instead.
    :return: imported object
    �:rqr	Nr�)
rz�
__import__�sys�modules�ImportError�rsplit�globals�localsr@�AttributeError�ImportStringError�with_traceback�exc_info)�import_name�silent�module_name�obj_name�module�es      r!�
import_stringr�Ds���%�%�c�3�/�K��	,��{�#�
�;�;�{�+�+��	�	��+�%��&�	��!,� 2� 2�3�� :���X��K���F�H�x�j�I��	+��6�8�,�,���	+��a�.�d�*��	+�����#�K��3�B�B�����q�!���
��
��
�sP�3�B%�A�B%�A�7B%�<B�	B"�B�B"�"B%�%	C+�.3C&�&C+c#�K�t|�}t|dd�}|�t|�d���|j�d�}t	j
|�D]0\}}}||z}|r|r|��|s�t
||d�Ed{����-|���2y7��w)a�Finds all the modules below a package.  This can be useful to
    automatically import all views / controllers so that their metaclasses /
    function decorators have a chance to register themselves on the
    application.

    Packages are not returned unless `include_packages` is `True`.  This can
    also recursively list modules but in that case it will import all the
    packages to get the correct load path of that module.

    :param import_path: the dotted name for the package to find child modules.
    :param include_packages: set to `True` if packages should be returned, too.
    :param recursive: set to `True` if recursion should happen.
    :return: generator
    �__path__Nz is not a packagerqT)r�r@r�r/�pkgutil�iter_modules�find_modules)	�import_path�include_packages�	recursiver�rxr��	_importer�modname�ispkgs	         r!r�r�ks�����"�;�
'�F��6�:�t�,�D��|��K�?�*;�<�=�=��/�/�"�!�$�H�%,�%9�%9�$�%?�!�	�7�E��W�$�����
��'��1A�4�H�H�H��M�&@�I�s�A#B�&B�6B�7
Bc�B��eZdZUdZded<ded<d�fd�Zd	d�Z�xZS)
r�zBProvides information about a failed :func:`import_string` attempt.r{r��
BaseException�	exceptionc
����||_||_|}d}g}|jdd�jd�D]�}|r|�d|��n|}t	|d��}|r|j|t
|dd�f��<|D��	cgc]\}}	d|�d|	�d���}
}}	|
jd|�d	��d
j|
�}d|�d|�d
t|�j�d|��}nt�|�-|�ycc}	}w)Nrnr�rqT)r��__file__z- z
 found in z not found.�
zimport_string() failed for z�. Possible reasons are:

- missing __init__.py in a package;
- package or module path not included in sys.path;
- duplicated package or module name taking precedence in sys.path;
- missing module, class, function or variable;

Debugged import:

z

Original exception:

z: )r�rrzrr��appendr@r~rBr/r-r.)
r2r�r�msgr4�tracked�part�imported�nr �track�	track_strr5s
            �r!r.zImportStringError.__init__�s���&���"����������'�'��S�1�7�7��<�D�'+�d�V�1�T�F�#��D�$�T�$�7�H������g�h�
�D�&I�J�K�@G�H����1�2�a�U�*�Q�E��3���H����r�$���5�6� �I�I�e�,�	�1�+��A+�,5�+�6.�.2�9�o�.F�.F�-G�r�)��V���)=�,	������!Is�8C(c�h�dt|�j�d|j�d|j�d�S)N�<�(z, z)>)rBr/r�r)r2s r!�__repr__zImportStringError.__repr__�s5���4��:�&�&�'�q��)9�)9�(<�B�t�~�~�>P�PR�S�Sr6)r�r{rr�rIrJ)rIr{)r/r1rMrN�__annotations__r.rrOrPs@r!r�r��s���L������<Tr6r�)rfr{rgr{rIr{)r�r{rIr{)i.N)r�r{r�r�r�type[Response] | NonerIr)i4)rTrr�r�rIr)
NFNTTNNFNN)r�z$os.PathLike[str] | str | t.IO[bytes]rTrrfrHr��boolr�rHr�rr�z
bool | strr�zdatetime | int | float | Noner�z3None | (int | t.Callable[[str | None], int | None])r�rr�rr�zos.PathLike[str] | str | NonerIr)
r��os.PathLike[str] | strrxrrTrr��t.AnyrIr)F)r�r{r�rrIr)FF)r�r{r�rr�rrIzt.Iterator[str])>�
__future__rr�r�rvr��rer��typingr�rrrr�urllib.parser�zlibr�
markupsafer�	_internalr
rr�datastructuresr
�
exceptionsrr�securityr�wsgir�
TYPE_CHECKING�_typeshed.wsgir�wrappers.requestr�wrappers.responser�TypeVarr�compile�
_entity_rer|�ranger��property�Genericr)rRrYrdrhr�r�r�r�r�r�r�r�r�rr6r!�<module>r*sm��"�	��	��	�
��������,��&�#� �4����?�?�.�)�+��Q�Y�Y�t�_��
�R�Z�Z��
%�
�%�2�:�:�&8�9��	�	�	�	�	�
$��r��#��$��r��#�
��I3�h��	�	�"�
�I3�X�,�_�=��6�+�O�<�����2,�`GK�%��%��%�.C�%�
�%�P"$�P �� $���37�CG� �,0�04�X�6�X�
�X��X��	X�
�X��
X��X�1�X�A�X��X�*�X�.�X��X�v'2�%�'2�
 �'2��'2��	'2�
�'2�T$�PIN����(,��AE����B'T��'Tr6

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists