diff options
author | Diana Clarke <diana.joan.clarke@gmail.com> | 2012-11-19 12:52:23 -0500 |
---|---|---|
committer | Diana Clarke <diana.joan.clarke@gmail.com> | 2012-11-19 12:52:23 -0500 |
commit | 34b8b22659999eae459ca33baa3ca479f8eb5bf1 (patch) | |
tree | 8612f22499c0bf4ec556dcdd31c2c3e276e83bc8 /lib/sqlalchemy/engine/url.py | |
parent | 0ac15d61f7a4b4b68cc4f1a63763823ee3c42d30 (diff) | |
download | sqlalchemy-34b8b22659999eae459ca33baa3ca479f8eb5bf1.tar.gz |
just a pep8 pass of lib/sqlalchemy/engine/
Diffstat (limited to 'lib/sqlalchemy/engine/url.py')
-rw-r--r-- | lib/sqlalchemy/engine/url.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/sqlalchemy/engine/url.py b/lib/sqlalchemy/engine/url.py index 5947deec3..42b5de7db 100644 --- a/lib/sqlalchemy/engine/url.py +++ b/lib/sqlalchemy/engine/url.py @@ -7,8 +7,9 @@ """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 +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()``. """ @@ -124,8 +125,8 @@ class URL(object): :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. + :param names: Deprecated. Same purpose as the keyword-based alternate + names, but correlates the name to the original positionally. """ translated = {} @@ -141,6 +142,7 @@ class URL(object): translated[name] = getattr(self, sname) return translated + def make_url(name_or_url): """Given a string or unicode instance, produce a new URL instance. @@ -153,6 +155,7 @@ def make_url(name_or_url): else: return name_or_url + def _parse_rfc1738_args(name): pattern = re.compile(r''' (?P<name>[\w\+]+):// @@ -165,8 +168,7 @@ def _parse_rfc1738_args(name): (?::(?P<port>[^/]*))? )? (?:/(?P<database>.*))? - ''' - , re.X) + ''', re.X) m = pattern.match(name) if m is not None: @@ -184,7 +186,8 @@ def _parse_rfc1738_args(name): components['query'] = query if components['password'] is not None: - components['password'] = urllib.unquote_plus(components['password']) + components['password'] = \ + urllib.unquote_plus(components['password']) name = components.pop('name') return URL(name, **components) @@ -192,11 +195,12 @@ def _parse_rfc1738_args(name): raise exc.ArgumentError( "Could not parse rfc1738 URL from string '%s'" % name) + def _parse_keyvalue_args(name): - m = re.match( r'(\w+)://(.*)', name) + m = re.match(r'(\w+)://(.*)', name) if m is not None: (name, args) = m.group(1, 2) - opts = dict( util.parse_qsl( args ) ) + opts = dict(util.parse_qsl(args)) return URL(name, *opts) else: return None |