From: Mike Bayer Date: Wed, 6 Mar 2019 01:29:05 +0000 (-0500) Subject: run a black run X-Git-Tag: rel_1_3_1~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=201c4a60e4b8af56d9c02a3675d1443ba4171c89;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git run a black run fix some pep8s that snuck in Change-Id: Ied282007df30a52d232b1ba88659f2a123ff380f --- diff --git a/lib/sqlalchemy/__init__.py b/lib/sqlalchemy/__init__.py index 788ba0b68c..1df12a8c89 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.1' +__version__ = "1.3.1" def __go(lcls): diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index 1b89a3ac6e..5725b1f05b 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -2545,8 +2545,10 @@ class MySQLDialect(default.DefaultDialect): # but use case-insensitive matching for these two modes in any case. if self._casing in (1, 2): + def lower(s): return s.lower() + else: # if on case sensitive, there can be two tables referenced # with the same name different casing, so we need to use diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index db8d8bcbee..9544b7d117 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -1041,7 +1041,8 @@ class Query(object): raise sa_exc.InvalidRequestError( "Incorrect names of values in identifier to formulate " "primary key for query.get(); primary key attribute names" - " are %s" % ",".join( + " are %s" + % ",".join( "'%s'" % prop.key for prop in mapper._identity_key_props ) diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py index ec3c9790f2..d05adecdbb 100644 --- a/lib/sqlalchemy/orm/strategies.py +++ b/lib/sqlalchemy/orm/strategies.py @@ -595,6 +595,7 @@ class LazyLoader(AbstractRelationshipLoader, util.MemoizedSlots): def visit_bindparam(bindparam): bindparam.unique = False + visitors.traverse(criterion, {}, {"bindparam": visit_bindparam}) def visit_bindparam(bindparam): diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py index efc950f1da..117a9e2292 100644 --- a/lib/sqlalchemy/util/langhelpers.py +++ b/lib/sqlalchemy/util/langhelpers.py @@ -1653,7 +1653,9 @@ def inject_param_text(doctext, inject_params): # TODO: this still wont cover if the code example itself has blank # lines in it, need to detect those via indentation. lines.append(line) - lines.append(doclines.pop(0)) # the blank line following a code example + lines.append( + doclines.pop(0) + ) # the blank line following a code example continue lines.append(line) diff --git a/test/engine/test_parseconnect.py b/test/engine/test_parseconnect.py index b7e8905176..1277425c15 100644 --- a/test/engine/test_parseconnect.py +++ b/test/engine/test_parseconnect.py @@ -148,11 +148,20 @@ class URLTest(fixtures.TestBase): ) def test_comparison(self): - components = ('drivername', 'username', 'password', 'host', - 'database', 'query', 'port') + components = ( + "drivername", + "username", + "password", + "host", + "database", + "query", + "port", + ) - common_url = "dbtype://username:password" \ - "@[2001:da8:2004:1000:202:116:160:90]:80/database?foo=bar" + common_url = ( + "dbtype://username:password" + "@[2001:da8:2004:1000:202:116:160:90]:80/database?foo=bar" + ) other_url = "dbtype://uname:pwd@host/" url1 = url.make_url(common_url) @@ -165,7 +174,7 @@ class URLTest(fixtures.TestBase): is_false(url1 == url3) for curr_component in components: - setattr(url2, curr_component, 'new_changed_value') + setattr(url2, curr_component, "new_changed_value") is_true(url1 != url2) is_false(url1 == url2) setattr(url2, curr_component, getattr(url1, curr_component)) diff --git a/test/engine/test_pool.py b/test/engine/test_pool.py index 45e1362603..1aadd477d9 100644 --- a/test/engine/test_pool.py +++ b/test/engine/test_pool.py @@ -776,8 +776,7 @@ class QueuePoolTest(PoolTestBase): def test_timeout_accessor(self): expected_timeout = 123 - p = self._queuepool_fixture( - timeout=expected_timeout) + p = self._queuepool_fixture(timeout=expected_timeout) eq_(p.timeout(), expected_timeout) @testing.requires.timing_intensive diff --git a/test/orm/test_events.py b/test/orm/test_events.py index d6d087d753..d913f3c774 100644 --- a/test/orm/test_events.py +++ b/test/orm/test_events.py @@ -2004,7 +2004,7 @@ class SessionLifecycleEventsTest(_RemoveListeners, _fixtures.FixtureTest): [call.pending_to_persistent(sess, u1), call.flag_checked(u1)], ) - u1.name = 'u2' + u1.name = "u2" sess.flush() # event was not called again diff --git a/test/orm/test_query.py b/test/orm/test_query.py index 935e3e31c4..8f962d5811 100644 --- a/test/orm/test_query.py +++ b/test/orm/test_query.py @@ -668,9 +668,7 @@ class GetTest(QueryTest): s = Session() q = s.query(CompositePk) assert_raises( - sa_exc.InvalidRequestError, - q.get, - {"i": 1, "j": '2', "k": 3} + sa_exc.InvalidRequestError, q.get, {"i": 1, "j": "2", "k": 3} ) def test_get(self): diff --git a/test/orm/test_unitofwork.py b/test/orm/test_unitofwork.py index d6ca166004..60452ea7fc 100644 --- a/test/orm/test_unitofwork.py +++ b/test/orm/test_unitofwork.py @@ -506,11 +506,7 @@ class ClauseAttributesTest(fixtures.MappedTest): "pk_t", metadata, Column( - "p_id", - Integer, - key="id", - autoincrement=True, - primary_key=True, + "p_id", Integer, key="id", autoincrement=True, primary_key=True ), Column("data", String(30)), ) diff --git a/test/sql/test_insert.py b/test/sql/test_insert.py index cf6715a0e6..f4516f9429 100644 --- a/test/sql/test_insert.py +++ b/test/sql/test_insert.py @@ -1260,12 +1260,7 @@ class MultirowTest(_InsertTestBase, fixtures.TablesTest, AssertsCompiledSQL): table = Table( "sometable", metadata, - Column( - "id", - Integer, - autoincrement=False, - primary_key=True, - ), + Column("id", Integer, autoincrement=False, primary_key=True), Column("data", String), )