Files
Home-AssistantConfig/deps/sqlalchemy/engine/__pycache__/url.cpython-34.pyc

101 lines
8.1 KiB
Plaintext
Raw Normal View History

2016-10-11 16:42:06 +00:00
<EFBFBD>
}<7D><>W$ <00>@s<>dZddlZddlmZmZddlmZddlmZGdd <00>d e<00>Z d
d <00>Z
d d <00>Z dd<00>Z dd<00>Z dd<00>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()``.
<EFBFBD>N<>)<02>exc<78>util<69>)<01>Dialect)<01>registryc@s<>eZdZdZdddddddd<00>Zddd<00>Zdd <00>Zd
d <00>Zd d <00>Zdd<00>Z dd<00>Z
dd<00>Z dd<00>Z dd<00>Z gdd<00>ZdS)<1A>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.
NcCsg||_||_||_||_|dk rBt|<00>|_n d|_||_|p]i|_dS)N)<08>
drivername<EFBFBD>username<6D>password<72>host<73>int<6E>port<72>database<73>query)<08>selfr r
r r rrr<00>r<00>;/tmp/pip-build-zkr322cu/sqlalchemy/sqlalchemy/engine/url.py<70>__init__5s       z URL.__init__TcsR<00>jd}<00>jdk rq|t<00>j<00>7}<00>jdk rd|d|rPdn t<00>j<00>7}n|d7}n<00>jdk r<>d<00>jkr<>|d<00>j7}q<>|<00>j7}n<00>jdk r<>|dt<00>j<00>7}n<00>jdk r<>|d<00>j7}n<00>jrNt <00>j<00>}|j
<00>|ddj <00>fd d
<00>|D<><00>7}n|S) Nz://<2F>:z***<2A>@z[%s]<5D>/<2F>?<3F>&c3s&|]}d|<00>j|fVqdS)z%s=%sN)r)<02>.0<EFBFBD>k)rrr<00> <genexpr>Vsz$URL.__to_string__.<locals>.<genexpr>) r r
<00>_rfc_1738_quoter r r<00>strrr<00>list<73>sort<72>join)r<00> hide_password<72>s<>keysr)rr<00> __to_string__Bs(   
-zURL.__to_string__cCs|jdd<00>S)Nr"F)r%)rrrr<00>__str__Ysz URL.__str__cCs
|j<00>S)N)r%)rrrr<00>__repr__\sz URL.__repr__cCstt|<00><00>S)N)<02>hashr)rrrr<00>__hash___sz URL.__hash__cCsyt|t<00>ox|j|jkox|j|jkox|j|jkox|j|jkox|j|jkox|j|jkS)N)<08>
isinstancerr r
r r rr)r<00>otherrrr<00>__eq__bsz
URL.__eq__cCs.d|jkr|jS|jjd<00>dSdS)N<>+r)r <00>split)rrrr<00>get_backend_namelszURL.get_backend_namecCs4d|jkr|j<00>jS|jjd<00>dSdS)Nr-r)r <00> get_dialectZdriverr.)rrrr<00>get_driver_namers zURL.get_driver_namecCs<>d|jkr|j}n|jjdd<00>}tj|<00>}t|d<00>ryt|jt<00>ryt|jt <00>ry|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.
r-<00>.<2E>dialectN)
r <00>replacer<00>load<61>hasattrr*r3<00>type<70>
issubclassr)r<00>name<6D>clsrrr<00>_get_entrypointxs zURL._get_entrypointcCs|j<00>}|j|<00>}|S)zfReturn the SQLAlchemy database dialect class corresponding
to this URL's driver name.
)r;Zget_dialect_cls)rZ
entrypointZ dialect_clsrrrr0<00>s zURL.get_dialectcKs<>i}dddddg}xy|D]q}|r@|jd<00>}n||krY||}n|}|dk r"t||d<00>r"t||<00>||<q"q"W|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 rr
r rrNF)<02>pop<6F>getattr)r<00>names<65>kwZ
translatedZattribute_namesZsnamer9rrr<00>translate_connect_args<67>s   zURL.translate_connect_args)<0F>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__rr%r&r'r)r,r/r1r;r0r@rrrrrs     
   rcCs$t|tj<00>rt|<00>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<00> string_types<65>_parse_rfc1738_args)Z name_or_urlrrr<00>make_url<72>s
rGcs<>tjdtj<00>}|j|<00>}|dk r<>|j<00>}|ddk r<>|djdd<00>}|d|d<t|<00>dkr<>ttj |d<19><00>p<>d<00>tj
r<><00>dk r<>t<00>fdd<00><00>D<><00><00>q<>nd<00><00>|d <|d
dk rt |d
<19>|d
<n|d dk r9t |d <19>|d <n|j d <00>}|j d <00>}|p`||d<|j d<00>}t ||<00>Stjd|<16><00>dS)Na<4E>
(?P<name>[\w\+]+)://
(?:
(?P<username>[^:/]*)
(?::(?P<password>.*))?
@)?
(?:
(?:
\[(?P<ipv6host>[^/]+)\] |
(?P<ipv4host>[^/:]+)
)?
(?::(?P<port>[^/]*))?
)?
(?:/(?P<database>.*))?
rrrrrc3s(|]}|jd<00><00>|fVqdS)<02>asciiN)<01>encode)rr)rrrr<00>sz&_parse_rfc1738_args.<locals>.<genexpr>rr
r <00>ipv4host<73>ipv6hostr r9z,Could not parse rfc1738 URL from string '%s')<10>re<72>compile<6C>X<>match<63> groupdictr.<00>len<65>dictr<00> parse_qslZpy2k<32>_rfc_1738_unquoter<rr<00> ArgumentError)r9<00>pattern<72>m<>
components<EFBFBD>tokensrJrKr)rrrF<00>s0  1%
 rFcCstjddd<00>|<00>S)Nz[:@/]cSsdt|jd<00><00>S)Nz%%%Xr)<02>ord<72>group)rWrrr<00><lambda><3E>sz!_rfc_1738_quote.<locals>.<lambda>)rL<00>sub)<01>textrrrr<00>srcCs tj|<00>S)N)r<00>unquote)r^rrrrT<00>srTcCs`tjd|<00>}|dk rX|jdd<00>\}}ttj|<00><00>}t||<00>SdSdS)Nz (\w+)://(.*)rr)rLrOr[rRrrSr)r9rW<00>args<67>optsrrr<00>_parse_keyvalue_args<67>s   rb)rDrL<00>rrrZdialectsr<00>objectrrGrFrrTrbrrrr<00><module>s <16> /