summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/pypostgresql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-01-06 01:14:26 -0500
committermike bayer <mike_mp@zzzcomputing.com>2019-01-06 17:34:50 +0000
commit1e1a38e7801f410f244e4bbb44ec795ae152e04e (patch)
tree28e725c5c8188bd0cfd133d1e268dbca9b524978 /lib/sqlalchemy/dialects/postgresql/pypostgresql.py
parent404e69426b05a82d905cbb3ad33adafccddb00dd (diff)
downloadsqlalchemy-1e1a38e7801f410f244e4bbb44ec795ae152e04e.tar.gz
Run black -l 79 against all source files
This is a straight reformat run using black as is, with no edits applied at all. The black run will format code consistently, however in some cases that are prevalent in SQLAlchemy code it produces too-long lines. The too-long lines will be resolved in the following commit that will resolve all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/pypostgresql.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/pypostgresql.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/pypostgresql.py b/lib/sqlalchemy/dialects/postgresql/pypostgresql.py
index b633323b4..93bf653a4 100644
--- a/lib/sqlalchemy/dialects/postgresql/pypostgresql.py
+++ b/lib/sqlalchemy/dialects/postgresql/pypostgresql.py
@@ -37,12 +37,12 @@ class PGExecutionContext_pypostgresql(PGExecutionContext):
class PGDialect_pypostgresql(PGDialect):
- driver = 'pypostgresql'
+ driver = "pypostgresql"
supports_unicode_statements = True
supports_unicode_binds = True
description_encoding = None
- default_paramstyle = 'pyformat'
+ default_paramstyle = "pyformat"
# requires trunk version to support sane rowcounts
# TODO: use dbapi version information to set this flag appropriately
@@ -54,22 +54,27 @@ class PGDialect_pypostgresql(PGDialect):
PGDialect.colspecs,
{
sqltypes.Numeric: PGNumeric,
-
# prevents PGNumeric from being used
sqltypes.Float: sqltypes.Float,
- }
+ },
)
@classmethod
def dbapi(cls):
from postgresql.driver import dbapi20
+
return dbapi20
_DBAPI_ERROR_NAMES = [
"Error",
- "InterfaceError", "DatabaseError", "DataError",
- "OperationalError", "IntegrityError", "InternalError",
- "ProgrammingError", "NotSupportedError"
+ "InterfaceError",
+ "DatabaseError",
+ "DataError",
+ "OperationalError",
+ "IntegrityError",
+ "InternalError",
+ "ProgrammingError",
+ "NotSupportedError",
]
@util.memoized_property
@@ -83,15 +88,16 @@ class PGDialect_pypostgresql(PGDialect):
)
def create_connect_args(self, url):
- opts = url.translate_connect_args(username='user')
- if 'port' in opts:
- opts['port'] = int(opts['port'])
+ opts = url.translate_connect_args(username="user")
+ if "port" in opts:
+ opts["port"] = int(opts["port"])
else:
- opts['port'] = 5432
+ opts["port"] = 5432
opts.update(url.query)
return ([], opts)
def is_disconnect(self, e, connection, cursor):
return "connection is closed" in str(e)
+
dialect = PGDialect_pypostgresql