File: //opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/engine/__pycache__/url.cpython-37.pyc
B
��4]�$ � @ s� d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ dd lm Z G d
d� de
�Zdd
� Zdd� Z
dd� Zdd� Zdd� ZdS )a Provides 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� e Zd ZdZd!dd�Zd"dd�Zdd � Zd
d� Zdd
� Zdd� Z dd� Z
edd� �Zej
dd� �Zdd� Zdd� Zdd� Zdd� Zdd� Zg fdd �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.
Nc C sF || _ || _|| _|| _|d k r,t|�| _nd | _|| _|p>i | _d S )N)�
drivername�username�password_original�host�int�port�database�query)�selfr
r �passwordr
r r r � r �H/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/engine/url.py�__init__8 s
zURL.__init__Tc s� � j d }� jd k rN|t� j�7 }� jd k rF|d|r8dnt� j� 7 }|d7 }� jd k r|d� jkrr|d� j 7 }n
|� j7 }� jd k r�|dt� j� 7 }� jd k r�|d� j 7 }� jr�t � j�}|�
� |dd�� fd d
�|D �� 7 }|S )Nz://�:z***�@z[%s]�/�?�&c 3 s0 | ](}t �� j| �D ]}d ||f V qqdS )z%s=%sN)r �to_listr )�.0�k�element)r r r � <genexpr>c s z$URL.__to_string__.<locals>.<genexpr>)r
r �_rfc_1738_quoter r
r �strr r �list�sort�join)r �
hide_password�s�keysr )r r �
__to_string__M s,
zURL.__to_string__c C s | j dd�S )NF)r&