From 1e1a38e7801f410f244e4bbb44ec795ae152e04e Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 6 Jan 2019 01:14:26 -0500 Subject: 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 --- lib/sqlalchemy/dialects/postgresql/pypostgresql.py | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'lib/sqlalchemy/dialects/postgresql/pypostgresql.py') 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 -- cgit v1.2.1