From 17413bbf10c3b993d343c28035713a23c745712c Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 11 Apr 2019 14:23:29 -0400 Subject: [PATCH] Black updates Updating for a few black adjustments Change-Id: I9c8abadd1ccd6173e6d68dd62f14cec208cc304a --- lib/sqlalchemy/__init__.py | 2 +- lib/sqlalchemy/dialects/postgresql/psycopg2.py | 2 +- lib/sqlalchemy/orm/util.py | 5 +---- lib/sqlalchemy/sql/util.py | 4 +--- test/dialect/mssql/test_compiler.py | 8 ++++---- test/dialect/postgresql/test_dialect.py | 2 +- 6 files changed, 9 insertions(+), 14 deletions(-) diff --git a/lib/sqlalchemy/__init__.py b/lib/sqlalchemy/__init__.py index 1e42923822..8782ad6832 100644 --- a/lib/sqlalchemy/__init__.py +++ b/lib/sqlalchemy/__init__.py @@ -122,7 +122,7 @@ from .engine import create_engine # noqa nosort from .engine import engine_from_config # noqa nosort -__version__ = '1.3.3' +__version__ = "1.3.3" def __go(lcls): diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py index fb127f1c75..f7c5f668b4 100644 --- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py +++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py @@ -776,7 +776,7 @@ class PGDialect_psycopg2(PGDialect): else: # no connection arguments whatsoever; psycopg2.connect() # requires that "dsn" be present as a blank string. - return ([''], opts) + return ([""], opts) def is_disconnect(self, e, connection, cursor): if isinstance(e, self.dbapi.Error): diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index 7b8edd3493..36da781a41 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -1265,10 +1265,7 @@ def _entity_corresponds_to_use_path_impl(given, entity): return ( entity.is_aliased_class and not entity._use_mapper_path - and ( - given is entity - or given in entity._with_polymorphic_entities - ) + and (given is entity or given in entity._with_polymorphic_entities) ) elif not entity.is_aliased_class: return given.common_parent(entity.mapper) diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py index 8719b26ec2..d90b3f158b 100644 --- a/lib/sqlalchemy/sql/util.py +++ b/lib/sqlalchemy/sql/util.py @@ -156,9 +156,7 @@ def find_left_clause_to_join_from(clauses, join_to, onclause): toremove = set( chain(*[_expand_cloned(f._hide_froms) for f in clauses]) ) - idx = [ - i for i in idx if clauses[i] not in toremove - ] + idx = [i for i in idx if clauses[i] not in toremove] # onclause was given and none of them resolved, so assume # all indexes can match diff --git a/test/dialect/mssql/test_compiler.py b/test/dialect/mssql/test_compiler.py index 26e6d152cc..339cc75907 100644 --- a/test/dialect/mssql/test_compiler.py +++ b/test/dialect/mssql/test_compiler.py @@ -389,8 +389,8 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): ) q = select( - [table1.c.myid, sql.literal('bar').label('c1')], - order_by=[table1.c.name + '-'] + [table1.c.myid, sql.literal("bar").label("c1")], + order_by=[table1.c.name + "-"], ).alias("foo") crit = q.c.myid == table1.c.myid dialect = mssql.dialect() @@ -402,9 +402,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): "myid, ? AS c1 FROM mytable) AS foo, mytable WHERE " "foo.myid = mytable.myid", dialect=dialect, - checkparams={'param_1': 'bar'}, + checkparams={"param_1": "bar"}, # if name_1 is included, too many parameters are passed to dbapi - checkpositional=('bar', ) + checkpositional=("bar",), ) def test_force_schema_quoted_name_w_dot_case_insensitive(self): diff --git a/test/dialect/postgresql/test_dialect.py b/test/dialect/postgresql/test_dialect.py index 1a735c41d3..c68af2abb8 100644 --- a/test/dialect/postgresql/test_dialect.py +++ b/test/dialect/postgresql/test_dialect.py @@ -119,7 +119,7 @@ class DialectTest(fixtures.TestBase): dialect = psycopg2_dialect.dialect() u = url.make_url("postgresql://") cargs, cparams = dialect.create_connect_args(u) - eq_(cargs, ['']) + eq_(cargs, [""]) eq_(cparams, {}) def test_psycopg2_nonempty_connection_string(self): -- 2.47.2