HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/engine/__pycache__/url.cpython-37.pyc
B

��4]�$�@s�dZddlZddlmZddlmZddlmZddlmZdd	lm	Z	Gd
d�de
�Zdd
�Zdd�Z
dd�Zdd�Zdd�ZdS)aProvides the :class:`~sqlalchemy.engine.url.URL` class which encapsulates
information about a database connection specification.

The URL object is created automatically when
:func:`~sqlalchemy.engine.create_engine` is called with a string
argument; alternatively, the URL is a public-facing construct which can
be used directly and is also accepted directly by ``create_engine()``.
�N�)�Dialect�)�exc)�util)�plugins)�registryc@s�eZdZdZd!dd�Zd"dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
edd��Zej
dd��Zdd�Zdd�Zdd�Zdd�Zdd�Zgfdd �ZdS)#�URLaX
    Represent the components of a URL used to connect to a database.

    This object is suitable to be passed directly to a
    :func:`~sqlalchemy.create_engine` call.  The fields of the URL are parsed
    from a string by the :func:`.make_url` function.  the string
    format of the URL is an RFC-1738-style string.

    All initialization parameters are available as public attributes.

    :param drivername: the name of the database backend.
      This name will correspond to a module in sqlalchemy/databases
      or a third party plug-in.

    :param username: The user name.

    :param password: database password.

    :param host: The name of the host.

    :param port: The port number.

    :param database: The database name.

    :param query: A dictionary of options to be passed to the
      dialect and/or the DBAPI upon connect.

    NcCsF||_||_||_||_|dk	r,t|�|_nd|_||_|p>i|_dS)N)�
drivername�username�password_original�host�int�port�database�query)�selfr
r�passwordr
rrr�r�H/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/engine/url.py�__init__8s
zURL.__init__Tcs��jd}�jdk	rN|t�j�7}�jdk	rF|d|r8dnt�j�7}|d7}�jdk	r|d�jkrr|d�j7}n
|�j7}�jdk	r�|dt�j�7}�jdk	r�|d�j7}�jr�t	�j�}|�
�|dd��fd	d
�|D��7}|S)Nz://�:z***�@z[%s]�/�?�&c3s0|](}t��j|�D]}d||fVqqdS)z%s=%sN)r�to_listr)�.0�k�element)rrr�	<genexpr>csz$URL.__to_string__.<locals>.<genexpr>)r
r�_rfc_1738_quoterr
r�strrr�list�sort�join)r�
hide_password�s�keysr)rr�
__to_string__Ms,









zURL.__to_string__cCs|jdd�S)NF)r&)r))rrrr�__str__iszURL.__str__cCs|��S)N)r))rrrr�__repr__lszURL.__repr__cCstt|��S)N)�hashr")rrrr�__hash__oszURL.__hash__cCs^t|t�o\|j|jko\|j|jko\|j|jko\|j|jko\|j|jko\|j|jko\|j|jkS)N)	�
isinstancer	r
rrr
rrr)r�otherrrr�__eq__rs
z
URL.__eq__cCs
||kS)Nr)rr/rrr�__ne__~sz
URL.__ne__cCs|jdkrdSt�|j�SdS)N)rrZ	text_type)rrrrr�s
zURL.passwordcCs
||_dS)N)r)rrrrrr�scCs$d|jkr|jS|j�d�dSdS)N�+r)r
�split)rrrr�get_backend_name�s
zURL.get_backend_namecCs(d|jkr|��jS|j�d�dSdS)Nr2r)r
�get_dialectZdriverr3)rrrr�get_driver_name�s

zURL.get_driver_namecs8t��j�dd��}|��dg�7}��fdd�|D�S)NZpluginrrcsg|]}t�|�����qSr)r�load)rZplugin_name)�kwargsrrr�
<listcomp>�sz,URL._instantiate_plugins.<locals>.<listcomp>)rrr�get)rr8Zplugin_namesr)r8rr�_instantiate_plugins�szURL._instantiate_pluginscCsZd|jkr|j}n|j�dd�}t�|�}t|d�rRt|jt�rRt|jt	�rR|jS|SdS)z�Return the "entry point" dialect class.

        This is normally the dialect itself except in the case when the
        returned class implements the get_dialect_cls() method.

        r2�.�dialectN)
r
�replacerr7�hasattrr.r=�type�
issubclassr)r�name�clsrrr�_get_entrypoint�s


zURL._get_entrypointcCs|��}|�|�}|S)zfReturn the SQLAlchemy database dialect class corresponding
        to this URL's driver name.
        )rDZget_dialect_cls)rZ
entrypointZdialect_clsrrrr5�s
zURL.get_dialectcKsli}dddddg}xT|D]L}|r,|�d�}n||kr>||}n|}|dk	rt||d�rt||�||<qW|S)	a2Translate url attributes into a dictionary of connection arguments.

        Returns attributes of this url (`host`, `database`, `username`,
        `password`, `port`) as a plain dictionary.  The attribute names are
        used as the keys by default.  Unset or false attributes are omitted
        from the final dictionary.

        :param \**kw: Optional, alternate key names for url attributes.

        :param names: Deprecated.  Same purpose as the keyword-based alternate
            names, but correlates the name to the original positionally.
        r
rrrrrNF)�pop�getattr)r�names�kwZ
translatedZattribute_namesZsnamerBrrr�translate_connect_args�s

zURL.translate_connect_args)NNNNNN)T)�__name__�
__module__�__qualname__�__doc__rr)r*r+r-r0r1�propertyr�setterr4r6r;rDr5rIrrrrr	s*

	r	cCst|tj�rt|�S|SdS)z�Given a string or unicode instance, produce a new URL instance.

    The given string is parsed according to the RFC 1738 spec.  If an
    existing URL object is passed, just returns the object.
    N)r.r�string_types�_parse_rfc1738_args)Zname_or_urlrrr�make_url�srRc
CsXt�dtj�}|�|�}|dk	�rF|��}|ddk	r�|d�dd�}|d|d<t|�dkr�i}xbt�|d�D]J\}}tj	r�|�
d�}||kr�t�||�||<||�|�qr|||<qrWq�d}nd}||d<|d	dk	r�t
|d	�|d	<|d
dk	�rt
|d
�|d
<|�d�}|�d�}	|�p*|	|d
<|�d�}t|f|�St�d|��dS)Na�
            (?P<name>[\w\+]+)://
            (?:
                (?P<username>[^:/]*)
                (?::(?P<password>.*))?
            @)?
            (?:
                (?:
                    \[(?P<ipv6host>[^/]+)\] |
                    (?P<ipv4host>[^/:]+)
                )?
                (?::(?P<port>[^/]*))?
            )?
            (?:/(?P<database>.*))?
            rrrrr�asciirrr�ipv4host�ipv6hostr
rBz,Could not parse rfc1738 URL from string '%s')�re�compile�X�match�	groupdictr3�lenr�	parse_qslZpy2k�encoder�append�_rfc_1738_unquoterEr	r�
ArgumentError)
rB�pattern�m�
components�tokensr�key�valuerTrUrrrrQ�s@





rQcCst�ddd�|�S)Nz[:@/]cSsdt|�d��S)Nz%%%Xr)�ord�group)rbrrr�<lambda>(�z!_rfc_1738_quote.<locals>.<lambda>)rV�sub)�textrrrr!'sr!cCs
t�|�S)N)r�unquote)rlrrrr_+sr_cCsHt�d|�}|dk	r@|�dd�\}}tt�|��}t|f|��SdSdS)Nz(\w+)://(.*)rr)rVrYrh�dictrr\r	)rBrb�args�optsrrr�_parse_keyvalue_args/srq)rMrVZ
interfacesr�rrZdialectsrr�objectr	rRrQr!r_rqrrrr�<module>sD
=