summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-01-06 01:19:47 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2019-01-06 18:23:11 -0500
commit1e278de4cc9a4181e0747640a960e80efcea1ca9 (patch)
tree13d0c035807613bfa07e734acad79b9c843cb8b0 /lib/sqlalchemy/dialects/postgresql
parent1e1a38e7801f410f244e4bbb44ec795ae152e04e (diff)
downloadsqlalchemy-1e278de4cc9a4181e0747640a960e80efcea1ca9.tar.gz
Post black reformatting
Applied on top of a pure run of black -l 79 in I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9, this set of changes resolves all remaining flake8 conditions for those codes we have enabled in setup.cfg. Included are resolutions for all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/__init__.py108
-rw-r--r--lib/sqlalchemy/dialects/postgresql/array.py21
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py82
-rw-r--r--lib/sqlalchemy/dialects/postgresql/dml.py15
-rw-r--r--lib/sqlalchemy/dialects/postgresql/ext.py10
-rw-r--r--lib/sqlalchemy/dialects/postgresql/hstore.py5
-rw-r--r--lib/sqlalchemy/dialects/postgresql/json.py12
-rw-r--r--lib/sqlalchemy/dialects/postgresql/pg8000.py37
-rw-r--r--lib/sqlalchemy/dialects/postgresql/psycopg2.py72
-rw-r--r--lib/sqlalchemy/dialects/postgresql/psycopg2cffi.py8
-rw-r--r--lib/sqlalchemy/dialects/postgresql/pygresql.py34
-rw-r--r--lib/sqlalchemy/dialects/postgresql/pypostgresql.py14
-rw-r--r--lib/sqlalchemy/dialects/postgresql/ranges.py1
-rw-r--r--lib/sqlalchemy/dialects/postgresql/zxjdbc.py3
14 files changed, 221 insertions, 201 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/__init__.py b/lib/sqlalchemy/dialects/postgresql/__init__.py
index 9e65484fa..a269770d1 100644
--- a/lib/sqlalchemy/dialects/postgresql/__init__.py
+++ b/lib/sqlalchemy/dialects/postgresql/__init__.py
@@ -5,60 +5,61 @@
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-from . import (
- base,
- psycopg2,
- pg8000,
- pypostgresql,
- pygresql,
- zxjdbc,
- psycopg2cffi,
-) # noqa
+from . import base
+from . import pg8000 # noqa
+from . import psycopg2 # noqa
+from . import psycopg2cffi # noqa
+from . import pygresql # noqa
+from . import pypostgresql # noqa
+from . import zxjdbc # noqa
+from .array import All
+from .array import Any
+from .array import ARRAY
+from .array import array
+from .base import BIGINT
+from .base import BIT
+from .base import BOOLEAN
+from .base import BYTEA
+from .base import CHAR
+from .base import CIDR
+from .base import CreateEnumType
+from .base import DATE
+from .base import DOUBLE_PRECISION
+from .base import DropEnumType
+from .base import ENUM
+from .base import FLOAT
+from .base import INET
+from .base import INTEGER
+from .base import INTERVAL
+from .base import MACADDR
+from .base import MONEY
+from .base import NUMERIC
+from .base import OID
+from .base import REAL
+from .base import REGCLASS
+from .base import SMALLINT
+from .base import TEXT
+from .base import TIME
+from .base import TIMESTAMP
+from .base import TSVECTOR
+from .base import UUID
+from .base import VARCHAR
+from .dml import Insert
+from .dml import insert
+from .ext import aggregate_order_by
+from .ext import array_agg
+from .ext import ExcludeConstraint
+from .hstore import HSTORE
+from .hstore import hstore
+from .json import JSON
+from .json import JSONB
+from .ranges import DATERANGE
+from .ranges import INT4RANGE
+from .ranges import INT8RANGE
+from .ranges import NUMRANGE
+from .ranges import TSRANGE
+from .ranges import TSTZRANGE
-from .base import (
- INTEGER,
- BIGINT,
- SMALLINT,
- VARCHAR,
- CHAR,
- TEXT,
- NUMERIC,
- FLOAT,
- REAL,
- INET,
- CIDR,
- UUID,
- BIT,
- MACADDR,
- MONEY,
- OID,
- REGCLASS,
- DOUBLE_PRECISION,
- TIMESTAMP,
- TIME,
- DATE,
- BYTEA,
- BOOLEAN,
- INTERVAL,
- ENUM,
- TSVECTOR,
- DropEnumType,
- CreateEnumType,
-)
-from .hstore import HSTORE, hstore
-from .json import JSON, JSONB
-from .array import array, ARRAY, Any, All
-from .ext import aggregate_order_by, ExcludeConstraint, array_agg
-from .dml import insert, Insert
-
-from .ranges import (
- INT4RANGE,
- INT8RANGE,
- NUMRANGE,
- DATERANGE,
- TSRANGE,
- TSTZRANGE,
-)
base.dialect = dialect = psycopg2.dialect
@@ -98,6 +99,7 @@ __all__ = (
"INT8RANGE",
"NUMRANGE",
"DATERANGE",
+ "TSVECTOR",
"TSRANGE",
"TSTZRANGE",
"JSON",
diff --git a/lib/sqlalchemy/dialects/postgresql/array.py b/lib/sqlalchemy/dialects/postgresql/array.py
index 07167f9d0..af1469880 100644
--- a/lib/sqlalchemy/dialects/postgresql/array.py
+++ b/lib/sqlalchemy/dialects/postgresql/array.py
@@ -5,13 +5,15 @@
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-from .base import ischema_names, colspecs
-from ...sql import expression, operators
-from ...sql.base import SchemaEventTarget
+from .base import colspecs
+from .base import ischema_names
from ... import types as sqltypes
+from ...sql import expression
+from ...sql import operators
+
try:
- from uuid import UUID as _python_UUID
+ from uuid import UUID as _python_UUID # noqa
except ImportError:
_python_UUID = None
@@ -142,13 +144,14 @@ class ARRAY(sqltypes.ARRAY):
)
The :class:`.postgresql.ARRAY` type provides all operations defined on the
- core :class:`.types.ARRAY` type, including support for "dimensions", indexed
- access, and simple matching such as :meth:`.types.ARRAY.Comparator.any`
- and :meth:`.types.ARRAY.Comparator.all`. :class:`.postgresql.ARRAY` class also
+ core :class:`.types.ARRAY` type, including support for "dimensions",
+ indexed access, and simple matching such as
+ :meth:`.types.ARRAY.Comparator.any` and
+ :meth:`.types.ARRAY.Comparator.all`. :class:`.postgresql.ARRAY` class also
provides PostgreSQL-specific methods for containment operations, including
:meth:`.postgresql.ARRAY.Comparator.contains`
- :meth:`.postgresql.ARRAY.Comparator.contained_by`,
- and :meth:`.postgresql.ARRAY.Comparator.overlap`, e.g.::
+ :meth:`.postgresql.ARRAY.Comparator.contained_by`, and
+ :meth:`.postgresql.ARRAY.Comparator.overlap`, e.g.::
mytable.c.data.contains([1, 2])
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index 11833da57..e77b2880f 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -290,13 +290,13 @@ use the :meth:`._UpdateBase.returning` method on a per-statement basis::
INSERT...ON CONFLICT (Upsert)
------------------------------
-Starting with version 9.5, PostgreSQL allows "upserts" (update or insert)
-of rows into a table via the ``ON CONFLICT`` clause of the ``INSERT`` statement.
-A candidate row will only be inserted if that row does not violate
-any unique constraints. In the case of a unique constraint violation,
-a secondary action can occur which can be either "DO UPDATE", indicating
-that the data in the target row should be updated, or "DO NOTHING",
-which indicates to silently skip this row.
+Starting with version 9.5, PostgreSQL allows "upserts" (update or insert) of
+rows into a table via the ``ON CONFLICT`` clause of the ``INSERT`` statement. A
+candidate row will only be inserted if that row does not violate any unique
+constraints. In the case of a unique constraint violation, a secondary action
+can occur which can be either "DO UPDATE", indicating that the data in the
+target row should be updated, or "DO NOTHING", which indicates to silently skip
+this row.
Conflicts are determined using existing unique constraints and indexes. These
constraints may be identified either using their name as stated in DDL,
@@ -331,8 +331,9 @@ Both methods supply the "target" of the conflict using either the
named constraint or by column inference:
* The :paramref:`.Insert.on_conflict_do_update.index_elements` argument
- specifies a sequence containing string column names, :class:`.Column` objects,
- and/or SQL expression elements, which would identify a unique index::
+ specifies a sequence containing string column names, :class:`.Column`
+ objects, and/or SQL expression elements, which would identify a unique
+ index::
do_update_stmt = insert_stmt.on_conflict_do_update(
index_elements=['id'],
@@ -915,34 +916,37 @@ E.g.::
"""
from collections import defaultdict
-import re
import datetime as dt
+import re
-
-from sqlalchemy.sql import elements
-from ... import sql, schema, exc, util
-from ...engine import default, reflection
-from ...sql import compiler, expression
+from ... import exc
+from ... import schema
+from ... import sql
+from ... import util
+from ...engine import default
+from ...engine import reflection
+from ...sql import compiler
+from ...sql import elements
+from ...sql import expression
from ...sql import sqltypes
+from ...types import BIGINT
+from ...types import BOOLEAN
+from ...types import CHAR
+from ...types import DATE
+from ...types import FLOAT
+from ...types import INTEGER
+from ...types import NUMERIC
+from ...types import REAL
+from ...types import SMALLINT
+from ...types import TEXT
+from ...types import VARCHAR
+
try:
- from uuid import UUID as _python_UUID
+ from uuid import UUID as _python_UUID # noqa
except ImportError:
_python_UUID = None
-from sqlalchemy.types import (
- INTEGER,
- BIGINT,
- SMALLINT,
- VARCHAR,
- CHAR,
- TEXT,
- FLOAT,
- NUMERIC,
- DATE,
- BOOLEAN,
- REAL,
-)
AUTOCOMMIT_REGEXP = re.compile(
r"\s*(?:UPDATE|INSERT|CREATE|DELETE|DROP|ALTER|GRANT|REVOKE|"
@@ -2022,7 +2026,7 @@ class PGDDLCompiler(compiler.DDLCompiler):
class PGTypeCompiler(compiler.GenericTypeCompiler):
- def visit_TSVECTOR(self, type, **kw):
+ def visit_TSVECTOR(self, type_, **kw):
return "TSVECTOR"
def visit_INET(self, type_, **kw):
@@ -3087,9 +3091,21 @@ class PGDialect(default.DefaultDialect):
for conname, condef, conschema in c.fetchall():
m = re.search(FK_REGEX, condef).groups()
- constrained_columns, referred_schema, referred_table, referred_columns, _, match, _, onupdate, _, ondelete, deferrable, _, initially = (
- m
- )
+ (
+ constrained_columns,
+ referred_schema,
+ referred_table,
+ referred_columns,
+ _,
+ match,
+ _,
+ onupdate,
+ _,
+ ondelete,
+ deferrable,
+ _,
+ initially,
+ ) = m
if deferrable is not None:
deferrable = True if deferrable == "DEFERRABLE" else False
diff --git a/lib/sqlalchemy/dialects/postgresql/dml.py b/lib/sqlalchemy/dialects/postgresql/dml.py
index 825f13238..9698e36ba 100644
--- a/lib/sqlalchemy/dialects/postgresql/dml.py
+++ b/lib/sqlalchemy/dialects/postgresql/dml.py
@@ -5,14 +5,15 @@
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-from ...sql.elements import ClauseElement, _literal_as_binds
+from . import ext
+from ... import util
+from ...sql import schema
+from ...sql.base import _generative
from ...sql.dml import Insert as StandardInsert
+from ...sql.elements import ClauseElement
from ...sql.expression import alias
-from ...sql import schema
from ...util.langhelpers import public_factory
-from ...sql.base import _generative
-from ... import util
-from . import ext
+
__all__ = ("Insert", "insert")
@@ -51,7 +52,7 @@ class Insert(StandardInsert):
set_=None,
where=None,
):
- """
+ r"""
Specifies a DO UPDATE SET action for ON CONFLICT clause.
Either the ``constraint`` or ``index_elements`` argument is
@@ -70,7 +71,7 @@ class Insert(StandardInsert):
Additional WHERE criterion that can be used to infer a
conditional target index.
- :param set_:
+ :param set\_:
Required argument. A dictionary or other mapping object
with column names as keys and expressions or literals as values,
specifying the ``SET`` actions to take.
diff --git a/lib/sqlalchemy/dialects/postgresql/ext.py b/lib/sqlalchemy/dialects/postgresql/ext.py
index da0c6250c..7f97d6e32 100644
--- a/lib/sqlalchemy/dialects/postgresql/ext.py
+++ b/lib/sqlalchemy/dialects/postgresql/ext.py
@@ -5,11 +5,11 @@
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-from ...sql import expression
+from .array import ARRAY
from ...sql import elements
+from ...sql import expression
from ...sql import functions
from ...sql.schema import ColumnCollectionConstraint
-from .array import ARRAY
class aggregate_order_by(expression.ColumnElement):
@@ -83,9 +83,9 @@ class ExcludeConstraint(ColumnCollectionConstraint):
Defines an EXCLUDE constraint as described in the `postgres
documentation`__.
- __ http://www.postgresql.org/docs/9.0/\
-static/sql-createtable.html#SQL-CREATETABLE-EXCLUDE
- """
+ __ http://www.postgresql.org/docs/9.0/static/sql-createtable.html#SQL-CREATETABLE-EXCLUDE
+
+ """ # noqa
__visit_name__ = "exclude_constraint"
diff --git a/lib/sqlalchemy/dialects/postgresql/hstore.py b/lib/sqlalchemy/dialects/postgresql/hstore.py
index e4bac692a..b1511acd4 100644
--- a/lib/sqlalchemy/dialects/postgresql/hstore.py
+++ b/lib/sqlalchemy/dialects/postgresql/hstore.py
@@ -7,12 +7,13 @@
import re
-from .base import ischema_names
from .array import ARRAY
+from .base import ischema_names
from ... import types as sqltypes
+from ... import util
from ...sql import functions as sqlfunc
from ...sql import operators
-from ... import util
+
__all__ = ("HSTORE", "hstore")
diff --git a/lib/sqlalchemy/dialects/postgresql/json.py b/lib/sqlalchemy/dialects/postgresql/json.py
index f9421de37..1ac040abc 100644
--- a/lib/sqlalchemy/dialects/postgresql/json.py
+++ b/lib/sqlalchemy/dialects/postgresql/json.py
@@ -6,11 +6,12 @@
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from __future__ import absolute_import
-from .base import ischema_names, colspecs
+from .base import colspecs
+from .base import ischema_names
from ... import types as sqltypes
-from ...sql import operators
-from ...sql import elements
from ... import util
+from ...sql import operators
+
__all__ = ("JSON", "JSONB")
@@ -133,8 +134,7 @@ class JSON(sqltypes.JSON):
* Path index operations returning text (the ``#>>`` operator)::
- data_table.c.data[('key_1', 'key_2', 5, ..., 'key_n')].astext == \
-'some value'
+ data_table.c.data[('key_1', 'key_2', 5, ..., 'key_n')].astext == 'some value'
.. versionchanged:: 1.1 The :meth:`.ColumnElement.cast` operator on
JSON objects now requires that the :attr:`.JSON.Comparator.astext`
@@ -164,7 +164,7 @@ class JSON(sqltypes.JSON):
:class:`.JSONB`
- """
+ """ # noqa
astext_type = sqltypes.Text()
diff --git a/lib/sqlalchemy/dialects/postgresql/pg8000.py b/lib/sqlalchemy/dialects/postgresql/pg8000.py
index fef09e0eb..1eb24668b 100644
--- a/lib/sqlalchemy/dialects/postgresql/pg8000.py
+++ b/lib/sqlalchemy/dialects/postgresql/pg8000.py
@@ -4,13 +4,11 @@
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-
-"""
+r"""
.. dialect:: postgresql+pg8000
:name: pg8000
:dbapi: pg8000
- :connectstring: \
-postgresql+pg8000://user:password@host:port/dbname[?key=value&key=value...]
+ :connectstring: postgresql+pg8000://user:password@host:port/dbname[?key=value&key=value...]
:url: https://pythonhosted.org/pg8000/
@@ -63,27 +61,28 @@ of the :ref:`psycopg2 <psycopg2_isolation_level>` dialect:
:ref:`psycopg2_isolation_level`
-"""
-from ... import util, exc
+""" # noqa
import decimal
+import re
+
+from .base import _DECIMAL_TYPES
+from .base import _FLOAT_TYPES
+from .base import _INT_TYPES
+from .base import PGCompiler
+from .base import PGDialect
+from .base import PGExecutionContext
+from .base import PGIdentifierPreparer
+from .base import UUID
+from .json import JSON
+from ... import exc
from ... import processors
from ... import types as sqltypes
-from .base import (
- PGDialect,
- PGCompiler,
- PGIdentifierPreparer,
- PGExecutionContext,
- _DECIMAL_TYPES,
- _FLOAT_TYPES,
- _INT_TYPES,
- UUID,
-)
-import re
-from sqlalchemy.dialects.postgresql.json import JSON
+from ... import util
from ...sql.elements import quoted_name
+
try:
- from uuid import UUID as _python_UUID
+ from uuid import UUID as _python_UUID # noqa
except ImportError:
_python_UUID = None
diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py
index 2c27c6919..30203d204 100644
--- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py
+++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py
@@ -4,7 +4,6 @@
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-
r"""
.. dialect:: postgresql+psycopg2
:name: psycopg2
@@ -77,12 +76,12 @@ in ``/tmp``, or whatever socket directory was specified when PostgreSQL
was built. This value can be overridden by passing a pathname to psycopg2,
using ``host`` as an additional keyword argument::
- create_engine("postgresql+psycopg2://user:password@/dbname?\
-host=/var/lib/postgresql")
+ create_engine("postgresql+psycopg2://user:password@/dbname?host=/var/lib/postgresql")
.. seealso::
- `PQconnectdbParams <http://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-PQCONNECTDBPARAMS>`_
+ `PQconnectdbParams \
+ <http://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-PQCONNECTDBPARAMS>`_
.. _psycopg2_execution_options:
@@ -93,13 +92,13 @@ The following DBAPI-specific options are respected when used with
:meth:`.Connection.execution_options`, :meth:`.Executable.execution_options`,
:meth:`.Query.execution_options`, in addition to those not specific to DBAPIs:
-* ``isolation_level`` - Set the transaction isolation level for the lifespan of a
- :class:`.Connection` (can only be set on a connection, not a statement
+* ``isolation_level`` - Set the transaction isolation level for the lifespan
+ of a :class:`.Connection` (can only be set on a connection, not a statement
or query). See :ref:`psycopg2_isolation_level`.
-* ``stream_results`` - Enable or disable usage of psycopg2 server side cursors -
- this feature makes use of "named" cursors in combination with special
- result handling methods so that result rows are not fully buffered.
+* ``stream_results`` - Enable or disable usage of psycopg2 server side
+ cursors - this feature makes use of "named" cursors in combination with
+ special result handling methods so that result rows are not fully buffered.
If ``None`` or not set, the ``server_side_cursors`` option of the
:class:`.Engine` is used.
@@ -116,7 +115,8 @@ Psycopg2 Batch Mode (Fast Execution)
------------------------------------
Modern versions of psycopg2 include a feature known as
-`Fast Execution Helpers <http://initd.org/psycopg/docs/extras.html#fast-execution-helpers>`_,
+`Fast Execution Helpers \
+<http://initd.org/psycopg/docs/extras.html#fast-execution-helpers>`_,
which have been shown in benchmarking to improve psycopg2's executemany()
performance with INSERTS by multiple orders of magnitude. SQLAlchemy
allows this extension to be used for all ``executemany()`` style calls
@@ -176,10 +176,9 @@ now supported by libpq directly. This is enabled when ``client_encoding``
is passed directly to ``psycopg2.connect()``, and from SQLAlchemy is passed
using the :paramref:`.create_engine.connect_args` parameter::
- # libpq direct parameter setting;
- # only works for PostgreSQL **9.1 and above**
- engine = create_engine("postgresql://user:pass@host/dbname",
- connect_args={'client_encoding': 'utf8'})
+ engine = create_engine(
+ "postgresql://user:pass@host/dbname",
+ connect_args={'client_encoding': 'utf8'})
# using the query string is equivalent
engine = create_engine("postgresql://user:pass@host/dbname?client_encoding=utf8")
@@ -294,8 +293,8 @@ The psycopg2 dialect supports these constants for isolation level:
NOTICE logging
---------------
-The psycopg2 dialect will log PostgreSQL NOTICE messages via the
-``sqlalchemy.dialects.postgresql`` logger::
+The psycopg2 dialect will log PostgreSQL NOTICE messages
+via the ``sqlalchemy.dialects.postgresql`` logger::
import logging
logging.getLogger('sqlalchemy.dialects.postgresql').setLevel(logging.INFO)
@@ -341,34 +340,34 @@ string format, on both the parameter side and the result side, will take
place within SQLAlchemy's own marshalling logic, and not that of ``psycopg2``
which may be more performant.
-"""
+""" # noqa
from __future__ import absolute_import
-import re
+import decimal
import logging
+import re
-from ... import util, exc
-import decimal
+from .base import _DECIMAL_TYPES
+from .base import _FLOAT_TYPES
+from .base import _INT_TYPES
+from .base import ENUM
+from .base import PGCompiler
+from .base import PGDialect
+from .base import PGExecutionContext
+from .base import PGIdentifierPreparer
+from .base import UUID
+from .hstore import HSTORE
+from .json import JSON
+from .json import JSONB
+from ... import exc
from ... import processors
-from ...engine import result as _result
-from ...sql import expression
from ... import types as sqltypes
-from .base import (
- PGDialect,
- PGCompiler,
- PGIdentifierPreparer,
- PGExecutionContext,
- ENUM,
- _DECIMAL_TYPES,
- _FLOAT_TYPES,
- _INT_TYPES,
- UUID,
-)
-from .hstore import HSTORE
-from .json import JSON, JSONB
+from ... import util
+from ...engine import result as _result
+
try:
- from uuid import UUID as _python_UUID
+ from uuid import UUID as _python_UUID # noqa
except ImportError:
_python_UUID = None
@@ -448,7 +447,6 @@ class _PGJSONB(JSONB):
class _PGUUID(UUID):
def bind_processor(self, dialect):
if not self.as_uuid and dialect.use_native_uuid:
- nonetype = type(None)
def process(value):
if value is not None:
diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2cffi.py b/lib/sqlalchemy/dialects/postgresql/psycopg2cffi.py
index 7343bc973..c31527a44 100644
--- a/lib/sqlalchemy/dialects/postgresql/psycopg2cffi.py
+++ b/lib/sqlalchemy/dialects/postgresql/psycopg2cffi.py
@@ -4,13 +4,11 @@
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-"""
+r"""
.. dialect:: postgresql+psycopg2cffi
:name: psycopg2cffi
:dbapi: psycopg2cffi
- :connectstring: \
-postgresql+psycopg2cffi://user:password@host:port/dbname\
-[?key=value&key=value...]
+ :connectstring: postgresql+psycopg2cffi://user:password@host:port/dbname[?key=value&key=value...]
:url: http://pypi.python.org/pypi/psycopg2cffi/
``psycopg2cffi`` is an adaptation of ``psycopg2``, using CFFI for the C
@@ -23,7 +21,7 @@ is as per ``psycopg2``.
:mod:`sqlalchemy.dialects.postgresql.psycopg2`
-"""
+""" # noqa
from .psycopg2 import PGDialect_psycopg2
diff --git a/lib/sqlalchemy/dialects/postgresql/pygresql.py b/lib/sqlalchemy/dialects/postgresql/pygresql.py
index c7edb8fc3..13a3118b5 100644
--- a/lib/sqlalchemy/dialects/postgresql/pygresql.py
+++ b/lib/sqlalchemy/dialects/postgresql/pygresql.py
@@ -4,33 +4,33 @@
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-
"""
.. dialect:: postgresql+pygresql
:name: pygresql
:dbapi: pgdb
- :connectstring: postgresql+pygresql://user:password@host:port/dbname\
-[?key=value&key=value...]
+ :connectstring: postgresql+pygresql://user:password@host:port/dbname[?key=value&key=value...]
:url: http://www.pygresql.org/
-"""
+""" # noqa
import decimal
import re
-from ... import exc, processors, util
-from ...types import Numeric, JSON as Json
-from ...sql.elements import Null
-from .base import (
- PGDialect,
- PGCompiler,
- PGIdentifierPreparer,
- _DECIMAL_TYPES,
- _FLOAT_TYPES,
- _INT_TYPES,
- UUID,
-)
+from .base import _DECIMAL_TYPES
+from .base import _FLOAT_TYPES
+from .base import _INT_TYPES
+from .base import PGCompiler
+from .base import PGDialect
+from .base import PGIdentifierPreparer
+from .base import UUID
from .hstore import HSTORE
-from .json import JSON, JSONB
+from .json import JSON
+from .json import JSONB
+from ... import exc
+from ... import processors
+from ... import util
+from ...sql.elements import Null
+from ...types import JSON as Json
+from ...types import Numeric
class _PGNumeric(Numeric):
diff --git a/lib/sqlalchemy/dialects/postgresql/pypostgresql.py b/lib/sqlalchemy/dialects/postgresql/pypostgresql.py
index 93bf653a4..398ac290d 100644
--- a/lib/sqlalchemy/dialects/postgresql/pypostgresql.py
+++ b/lib/sqlalchemy/dialects/postgresql/pypostgresql.py
@@ -4,21 +4,21 @@
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-
"""
.. dialect:: postgresql+pypostgresql
:name: py-postgresql
:dbapi: pypostgresql
- :connectstring: postgresql+pypostgresql://user:password@host:port/dbname\
-[?key=value&key=value...]
+ :connectstring: postgresql+pypostgresql://user:password@host:port/dbname[?key=value&key=value...]
:url: http://python.projects.pgfoundry.org/
-"""
-from ... import util
-from ... import types as sqltypes
-from .base import PGDialect, PGExecutionContext
+""" # noqa
+
+from .base import PGDialect
+from .base import PGExecutionContext
from ... import processors
+from ... import types as sqltypes
+from ... import util
class PGNumeric(sqltypes.Numeric):
diff --git a/lib/sqlalchemy/dialects/postgresql/ranges.py b/lib/sqlalchemy/dialects/postgresql/ranges.py
index 62d1275a6..9558f7c48 100644
--- a/lib/sqlalchemy/dialects/postgresql/ranges.py
+++ b/lib/sqlalchemy/dialects/postgresql/ranges.py
@@ -7,6 +7,7 @@
from .base import ischema_names
from ... import types as sqltypes
+
__all__ = ("INT4RANGE", "INT8RANGE", "NUMRANGE")
diff --git a/lib/sqlalchemy/dialects/postgresql/zxjdbc.py b/lib/sqlalchemy/dialects/postgresql/zxjdbc.py
index 4d984443a..ab77e5bc8 100644
--- a/lib/sqlalchemy/dialects/postgresql/zxjdbc.py
+++ b/lib/sqlalchemy/dialects/postgresql/zxjdbc.py
@@ -14,8 +14,9 @@
"""
+from .base import PGDialect
+from .base import PGExecutionContext
from ...connectors.zxJDBC import ZxJDBCConnector
-from .base import PGDialect, PGExecutionContext
class PGExecutionContext_zxjdbc(PGExecutionContext):