Dashboard
PHP:
8.2.30
OS:
Linux
User:
dh_nv8b2m
/
/
usr
/
local
/
lib
/
python3.10
/
dist-packages
/
sqlalchemy
/
engine
/
__pycache__
📤 Upload
📝 New File
📁 New Folder
Close
Editing: url.cpython-310.pyc
o [�h�$ � @ 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 ZdZ d!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 urt|�| _nd | _|| _|pi | _d S �N)� drivername�username�password_original�host�int�port�database�query)�selfr r �passwordr r r r � r �@/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/url.py�__init__8 s zURL.__init__Tc s� � j d }� jd ur'|t� j�7 }� jd ur#|d|rdnt� j� 7 }|d7 }� jd ur>d� jv r9|d� j 7 }n|� j7 }� jd urL|dt� j� 7 }� jd urX|d� j 7 }� jrtt � j�}|� � |dd�� fd d �|D �� 7 }|S )Nz://�:z***�@z[%s]�/�?�&c 3 s2 � | ]}t �� j| �D ] }d ||f V qqdS )z%s=%sN)r �to_listr )�.0�k�element�r r r � <genexpr>b 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 � zURL.__str__c C s | � � S r r, r! r r r �__repr__l s zURL.__repr__c C s t t| ��S r )�hashr$ r! r r r �__hash__o r. zURL.__hash__c C s^ t |t�o.| j|jko.| j|jko.| j|jko.| j|jko.| j|jko.| j|jko.| j|jkS r ) � isinstancer r r r r r r r �r �otherr r r �__eq__r s � � � � � � �z URL.__eq__c C s | |k S r r r3 r r r �__ne__~ � z URL.__ne__c C s | j d u rd S t�| j �S r )r r � text_typer! r r r r � s zURL.passwordc C s || _ d S r )r )r r r r r r � s c C s d| j vr| j S | j �d�d S )N�+r )r �splitr! r r r �get_backend_name� s zURL.get_backend_namec C s$ d| j vr | �� jS | j �d�d S )Nr9 r )r �get_dialect�driverr: r! r r r �get_driver_name� s zURL.get_driver_namec s8 t ��j�dd��}|� �dg �7 }� �fdd�|D �S )N�pluginr r c s g | ] }t �|��� ��qS r )r �load)r �plugin_name��kwargsr r r � <listcomp>� s ��z,URL._instantiate_plugins.<locals>.<listcomp>)r r r �get)r rC �plugin_namesr rB r �_instantiate_plugins� s �zURL._instantiate_pluginsc C sV d| j vr | j }n| j �dd�}t�|�}t|d�r)t|jt�r)t|jt �r)|jS |S )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. r9 �.�dialect) r �replacer r@ �hasattrr2 rI �type� issubclassr )r �name�clsr r r �_get_entrypoint� s � � �zURL._get_entrypointc C s | � � }|�| �}|S )zfReturn the SQLAlchemy database dialect class corresponding to this URL's driver name. )rP �get_dialect_cls)r � entrypoint�dialect_clsr r r r<