%PDF- %PDF-
Direktori : /opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/engine/__pycache__/ |
Current 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�kZelement)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% )r( )r r r r �__str__i s zURL.__str__c C s | � � S )N)r( )r r r r �__repr__l s zURL.__repr__c C s t t| ��S )N)�hashr! )r r r r �__hash__o s zURL.__hash__c C s^ t |t�o\| j|jko\| j|jko\| j|jko\| j|jko\| j|jko\| j|jko\| j|jkS )N) � isinstancer r r r r r r r )r �otherr r r �__eq__r s z URL.__eq__c C s | |k S )Nr )r r. r r r �__ne__~ s z URL.__ne__c C s | j d krd S t�| j �S d S )N)r r Z text_type)r r r r r � s zURL.passwordc C s || _ d S )N)r )r r r r r r � s c C s$ d| j kr| j S | j �d�d S d S )N�+r )r �split)r r r r �get_backend_name� s zURL.get_backend_namec C s( d| j kr| �� jS | j �d�d S d S )Nr1 r )r �get_dialectZdriverr2 )r r r r �get_driver_name� s zURL.get_driver_namec s8 t ��j�dd��}|� �dg �7 }� �fdd�|D �S )NZpluginr r c s g | ]}t �|��� ��qS r )r �load)r Zplugin_name)�kwargsr r r � <listcomp>� s z,URL._instantiate_plugins.<locals>.<listcomp>)r r r �get)r r7 Zplugin_namesr )r7 r r �_instantiate_plugins� s zURL._instantiate_pluginsc C sZ d| j kr| j }n| j �dd�}t�|�}t|d�rRt|jt�rRt|jt �rR|jS |S dS )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. r1 �.�dialectN) r �replacer r6 �hasattrr- r<