From 146a349d81023805264f81643db50a5281da90da Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 5 Jan 2022 12:41:32 -0500 Subject: [PATCH] Update Black's target-version to py37 ### Description Black's `target-version` was still set to `['py27', 'py36']`. Set it to `[py37]` instead. Also update Black and other pre-commit hooks and re-format with Black. ### Checklist This pull request is: - [ ] A documentation / typographical error fix - Good to go, no issue or tests are needed - [ ] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [ ] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #` in the commit message - please include tests. **Have a nice day!** Closes: #7536 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7536 Pull-request-sha: b3aedf5570d7e0ba6c354e5989835260d0591b08 Change-Id: I8be85636fd2c9449b07a8626050c8bd35bd119d5 --- .pre-commit-config.yaml | 10 ++-- doc/build/conf.py | 16 +++---- examples/versioned_history/history_meta.py | 2 +- lib/sqlalchemy/dialects/mssql/base.py | 8 ++-- lib/sqlalchemy/dialects/mysql/base.py | 2 +- lib/sqlalchemy/dialects/mysql/types.py | 2 +- lib/sqlalchemy/dialects/oracle/base.py | 10 ++-- lib/sqlalchemy/dialects/oracle/cx_oracle.py | 6 +-- .../dialects/postgresql/_psycopg_common.py | 2 +- lib/sqlalchemy/dialects/postgresql/base.py | 2 +- lib/sqlalchemy/dialects/postgresql/ext.py | 4 +- .../dialects/postgresql/psycopg2.py | 4 +- lib/sqlalchemy/dialects/sqlite/base.py | 4 +- lib/sqlalchemy/engine/base.py | 2 +- lib/sqlalchemy/engine/default.py | 2 +- lib/sqlalchemy/engine/interfaces.py | 22 ++++----- lib/sqlalchemy/engine/processors.py | 1 - lib/sqlalchemy/engine/reflection.py | 8 ++-- lib/sqlalchemy/ext/asyncio/session.py | 20 ++++---- lib/sqlalchemy/ext/automap.py | 4 +- lib/sqlalchemy/ext/horizontal_shard.py | 8 ++-- lib/sqlalchemy/ext/mypy/util.py | 4 +- lib/sqlalchemy/orm/attributes.py | 8 ++-- lib/sqlalchemy/orm/context.py | 6 +-- lib/sqlalchemy/orm/decl_base.py | 2 +- lib/sqlalchemy/orm/dynamic.py | 2 +- lib/sqlalchemy/orm/events.py | 2 +- lib/sqlalchemy/orm/loading.py | 4 +- lib/sqlalchemy/orm/properties.py | 2 +- lib/sqlalchemy/orm/relationships.py | 2 +- lib/sqlalchemy/orm/session.py | 12 ++--- lib/sqlalchemy/orm/strategies.py | 18 ++++---- lib/sqlalchemy/orm/util.py | 2 +- lib/sqlalchemy/pool/impl.py | 2 +- lib/sqlalchemy/sql/coercions.py | 10 ++-- lib/sqlalchemy/sql/compiler.py | 46 +++++++++---------- lib/sqlalchemy/sql/crud.py | 8 ++-- lib/sqlalchemy/sql/default_comparator.py | 6 +-- lib/sqlalchemy/sql/dml.py | 6 +-- lib/sqlalchemy/sql/elements.py | 12 ++--- lib/sqlalchemy/sql/functions.py | 4 +- lib/sqlalchemy/sql/lambdas.py | 2 +- lib/sqlalchemy/sql/schema.py | 34 +++++++------- lib/sqlalchemy/sql/selectable.py | 6 +-- lib/sqlalchemy/sql/sqltypes.py | 2 +- lib/sqlalchemy/testing/plugin/pytestplugin.py | 2 +- lib/sqlalchemy/testing/suite/test_dialect.py | 2 +- .../testing/suite/test_reflection.py | 4 +- lib/sqlalchemy/testing/util.py | 2 +- pyproject.toml | 2 +- test/aaa_profiling/test_memusage.py | 2 +- test/aaa_profiling/test_orm.py | 30 ++++++------ test/aaa_profiling/test_resultset.py | 4 +- test/dialect/mssql/test_reflection.py | 6 +-- test/dialect/mysql/test_reflection.py | 2 +- test/dialect/oracle/test_dialect.py | 2 +- test/dialect/oracle/test_types.py | 8 ++-- test/dialect/postgresql/test_async_pg_py3k.py | 2 +- test/dialect/postgresql/test_dialect.py | 8 ++-- test/dialect/postgresql/test_reflection.py | 8 ++-- test/dialect/postgresql/test_types.py | 12 ++--- test/dialect/test_sqlite.py | 4 +- test/engine/test_parseconnect.py | 4 +- test/engine/test_reconnect.py | 2 +- test/engine/test_reflection.py | 5 +- test/ext/test_associationproxy.py | 2 +- test/ext/test_automap.py | 2 +- test/ext/test_baked.py | 4 +- test/ext/test_horizontal_shard.py | 2 +- test/orm/inheritance/test_poly_persistence.py | 10 ++-- test/orm/test_attributes.py | 2 +- test/orm/test_inspect.py | 2 +- test/orm/test_rel_fn.py | 42 ++++++++--------- test/orm/test_relationship_criteria.py | 4 +- test/orm/test_relationships.py | 16 +++---- test/sql/test_constraints.py | 2 +- test/sql/test_deprecations.py | 2 +- test/sql/test_metadata.py | 2 +- test/sql/test_quote.py | 8 ++-- test/sql/test_text.py | 2 +- test/sql/test_types.py | 6 +-- test/sql/test_update.py | 2 +- tox.ini | 4 +- 83 files changed, 284 insertions(+), 282 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ae35977b9d..80138c26a1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,27 +2,27 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/python/black - rev: 21.5b1 + rev: 21.12b0 hooks: - id: black - repo: https://github.com/sqlalchemyorg/zimports - rev: v0.4.0 + rev: v0.4.1 hooks: - id: zimports args: - --keep-unused-type-checking - repo: https://github.com/pycqa/flake8 - rev: 3.9.2 + rev: 4.0.1 hooks: - id: flake8 additional_dependencies: - flake8-import-order - flake8-builtins - - flake8-docstrings>=1.3.1 + - flake8-docstrings>=1.6.0 - flake8-rst-docstrings - # flake8-rst-docstrings depdendency, leaving it here + # flake8-rst-docstrings dependency, leaving it here # in case it requires a version pin - pydocstyle - pygments diff --git a/doc/build/conf.py b/doc/build/conf.py index cba0fee6ab..6f5a83b969 100644 --- a/doc/build/conf.py +++ b/doc/build/conf.py @@ -196,8 +196,8 @@ zzzeeksphinx_module_prefixes = { master_doc = "contents" # General information about the project. -project = u"SQLAlchemy" -copyright = u"2007-2021, the SQLAlchemy authors and contributors" # noqa +project = "SQLAlchemy" +copyright = "2007-2021, the SQLAlchemy authors and contributors" # noqa # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -401,8 +401,8 @@ man_pages = [ ( "index", "sqlalchemy", - u"SQLAlchemy Documentation", - [u"SQLAlchemy authors"], + "SQLAlchemy Documentation", + ["SQLAlchemy authors"], 1, ) ] @@ -411,10 +411,10 @@ man_pages = [ # -- Options for Epub output ------------------------------------------------- # Bibliographic Dublin Core info. -epub_title = u"SQLAlchemy" -epub_author = u"SQLAlchemy authors" -epub_publisher = u"SQLAlchemy authors" -epub_copyright = u"2007-2015, SQLAlchemy authors" +epub_title = "SQLAlchemy" +epub_author = "SQLAlchemy authors" +epub_publisher = "SQLAlchemy authors" +epub_copyright = "2007-2015, SQLAlchemy authors" # The language of the text. It defaults to the language option # or en if the language is not set. diff --git a/examples/versioned_history/history_meta.py b/examples/versioned_history/history_meta.py index 214f75e6b6..23bdc1e6f8 100644 --- a/examples/versioned_history/history_meta.py +++ b/examples/versioned_history/history_meta.py @@ -128,7 +128,7 @@ def _history_mapper(local_mapper): local_mapper.local_table.name + "_history", local_mapper.local_table.metadata, *cols, - schema=local_mapper.local_table.schema + schema=local_mapper.local_table.schema, ) else: # single table inheritance. take any additional columns that may have diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index 48288619ee..e2ffbeb09e 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -2047,7 +2047,7 @@ class MSSQLCompiler(compiler.SQLCompiler): expression.BinaryExpression( binary.right, binary.left, binary.operator ), - **kwargs + **kwargs, ) return super(MSSQLCompiler, self).visit_binary(binary, **kwargs) @@ -2540,7 +2540,7 @@ def _db_plus_owner_listing(fn): dbname, owner, schema, - **kw + **kw, ) return update_wrapper(wrap, fn) @@ -2559,7 +2559,7 @@ def _db_plus_owner(fn): dbname, owner, schema, - **kw + **kw, ) return update_wrapper(wrap, fn) @@ -2727,7 +2727,7 @@ class MSDialect(default.DefaultDialect): json_serializer=None, json_deserializer=None, legacy_schema_aliasing=None, - **opts + **opts, ): self.query_timeout = int(query_timeout or 0) self.schema_name = schema_name diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index f20b9b6931..2913944f27 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -2390,7 +2390,7 @@ class MySQLDialect(default.DefaultDialect): json_serializer=None, json_deserializer=None, is_mariadb=None, - **kwargs + **kwargs, ): kwargs.pop("use_ansiquotes", None) # legacy default.DefaultDialect.__init__(self, **kwargs) diff --git a/lib/sqlalchemy/dialects/mysql/types.py b/lib/sqlalchemy/dialects/mysql/types.py index abbf943a9a..07a67e2a49 100644 --- a/lib/sqlalchemy/dialects/mysql/types.py +++ b/lib/sqlalchemy/dialects/mysql/types.py @@ -74,7 +74,7 @@ class _StringType(sqltypes.String): binary=False, unicode=False, national=False, - **kw + **kw, ): self.charset = charset diff --git a/lib/sqlalchemy/dialects/oracle/base.py b/lib/sqlalchemy/dialects/oracle/base.py index 94feeefcea..1488fc0052 100644 --- a/lib/sqlalchemy/dialects/oracle/base.py +++ b/lib/sqlalchemy/dialects/oracle/base.py @@ -1497,7 +1497,7 @@ class OracleDialect(default.DefaultDialect): use_binds_for_limits=None, use_nchar_for_unicode=False, exclude_tablespaces=("SYSTEM", "SYSAUX"), - **kwargs + **kwargs, ): default.DefaultDialect.__init__(self, **kwargs) self._use_nchar_for_unicode = use_nchar_for_unicode @@ -1711,7 +1711,7 @@ class OracleDialect(default.DefaultDialect): schema=None, resolve_synonyms=False, dblink="", - **kw + **kw, ): if resolve_synonyms: @@ -2053,7 +2053,7 @@ class OracleDialect(default.DefaultDialect): schema=None, resolve_synonyms=False, dblink="", - **kw + **kw, ): info_cache = kw.get("info_cache") @@ -2090,7 +2090,7 @@ class OracleDialect(default.DefaultDialect): schema=None, resolve_synonyms=False, dblink="", - **kw + **kw, ): info_cache = kw.get("info_cache") @@ -2433,7 +2433,7 @@ class OracleDialect(default.DefaultDialect): schema=None, resolve_synonyms=False, dblink="", - **kw + **kw, ): info_cache = kw.get("info_cache") (view_name, schema, dblink, synonym) = self._prepare_reflection_args( diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py index 9b097fb0e9..153be56106 100644 --- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py +++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py @@ -883,7 +883,7 @@ class OracleDialect_cx_oracle(OracleDialect): arraysize=50, encoding_errors=None, threaded=None, - **kwargs + **kwargs, ): OracleDialect.__init__(self, **kwargs) @@ -1123,7 +1123,7 @@ class OracleDialect_cx_oracle(OracleDialect): str, size, cursor.arraysize, - **dialect._cursor_var_unicode_kwargs + **dialect._cursor_var_unicode_kwargs, ) elif dialect.auto_convert_lobs and default_type in ( @@ -1134,7 +1134,7 @@ class OracleDialect_cx_oracle(OracleDialect): cx_Oracle.LONG_STRING, size, cursor.arraysize, - **dialect._cursor_var_unicode_kwargs + **dialect._cursor_var_unicode_kwargs, ) elif dialect.auto_convert_lobs and default_type in ( diff --git a/lib/sqlalchemy/dialects/postgresql/_psycopg_common.py b/lib/sqlalchemy/dialects/postgresql/_psycopg_common.py index 265d8617e1..7f936fefbf 100644 --- a/lib/sqlalchemy/dialects/postgresql/_psycopg_common.py +++ b/lib/sqlalchemy/dialects/postgresql/_psycopg_common.py @@ -114,7 +114,7 @@ class _PGDialect_common_psycopg(PGDialect): client_encoding=None, use_native_hstore=True, use_native_uuid=True, - **kwargs + **kwargs, ): PGDialect.__init__(self, **kwargs) if not use_native_hstore: diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 869e48bd41..107288a73e 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -3935,7 +3935,7 @@ class PGDialect(default.DefaultDialect): table_name, schema=None, postgresql_ignore_search_path=False, - **kw + **kw, ): preparer = self.identifier_preparer table_oid = self.get_table_oid( diff --git a/lib/sqlalchemy/dialects/postgresql/ext.py b/lib/sqlalchemy/dialects/postgresql/ext.py index e323da8bec..1eabed4030 100644 --- a/lib/sqlalchemy/dialects/postgresql/ext.py +++ b/lib/sqlalchemy/dialects/postgresql/ext.py @@ -221,7 +221,7 @@ class ExcludeConstraint(ColumnCollectionConstraint): *columns, name=kw.get("name"), deferrable=kw.get("deferrable"), - initially=kw.get("initially") + initially=kw.get("initially"), ) self.using = kw.get("using", "gist") where = kw.get("where") @@ -258,7 +258,7 @@ class ExcludeConstraint(ColumnCollectionConstraint): deferrable=self.deferrable, initially=self.initially, where=self.where, - using=self.using + using=self.using, ) c.dispatch._update(self.dispatch) return c diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py index 0bbad3257c..d670d1a508 100644 --- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py +++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py @@ -558,7 +558,7 @@ class PGDialect_psycopg2(_PGDialect_common_psycopg): executemany_mode="values_only", executemany_batch_page_size=100, executemany_values_page_size=1000, - **kwargs + **kwargs, ): _PGDialect_common_psycopg.__init__(self, **kwargs) @@ -737,7 +737,7 @@ class PGDialect_psycopg2(_PGDialect_common_psycopg): parameters, template=executemany_values, fetch=bool(context.compiled.returning), - **kwargs + **kwargs, ) elif self.executemany_mode & EXECUTEMANY_BATCH: diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py index 927c35135e..cb607b58d6 100644 --- a/lib/sqlalchemy/dialects/sqlite/base.py +++ b/lib/sqlalchemy/dialects/sqlite/base.py @@ -1864,7 +1864,7 @@ class SQLiteDialect(default.DefaultDialect): json_deserializer=None, _json_serializer=None, _json_deserializer=None, - **kwargs + **kwargs, ): default.DefaultDialect.__init__(self, **kwargs) @@ -2377,7 +2377,7 @@ class SQLiteDialect(default.DefaultDialect): table_name, schema=schema, include_auto_indexes=True, - **kw + **kw, ): if not idx["name"].startswith("sqlite_autoindex"): continue diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 4f85354472..4a7ad9a181 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -1455,7 +1455,7 @@ class Connection(ConnectionEventsTarget): parameters, execution_options, *args, - **kw + **kw, ): """Create an :class:`.ExecutionContext` and execute, returning a :class:`_engine.CursorResult`.""" diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 779939be81..1560b3a8e7 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -258,7 +258,7 @@ class DefaultDialect(interfaces.Dialect): # the direct reference to the "NO_LINTING" object compiler_linting=int(compiler.NO_LINTING), server_side_cursors=False, - **kwargs + **kwargs, ): if server_side_cursors: diff --git a/lib/sqlalchemy/engine/interfaces.py b/lib/sqlalchemy/engine/interfaces.py index 90e0ea5d2d..37512fc7e4 100644 --- a/lib/sqlalchemy/engine/interfaces.py +++ b/lib/sqlalchemy/engine/interfaces.py @@ -729,7 +729,7 @@ class Dialect: connection: "Connection", table_name: str, schema: Optional[str] = None, - **kw + **kw, ) -> List[ReflectedColumn]: """Return information about columns in ``table_name``. @@ -747,7 +747,7 @@ class Dialect: connection: "Connection", table_name: str, schema: Optional[str] = None, - **kw: Any + **kw: Any, ) -> ReflectedPrimaryKeyConstraint: """Return information about the primary key constraint on table_name`. @@ -766,7 +766,7 @@ class Dialect: connection: "Connection", table_name: str, schema: Optional[str] = None, - **kw: Any + **kw: Any, ) -> List[ReflectedForeignKeyConstraint]: """Return information about foreign_keys in ``table_name``. @@ -833,7 +833,7 @@ class Dialect: connection: "Connection", view_name: str, schema: Optional[str] = None, - **kw: Any + **kw: Any, ) -> str: """Return view definition. @@ -849,7 +849,7 @@ class Dialect: connection: "Connection", table_name: str, schema: Optional[str] = None, - **kw: Any + **kw: Any, ) -> List[ReflectedIndex]: """Return information about indexes in ``table_name``. @@ -867,7 +867,7 @@ class Dialect: connection: "Connection", table_name: str, schema: Optional[str] = None, - **kw: Any + **kw: Any, ) -> List[ReflectedUniqueConstraint]: r"""Return information about unique constraints in ``table_name``. @@ -884,7 +884,7 @@ class Dialect: connection: "Connection", table_name: str, schema: Optional[str] = None, - **kw: Any + **kw: Any, ) -> List[ReflectedCheckConstraint]: r"""Return information about check constraints in ``table_name``. @@ -901,7 +901,7 @@ class Dialect: connection: "Connection", table_name: str, schema: Optional[str] = None, - **kw: Any + **kw: Any, ) -> Dict[str, Any]: r"""Return the "options" for the table identified by ``table_name`` as a dictionary. @@ -913,7 +913,7 @@ class Dialect: connection: "Connection", table_name: str, schema: Optional[str] = None, - **kw: Any + **kw: Any, ) -> ReflectedTableComment: r"""Return the "comment" for the table identified by ``table_name``. @@ -956,7 +956,7 @@ class Dialect: connection: "Connection", table_name: str, schema: Optional[str] = None, - **kw: Any + **kw: Any, ) -> bool: """For internal dialect use, check the existence of a particular table or view in the database. @@ -1017,7 +1017,7 @@ class Dialect: connection: "Connection", sequence_name: str, schema: Optional[str] = None, - **kw: Any + **kw: Any, ) -> bool: """Check the existence of a particular sequence in the database. diff --git a/lib/sqlalchemy/engine/processors.py b/lib/sqlalchemy/engine/processors.py index 023444d100..e05d1b0a4c 100644 --- a/lib/sqlalchemy/engine/processors.py +++ b/lib/sqlalchemy/engine/processors.py @@ -33,7 +33,6 @@ try: # return Decimal('5'). These are equivalent of course. return DecimalResultProcessor(target_class, "%%.%df" % scale).process - except ImportError: from ._py_processors import int_to_boolean # noqa from ._py_processors import str_to_date # noqa diff --git a/lib/sqlalchemy/engine/reflection.py b/lib/sqlalchemy/engine/reflection.py index 562130f77b..e1b06a3149 100644 --- a/lib/sqlalchemy/engine/reflection.py +++ b/lib/sqlalchemy/engine/reflection.py @@ -960,7 +960,7 @@ class Inspector: schema=referred_schema, autoload_with=self.bind, _extend_on=_extend_on, - **reflection_options + **reflection_options, ) for column in referred_columns: refspec.append( @@ -974,7 +974,7 @@ class Inspector: autoload_with=self.bind, schema=sa_schema.BLANK_SCHEMA, _extend_on=_extend_on, - **reflection_options + **reflection_options, ) for column in referred_columns: refspec.append(".".join([referred_table, column])) @@ -988,7 +988,7 @@ class Inspector: refspec, conname, link_to_name=True, - **options + **options, ) ) @@ -1054,7 +1054,7 @@ class Inspector: name, *idx_cols, _table=table, - **dict(list(dialect_options.items()) + [("unique", unique)]) + **dict(list(dialect_options.items()) + [("unique", unique)]), ) def _reflect_unique_constraints( diff --git a/lib/sqlalchemy/ext/asyncio/session.py b/lib/sqlalchemy/ext/asyncio/session.py index 9beba2ee0d..3b53585ddb 100644 --- a/lib/sqlalchemy/ext/asyncio/session.py +++ b/lib/sqlalchemy/ext/asyncio/session.py @@ -190,7 +190,7 @@ class AsyncSession(ReversibleProxy): params=None, execution_options=util.EMPTY_DICT, bind_arguments=None, - **kw + **kw, ): """Execute a statement and return a buffered :class:`_engine.Result` object. @@ -214,7 +214,7 @@ class AsyncSession(ReversibleProxy): params=params, execution_options=execution_options, bind_arguments=bind_arguments, - **kw + **kw, ) async def scalar( @@ -223,7 +223,7 @@ class AsyncSession(ReversibleProxy): params=None, execution_options=util.EMPTY_DICT, bind_arguments=None, - **kw + **kw, ): """Execute a statement and return a scalar result. @@ -238,7 +238,7 @@ class AsyncSession(ReversibleProxy): params=params, execution_options=execution_options, bind_arguments=bind_arguments, - **kw + **kw, ) return result.scalar() @@ -248,7 +248,7 @@ class AsyncSession(ReversibleProxy): params=None, execution_options=util.EMPTY_DICT, bind_arguments=None, - **kw + **kw, ): """Execute a statement and return scalar results. @@ -269,7 +269,7 @@ class AsyncSession(ReversibleProxy): params=params, execution_options=execution_options, bind_arguments=bind_arguments, - **kw + **kw, ) return result.scalars() @@ -307,7 +307,7 @@ class AsyncSession(ReversibleProxy): params=None, execution_options=util.EMPTY_DICT, bind_arguments=None, - **kw + **kw, ): """Execute a statement and return a streaming :class:`_asyncio.AsyncResult` object.""" @@ -325,7 +325,7 @@ class AsyncSession(ReversibleProxy): params=params, execution_options=execution_options, bind_arguments=bind_arguments, - **kw + **kw, ) return _result.AsyncResult(result) @@ -335,7 +335,7 @@ class AsyncSession(ReversibleProxy): params=None, execution_options=util.EMPTY_DICT, bind_arguments=None, - **kw + **kw, ): """Execute a statement and return a stream of scalar results. @@ -356,7 +356,7 @@ class AsyncSession(ReversibleProxy): params=params, execution_options=execution_options, bind_arguments=bind_arguments, - **kw + **kw, ) return result.scalars() diff --git a/lib/sqlalchemy/ext/automap.py b/lib/sqlalchemy/ext/automap.py index b62c514c7b..d0ead6179e 100644 --- a/lib/sqlalchemy/ext/automap.py +++ b/lib/sqlalchemy/ext/automap.py @@ -1082,7 +1082,7 @@ def _relationships_for_fks( referred_cls, local_cls, collection_class=collection_class, - **o2m_kws + **o2m_kws, ) else: backref_obj = None @@ -1114,7 +1114,7 @@ def _relationships_for_fks( foreign_keys=[fk.parent for fk in constraint.elements], back_populates=relationship_name, collection_class=collection_class, - **o2m_kws + **o2m_kws, ) if rel is not None: referred_cfg.properties[backref_name] = rel diff --git a/lib/sqlalchemy/ext/horizontal_shard.py b/lib/sqlalchemy/ext/horizontal_shard.py index 5f13ad2689..71159de156 100644 --- a/lib/sqlalchemy/ext/horizontal_shard.py +++ b/lib/sqlalchemy/ext/horizontal_shard.py @@ -59,7 +59,7 @@ class ShardedSession(Session): execute_chooser=None, shards=None, query_cls=ShardedQuery, - **kwargs + **kwargs, ): """Construct a ShardedSession. @@ -125,7 +125,7 @@ class ShardedSession(Session): primary_key_identity, identity_token=None, lazy_loaded_from=None, - **kw + **kw, ): """override the default :meth:`.Session._identity_lookup` method so that we search for a given non-token primary key identity across all @@ -141,7 +141,7 @@ class ShardedSession(Session): mapper, primary_key_identity, identity_token=identity_token, - **kw + **kw, ) else: q = self.query(mapper) @@ -153,7 +153,7 @@ class ShardedSession(Session): primary_key_identity, identity_token=shard_id, lazy_loaded_from=lazy_loaded_from, - **kw + **kw, ) if obj is not None: return obj diff --git a/lib/sqlalchemy/ext/mypy/util.py b/lib/sqlalchemy/ext/mypy/util.py index 4d55cb7283..595c1d2a7f 100644 --- a/lib/sqlalchemy/ext/mypy/util.py +++ b/lib/sqlalchemy/ext/mypy/util.py @@ -193,7 +193,7 @@ def get_callexpr_kwarg( callexpr: CallExpr, name: str, *, - expr_types: Tuple[TypingType[_TArgType], ...] + expr_types: Tuple[TypingType[_TArgType], ...], ) -> Optional[_TArgType]: ... @@ -202,7 +202,7 @@ def get_callexpr_kwarg( callexpr: CallExpr, name: str, *, - expr_types: Optional[Tuple[TypingType[Any], ...]] = None + expr_types: Optional[Tuple[TypingType[Any], ...]] = None, ) -> Optional[Any]: try: arg_idx = callexpr.arg_names.index(name) diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index dce008a67b..09d45bef7f 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -701,7 +701,7 @@ class AttributeImpl: load_on_unexpire=True, send_modified_events=True, accepts_scalar_loader=None, - **kwargs + **kwargs, ): r"""Construct an AttributeImpl. @@ -1318,7 +1318,7 @@ class CollectionAttributeImpl(AttributeImpl): trackparent=False, copy_function=None, compare_function=None, - **kwargs + **kwargs, ): super(CollectionAttributeImpl, self).__init__( class_, @@ -1327,7 +1327,7 @@ class CollectionAttributeImpl(AttributeImpl): dispatch, trackparent=trackparent, compare_function=compare_function, - **kwargs + **kwargs, ) if copy_function is None: @@ -2081,7 +2081,7 @@ def register_attribute_impl( useobject=False, impl_class=None, backref=None, - **kw + **kw, ): manager = manager_of_class(class_) diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py index 0c1d16d0e2..012db36c2c 100644 --- a/lib/sqlalchemy/orm/context.py +++ b/lib/sqlalchemy/orm/context.py @@ -1043,7 +1043,7 @@ class ORMSelectCompileState(ORMCompileState, SelectState): statement_hints=self.select_statement._statement_hints, correlate=self.correlate, correlate_except=self.correlate_except, - **self._select_args + **self._select_args, ) inner = inner.alias() @@ -1083,7 +1083,7 @@ class ORMSelectCompileState(ORMCompileState, SelectState): statement, *self.compound_eager_adapter.copy_and_process( unwrapped_order_by - ) + ), ) statement.order_by.non_generative(statement, *self.eager_order_by) @@ -1121,7 +1121,7 @@ class ORMSelectCompileState(ORMCompileState, SelectState): statement_hints=self.select_statement._statement_hints, correlate=self.correlate, correlate_except=self.correlate_except, - **self._select_args + **self._select_args, ) if self.eager_order_by: diff --git a/lib/sqlalchemy/orm/decl_base.py b/lib/sqlalchemy/orm/decl_base.py index b92ae5aa48..b6d0a19cd0 100644 --- a/lib/sqlalchemy/orm/decl_base.py +++ b/lib/sqlalchemy/orm/decl_base.py @@ -810,7 +810,7 @@ class _ClassScanMapperConfig(_MapperConfig): tablename, self._metadata_for_cls(manager), *(tuple(declared_columns) + tuple(args)), - **table_kw + **table_kw, ), ) else: diff --git a/lib/sqlalchemy/orm/dynamic.py b/lib/sqlalchemy/orm/dynamic.py index 67deb3b019..2febb4f020 100644 --- a/lib/sqlalchemy/orm/dynamic.py +++ b/lib/sqlalchemy/orm/dynamic.py @@ -77,7 +77,7 @@ class DynamicAttributeImpl(attributes.AttributeImpl): target_mapper, order_by, query_class=None, - **kw + **kw, ): super(DynamicAttributeImpl, self).__init__( class_, key, typecallable, dispatch, **kw diff --git a/lib/sqlalchemy/orm/events.py b/lib/sqlalchemy/orm/events.py index b358b8be35..a66bf64d8c 100644 --- a/lib/sqlalchemy/orm/events.py +++ b/lib/sqlalchemy/orm/events.py @@ -219,7 +219,7 @@ class InstanceEvents(event.Events): raw=False, propagate=False, restore_load_context=False, - **kw + **kw, ): target, fn = (event_key.dispatch_target, event_key._listen_fn) diff --git a/lib/sqlalchemy/orm/loading.py b/lib/sqlalchemy/orm/loading.py index a37d83cfea..047971d356 100644 --- a/lib/sqlalchemy/orm/loading.py +++ b/lib/sqlalchemy/orm/loading.py @@ -583,7 +583,7 @@ def _setup_entity_query( with_polymorphic=None, only_load_props=None, polymorphic_discriminator=None, - **kw + **kw, ): if with_polymorphic: @@ -616,7 +616,7 @@ def _setup_entity_query( column_collection=column_collection, memoized_populators=quick_populators, check_for_adapt=check_for_adapt, - **kw + **kw, ) if ( diff --git a/lib/sqlalchemy/orm/properties.py b/lib/sqlalchemy/orm/properties.py index 04b7f89c2b..9e7dfeeedf 100644 --- a/lib/sqlalchemy/orm/properties.py +++ b/lib/sqlalchemy/orm/properties.py @@ -291,7 +291,7 @@ class ColumnProperty(StrategizedProperty): deferred=self.deferred, group=self.group, active_history=self.active_history, - *self.columns + *self.columns, ) def _getcommitted( diff --git a/lib/sqlalchemy/orm/relationships.py b/lib/sqlalchemy/orm/relationships.py index a597d9c4f7..dd58c0201d 100644 --- a/lib/sqlalchemy/orm/relationships.py +++ b/lib/sqlalchemy/orm/relationships.py @@ -2482,7 +2482,7 @@ class RelationshipProperty(StrategizedProperty): sj, foreign_keys=foreign_keys, back_populates=self.key, - **kwargs + **kwargs, ) mapper._configure_property(backref_key, relationship) diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index fdab20405c..62e5604756 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -1490,7 +1490,7 @@ class Session(_SessionClassMethods): bind_arguments=None, _parent_execute_state=None, _add_event=None, - **kw + **kw, ): r"""Execute a SQL expression construct. @@ -1647,7 +1647,7 @@ class Session(_SessionClassMethods): params=None, execution_options=util.EMPTY_DICT, bind_arguments=None, - **kw + **kw, ): """Execute a statement and return a scalar result. @@ -1662,7 +1662,7 @@ class Session(_SessionClassMethods): params=params, execution_options=execution_options, bind_arguments=bind_arguments, - **kw + **kw, ).scalar() def scalars( @@ -1671,7 +1671,7 @@ class Session(_SessionClassMethods): params=None, execution_options=util.EMPTY_DICT, bind_arguments=None, - **kw + **kw, ): """Execute a statement and return the results as scalars. @@ -1691,7 +1691,7 @@ class Session(_SessionClassMethods): params=params, execution_options=execution_options, bind_arguments=bind_arguments, - **kw + **kw, ).scalars() def close(self): @@ -3974,7 +3974,7 @@ class sessionmaker(_SessionClassMethods): autoflush=True, expire_on_commit=True, info=None, - **kw + **kw, ): r"""Construct a new :class:`.sessionmaker`. diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py index 844b0f007a..bb42927e20 100644 --- a/lib/sqlalchemy/orm/strategies.py +++ b/lib/sqlalchemy/orm/strategies.py @@ -57,7 +57,7 @@ def _register_attribute( proxy_property=None, active_history=False, impl_class=None, - **kw + **kw, ): listen_hooks = [] @@ -123,7 +123,7 @@ def _register_attribute( impl_class=impl_class, send_modified_events=not useobject or not prop.viewonly, doc=prop.doc, - **kw + **kw, ) for hook in listen_hooks: @@ -153,7 +153,7 @@ class UninstrumentedColumnLoader(LoaderStrategy): loadopt, adapter, column_collection=None, - **kwargs + **kwargs, ): for c in self.columns: if adapter: @@ -196,7 +196,7 @@ class ColumnLoader(LoaderStrategy): column_collection, memoized_populators, check_for_adapt=False, - **kwargs + **kwargs, ): for c in self.columns: if adapter: @@ -283,7 +283,7 @@ class ExpressionColumnLoader(ColumnLoader): adapter, column_collection, memoized_populators, - **kwargs + **kwargs, ): columns = None if loadopt and "expression" in loadopt.local_opts: @@ -437,7 +437,7 @@ class DeferredColumnLoader(LoaderStrategy): column_collection, memoized_populators, only_load_props=None, - **kw + **kw, ): if ( @@ -471,7 +471,7 @@ class DeferredColumnLoader(LoaderStrategy): adapter, column_collection, memoized_populators, - **kw + **kw, ) elif self.is_class_level: memoized_populators[self.parent_property] = _SET_DEFERRED_EXPIRED @@ -1350,7 +1350,7 @@ class SubqueryLoader(PostLoader): orig_query, compile_state=orig_compile_state ) if ent["entity"] is not None - } + }, ) # select from the identity columns of the outer (specifically, these @@ -1934,7 +1934,7 @@ class JoinedLoader(AbstractRelationshipLoader): column_collection=None, parentmapper=None, chained_from_outerjoin=False, - **kwargs + **kwargs, ): """Add a left outer join to the statement that's being constructed.""" diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index b6983a0360..a282adea4b 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -1572,7 +1572,7 @@ class Bundle( expression.ClauseList( _literal_as_text_role=roles.ColumnsClauseRole, group=False, - *[e._annotations.get("bundle", e) for e in self.exprs] + *[e._annotations.get("bundle", e) for e in self.exprs], ) ._annotate(annotations) ._set_propagate_attrs( diff --git a/lib/sqlalchemy/pool/impl.py b/lib/sqlalchemy/pool/impl.py index 3ef33d02d2..f478186d5c 100644 --- a/lib/sqlalchemy/pool/impl.py +++ b/lib/sqlalchemy/pool/impl.py @@ -44,7 +44,7 @@ class QueuePool(Pool): max_overflow=10, timeout=30.0, use_lifo=False, - **kw + **kw, ): r""" Construct a QueuePool. diff --git a/lib/sqlalchemy/sql/coercions.py b/lib/sqlalchemy/sql/coercions.py index 1a0336c675..d11ab6712b 100644 --- a/lib/sqlalchemy/sql/coercions.py +++ b/lib/sqlalchemy/sql/coercions.py @@ -115,7 +115,7 @@ def expect( apply_propagate_attrs=None, argname=None, post_inspect=False, - **kw + **kw, ): if ( role.allows_lambda @@ -205,7 +205,7 @@ def expect( resolved, argname=argname, original_element=original_element, - **kw + **kw, ) return resolved else: @@ -441,7 +441,7 @@ class _SelectIsNotFrom: resolved=resolved, advice=advice, code=code, - **kw + **kw, ) @@ -956,7 +956,7 @@ class FromClauseImpl(_SelectIsNotFrom, _NoTextCoercion, RoleImpl): argname=None, explicit_subquery=False, allow_select=True, - **kw + **kw, ): if resolved._is_select_statement: if explicit_subquery: @@ -991,7 +991,7 @@ class StrictFromClauseImpl(FromClauseImpl): resolved, argname=None, allow_select=False, - **kw + **kw, ): if resolved._is_select_statement and allow_select: util.warn_deprecated( diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 90f32a4f7c..cea6d97b8f 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -694,7 +694,7 @@ class SQLCompiler(Compiled): column_keys=None, for_executemany=False, linting=NO_LINTING, - **kwargs + **kwargs, ): """Construct a new :class:`.SQLCompiler` object. @@ -1369,7 +1369,7 @@ class SQLCompiler(Compiled): return self.process( element.element, within_columns_clause=within_columns_clause, - **kwargs + **kwargs, ) def visit_textual_label_reference( @@ -1410,7 +1410,7 @@ class SQLCompiler(Compiled): within_columns_clause=False, render_label_as_label=None, result_map_targets=(), - **kw + **kw, ): # only render labels within the columns clause # or ORDER BY clause of a select. dialect-specific compilers @@ -1439,7 +1439,7 @@ class SQLCompiler(Compiled): self, within_columns_clause=True, within_label_clause=True, - **kw + **kw, ) + OPERATORS[operators.as_] + self.preparer.format_label(label, labelname) @@ -1466,7 +1466,7 @@ class SQLCompiler(Compiled): add_to_result_map=None, include_table=True, result_map_targets=(), - **kwargs + **kwargs, ): name = orig_name = column.name if name is None: @@ -2135,7 +2135,7 @@ class SQLCompiler(Compiled): eager_grouping=False, from_linter=None, lateral_from_linter=None, - **kw + **kw, ): if from_linter and operators.is_comparison(binary.operator): if lateral_from_linter is not None: @@ -2176,7 +2176,7 @@ class SQLCompiler(Compiled): opstring, from_linter=from_linter, lateral_from_linter=lateral_from_linter, - **kw + **kw, ) def visit_function_as_comparison_op_binary(self, element, operator, **kw): @@ -2201,7 +2201,7 @@ class SQLCompiler(Compiled): return self._generate_generic_binary( element, " " + self.escape_literal_column(operator.opstring) + " ", - **kw + **kw, ) def visit_custom_op_unary_operator(self, element, operator, **kw): @@ -2339,7 +2339,7 @@ class SQLCompiler(Compiled): return self._generate_generic_binary( binary, " NOT BETWEEN SYMMETRIC " if symmetric else " NOT BETWEEN ", - **kw + **kw, ) def visit_regexp_match_op_binary(self, binary, operator, **kw): @@ -2368,7 +2368,7 @@ class SQLCompiler(Compiled): skip_bind_expression=False, literal_execute=False, render_postcompile=False, - **kwargs + **kwargs, ): if not skip_bind_expression: impl = bindparam.type.dialect_impl(self.dialect) @@ -2381,7 +2381,7 @@ class SQLCompiler(Compiled): literal_binds=literal_binds, literal_execute=literal_execute, render_postcompile=render_postcompile, - **kwargs + **kwargs, ) if bindparam.expanding: # for postcompile w/ expanding, move the "wrapped" part @@ -2478,7 +2478,7 @@ class SQLCompiler(Compiled): post_compile=post_compile, expanding=bindparam.expanding, bindparam_type=bindparam.type, - **kwargs + **kwargs, ) if bindparam.expanding: @@ -2576,7 +2576,7 @@ class SQLCompiler(Compiled): expanding=False, escaped_from=None, bindparam_type=None, - **kw + **kw, ): if self.positional: @@ -2624,7 +2624,7 @@ class SQLCompiler(Compiled): fromhints=None, visiting_cte=None, from_linter=None, - **kwargs + **kwargs, ): self._init_cte_state() @@ -2813,7 +2813,7 @@ class SQLCompiler(Compiled): lateral=False, enclosing_alias=None, from_linter=None, - **kwargs + **kwargs, ): if lateral: @@ -2842,7 +2842,7 @@ class SQLCompiler(Compiled): fromhints=fromhints, lateral=lateral, enclosing_alias=alias, - **kwargs + **kwargs, ) if subquery and (asfrom or lateral): inner = "(%s)" % (inner,) @@ -2929,7 +2929,7 @@ class SQLCompiler(Compiled): elements.Tuple( types=element._column_types, *elem ).self_group(), - **kw + **kw, ) for chunk in element._data for elem in chunk @@ -3233,7 +3233,7 @@ class SQLCompiler(Compiled): select_wraps_for=None, lateral=False, from_linter=None, - **kwargs + **kwargs, ): assert select_wraps_for is None, ( "SQLAlchemy 1.4 requires use of " @@ -3526,7 +3526,7 @@ class SQLCompiler(Compiled): asfrom=True, fromhints=byfrom, from_linter=from_linter, - **kwargs + **kwargs, ) for f in froms ] @@ -3538,7 +3538,7 @@ class SQLCompiler(Compiled): self, asfrom=True, from_linter=from_linter, - **kwargs + **kwargs, ) for f in froms ] @@ -3732,7 +3732,7 @@ class SQLCompiler(Compiled): fromhints=None, use_schema=True, from_linter=None, - **kwargs + **kwargs, ): if from_linter: from_linter.froms[table] = table.fullname @@ -4054,7 +4054,7 @@ class SQLCompiler(Compiled): update_stmt.table, render_extra_froms, dialect_hints, - **kw + **kw, ) if extra_from_text: text += " " + extra_from_text @@ -4164,7 +4164,7 @@ class SQLCompiler(Compiled): delete_stmt.table, extra_froms, dialect_hints, - **kw + **kw, ) if extra_from_text: text += " " + extra_from_text diff --git a/lib/sqlalchemy/sql/crud.py b/lib/sqlalchemy/sql/crud.py index a313257ca3..27bc080814 100644 --- a/lib/sqlalchemy/sql/crud.py +++ b/lib/sqlalchemy/sql/crud.py @@ -494,7 +494,7 @@ def _append_param_parameter( name=_col_bind_name(c) if not compile_state._has_multi_parameters else "%s_m0" % _col_bind_name(c), - **kw + **kw, ) elif value._is_bind_parameter: value = _handle_values_anonymous_param( @@ -504,7 +504,7 @@ def _append_param_parameter( name=_col_bind_name(c) if not compile_state._has_multi_parameters else "%s_m0" % _col_bind_name(c), - **kw + **kw, ) else: # value is a SQL expression @@ -881,7 +881,7 @@ def _get_update_multitable_params( value, required=value is REQUIRED, name=_col_bind_name(c), - **kw # TODO: no test coverage for literal binds here + **kw, # TODO: no test coverage for literal binds here ) elif value._is_bind_parameter: value = _handle_values_anonymous_param( @@ -949,7 +949,7 @@ def _extend_values_for_multiparams( col, row[key], name="%s_m%d" % (col.key, i + 1), - **kw + **kw, ) else: new_param = compiler.process(row[key].self_group(), **kw) diff --git a/lib/sqlalchemy/sql/default_comparator.py b/lib/sqlalchemy/sql/default_comparator.py index 2bbead6730..d849f8aba7 100644 --- a/lib/sqlalchemy/sql/default_comparator.py +++ b/lib/sqlalchemy/sql/default_comparator.py @@ -36,7 +36,7 @@ def _boolean_compare( _python_is_types=(util.NoneType, bool), _any_all_expr=False, result_type=None, - **kwargs + **kwargs, ): if result_type is None: @@ -215,7 +215,7 @@ def _match_impl(expr, op, other, **kw): negate=operators.not_match_op if op is operators.match_op else operators.match_op, - **kw + **kw, ) @@ -275,7 +275,7 @@ def _regexp_match_impl(expr, op, pattern, flags, **kw): negate=operators.not_regexp_match_op if op is operators.regexp_match_op else operators.regexp_match_op, - **kw + **kw, ) diff --git a/lib/sqlalchemy/sql/dml.py b/lib/sqlalchemy/sql/dml.py index ab0a05651b..feb286d659 100644 --- a/lib/sqlalchemy/sql/dml.py +++ b/lib/sqlalchemy/sql/dml.py @@ -854,7 +854,7 @@ class Insert(ValuesBase): prefixes=None, returning=None, return_defaults=False, - **dialect_kw + **dialect_kw, ): """Construct an :class:`_expression.Insert` object. @@ -1165,7 +1165,7 @@ class Update(DMLWhereBase, ValuesBase): returning=None, return_defaults=False, preserve_parameter_order=False, - **dialect_kw + **dialect_kw, ): r"""Construct an :class:`_expression.Update` object. @@ -1384,7 +1384,7 @@ class Delete(DMLWhereBase, UpdateBase): whereclause=None, returning=None, prefixes=None, - **dialect_kw + **dialect_kw, ): r"""Construct :class:`_expression.Delete` object. diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index f6606e01d5..6e5fbba889 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -516,7 +516,7 @@ class ClauseElement( column_keys=None, for_executemany=False, schema_translate_map=None, - **kw + **kw, ): if compiled_cache is not None and dialect._supports_statement_cache: elem_cache_key = self._generate_cache_key() @@ -542,7 +542,7 @@ class ClauseElement( column_keys=column_keys, for_executemany=for_executemany, schema_translate_map=schema_translate_map, - **kw + **kw, ) compiled_cache[key] = compiled_sql else: @@ -555,7 +555,7 @@ class ClauseElement( column_keys=column_keys, for_executemany=for_executemany, schema_translate_map=schema_translate_map, - **kw + **kw, ) if not dialect._supports_statement_cache: @@ -4134,7 +4134,7 @@ class Over(ColumnElement): if partition_by is not None: self.partition_by = ClauseList( *util.to_list(partition_by), - _literal_as_text_role=roles.ByOfRole + _literal_as_text_role=roles.ByOfRole, ) if range_: @@ -4667,7 +4667,7 @@ class NamedColumn(ColumnElement): name=None, name_is_truncatable=False, disallow_is_literal=False, - **kw + **kw, ): c = ColumnClause( coercions.expect(roles.TruncatedLabelRole, name or self.name) @@ -4965,7 +4965,7 @@ class ColumnClause( name=None, name_is_truncatable=False, disallow_is_literal=False, - **kw + **kw, ): # the "is_literal" flag normally should never be propagated; a proxied # column is always a SQL identifier and never the actual expression diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py index fa0b06421b..29f2ce8686 100644 --- a/lib/sqlalchemy/sql/functions.py +++ b/lib/sqlalchemy/sql/functions.py @@ -580,7 +580,7 @@ class FunctionElement(Executable, ColumnElement, FromClause, Generative): _compared_to_type=self.type, unique=True, type_=type_, - **kw + **kw, ) def self_group(self, against=None): @@ -867,7 +867,7 @@ class Function(FunctionElement): _compared_to_type=self.type, type_=type_, unique=True, - **kw + **kw, ) diff --git a/lib/sqlalchemy/sql/lambdas.py b/lib/sqlalchemy/sql/lambdas.py index da1dbedbb5..b2c3666710 100644 --- a/lib/sqlalchemy/sql/lambdas.py +++ b/lib/sqlalchemy/sql/lambdas.py @@ -314,7 +314,7 @@ class LambdaElement(elements.ClauseElement): self._resolved = clone( self._resolved, deferred_copy_internals=deferred_copy_internals, - **kw + **kw, ) @util.memoized_property diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index dd8238450c..a5fdd39d41 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -680,7 +680,7 @@ class Table(DialectKWArgs, SchemaItem, TableClause): self._init_items( *args, - allow_replacements=extend_existing or keep_existing or autoload + allow_replacements=extend_existing or keep_existing or autoload, ) def _autoload( @@ -1049,7 +1049,7 @@ class Table(DialectKWArgs, SchemaItem, TableClause): schema=schema, comment=self.comment, *args, - **self.kwargs + **self.kwargs, ) for c in self.constraints: if isinstance(c, ForeignKeyConstraint): @@ -1087,7 +1087,7 @@ class Table(DialectKWArgs, SchemaItem, TableClause): for expr in index.expressions ], _table=table, - **index.kwargs + **index.kwargs, ) return self._schema_item_copy(table) @@ -1892,7 +1892,7 @@ class Column(DialectKWArgs, SchemaItem, ColumnClause): doc=self.doc, comment=self.comment, *args, - **column_kwargs + **column_kwargs, ) return self._schema_item_copy(c) @@ -1930,7 +1930,7 @@ class Column(DialectKWArgs, SchemaItem, ColumnClause): primary_key=self.primary_key, nullable=self.nullable, _proxies=[self], - *fk + *fk, ) except TypeError as err: raise TypeError( @@ -2007,7 +2007,7 @@ class ForeignKey(DialectKWArgs, SchemaItem): link_to_name=False, match=None, info=None, - **dialect_kw + **dialect_kw, ): r""" Construct a column-level FOREIGN KEY. @@ -2150,7 +2150,7 @@ class ForeignKey(DialectKWArgs, SchemaItem): initially=self.initially, link_to_name=self.link_to_name, match=self.match, - **self._unvalidated_dialect_kw + **self._unvalidated_dialect_kw, ) return self._schema_item_copy(fk) @@ -2421,7 +2421,7 @@ class ForeignKey(DialectKWArgs, SchemaItem): deferrable=self.deferrable, initially=self.initially, match=self.match, - **self._unvalidated_dialect_kw + **self._unvalidated_dialect_kw, ) self.constraint._append_element(column, self) self.constraint._set_parent_with_dispatch(table) @@ -3021,7 +3021,7 @@ class Constraint(DialectKWArgs, SchemaItem): _create_rule=None, info=None, _type_bound=False, - **dialect_kw + **dialect_kw, ): r"""Create a SQL constraint. @@ -3266,7 +3266,7 @@ class ColumnCollectionConstraint(ColumnCollectionMixin, Constraint): _copy_expression(expr, self.parent, target_table) for expr in self.columns ], - **constraint_kwargs + **constraint_kwargs, ) return self._schema_item_copy(c) @@ -3314,7 +3314,7 @@ class CheckConstraint(ColumnCollectionConstraint): _create_rule=None, _autoattach=True, _type_bound=False, - **kw + **kw, ): r"""Construct a CHECK constraint. @@ -3358,7 +3358,7 @@ class CheckConstraint(ColumnCollectionConstraint): _type_bound=_type_bound, _autoattach=_autoattach, *columns, - **kw + **kw, ) if table is not None: self._set_parent_with_dispatch(table) @@ -3426,7 +3426,7 @@ class ForeignKeyConstraint(ColumnCollectionConstraint): match=None, table=None, info=None, - **dialect_kw + **dialect_kw, ): r"""Construct a composite-capable FOREIGN KEY. @@ -3505,7 +3505,7 @@ class ForeignKeyConstraint(ColumnCollectionConstraint): deferrable=deferrable, initially=initially, info=info, - **dialect_kw + **dialect_kw, ) self.onupdate = onupdate self.ondelete = ondelete @@ -3546,7 +3546,7 @@ class ForeignKeyConstraint(ColumnCollectionConstraint): match=self.match, deferrable=self.deferrable, initially=self.initially, - **self.dialect_kwargs + **self.dialect_kwargs, ) for refcol in refcolumns ] @@ -4055,7 +4055,7 @@ class Index(DialectKWArgs, ColumnCollectionMixin, SchemaItem): self, *expressions, _column_flag=_column_flag, - _gather_expressions=self.expressions + _gather_expressions=self.expressions, ) if table is not None: @@ -4423,7 +4423,7 @@ class MetaData(SchemaItem): extend_existing=False, autoload_replace=True, resolve_fks=True, - **dialect_kwargs + **dialect_kwargs, ): r"""Load all available table definitions from the database. diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index b53235a836..9c5850761f 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -2697,7 +2697,7 @@ class TableClause(roles.DMLTableRole, Immutable, FromClause): whereclause=whereclause, values=values, inline=inline, - **kwargs + **kwargs, ) @util.preload_module("sqlalchemy.sql.dml") @@ -5001,7 +5001,7 @@ class Select( onclause=None, *, isouter=False, - full=False + full=False, ) -> SelfSelect: r"""Create a SQL JOIN against this :class:`_expression.Select` object's criterion @@ -5340,7 +5340,7 @@ class Select( *util.preloaded.sql_util.reduce_columns( self._all_selected_columns, only_synonyms=only_synonyms, - *(self._where_criteria + self._from_obj) + *(self._where_criteria + self._from_obj), ) ) diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py index cda7b35cda..cb44fc0861 100644 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@ -926,7 +926,7 @@ class SchemaType(SchemaEventTarget): inherit_schema=self.inherit_schema, metadata=metadata, _create_events=_create_events, - **kw + **kw, ) def create(self, bind, checkfirst=False): diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py index 02cb0ac328..8679a9f12b 100644 --- a/lib/sqlalchemy/testing/plugin/pytestplugin.py +++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py @@ -647,7 +647,7 @@ class PytestFixtureFunctions(plugin_base.FixtureFunctions): idx for idx, char in enumerate(id_) if char in ("n", "r", "s", "a") - ] + ], ) fns = [ (operator.itemgetter(idx), _combination_id_fns[char]) diff --git a/lib/sqlalchemy/testing/suite/test_dialect.py b/lib/sqlalchemy/testing/suite/test_dialect.py index daaea085d9..aeb1991d1d 100644 --- a/lib/sqlalchemy/testing/suite/test_dialect.py +++ b/lib/sqlalchemy/testing/suite/test_dialect.py @@ -70,7 +70,7 @@ class ExceptionTest(fixtures.TablesTest): # there's no way to make this happen with some drivers like # mysqlclient, pymysql. this at least does produce a non- # ascii error message for cx_oracle, psycopg2 - conn.execute(select(literal_column(u"méil"))) + conn.execute(select(literal_column("méil"))) assert False except exc.DBAPIError as err: err_str = str(err) diff --git a/lib/sqlalchemy/testing/suite/test_reflection.py b/lib/sqlalchemy/testing/suite/test_reflection.py index 9287f76dec..6f02d55577 100644 --- a/lib/sqlalchemy/testing/suite/test_reflection.py +++ b/lib/sqlalchemy/testing/suite/test_reflection.py @@ -495,7 +495,7 @@ class ComponentReflectionTest(fixtures.TablesTest): # https://www.arbinada.com/en/node/1645 sa.UniqueConstraint("name", name="user_tmp_uq_%s" % config.ident), sa.Index("user_tmp_ix", "foo"), - **kw + **kw, ) if ( testing.requires.view_reflection.enabled @@ -1286,7 +1286,7 @@ class ComponentReflectionTestExtra(fixtures.TestBase): t = Table( "t", metadata, - *[Column("t%d" % i, type_) for i, type_ in enumerate(types)] + *[Column("t%d" % i, type_) for i, type_ in enumerate(types)], ) t.create(connection) diff --git a/lib/sqlalchemy/testing/util.py b/lib/sqlalchemy/testing/util.py index 982e575177..8cb92e8083 100644 --- a/lib/sqlalchemy/testing/util.py +++ b/lib/sqlalchemy/testing/util.py @@ -275,7 +275,7 @@ def flag_combinations(*combinations): for d in combinations ], id_="i" + ("a" * len(keys)), - argnames=",".join(keys) + argnames=",".join(keys), ) diff --git a/pyproject.toml b/pyproject.toml index 7523d67e5a..9b0b3dfc72 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,4 +8,4 @@ [tool.black] line-length = 79 -target-version = ['py27', 'py36'] +target-version = ['py37'] diff --git a/test/aaa_profiling/test_memusage.py b/test/aaa_profiling/test_memusage.py index 42f8823665..316e7d7d46 100644 --- a/test/aaa_profiling/test_memusage.py +++ b/test/aaa_profiling/test_memusage.py @@ -553,7 +553,7 @@ class MemUsageWBackendTest(fixtures.MappedTest, EnsureZeroed): Column( "id", Integer, primary_key=True, test_needs_autoincrement=True ), - *[Column("col%d" % i, Integer) for i in range(10)] + *[Column("col%d" % i, Integer) for i in range(10)], ) class Wide: diff --git a/test/aaa_profiling/test_orm.py b/test/aaa_profiling/test_orm.py index 113286d1ba..128a78714f 100644 --- a/test/aaa_profiling/test_orm.py +++ b/test/aaa_profiling/test_orm.py @@ -375,7 +375,7 @@ class DeferOptionsTest(NoCache, fixtures.MappedTest): **dict( (letter, "%s%d" % (letter, i)) for letter in ["x", "y", "z", "p", "q", "r"] - ) + ), ) for i in range(1, 1001) ] @@ -722,7 +722,7 @@ class JoinedEagerLoadTest(NoCache, fixtures.MappedTest): Column( "id", Integer, primary_key=True, test_needs_autoincrement=True ), - *make_some_columns() + *make_some_columns(), ) Table( "b", @@ -731,7 +731,7 @@ class JoinedEagerLoadTest(NoCache, fixtures.MappedTest): "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("a_id", ForeignKey("a.id")), - *make_some_columns() + *make_some_columns(), ) Table( "c", @@ -740,7 +740,7 @@ class JoinedEagerLoadTest(NoCache, fixtures.MappedTest): "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("b_id", ForeignKey("b.id")), - *make_some_columns() + *make_some_columns(), ) Table( "d", @@ -749,7 +749,7 @@ class JoinedEagerLoadTest(NoCache, fixtures.MappedTest): "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("c_id", ForeignKey("c.id")), - *make_some_columns() + *make_some_columns(), ) Table( "e", @@ -758,7 +758,7 @@ class JoinedEagerLoadTest(NoCache, fixtures.MappedTest): "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("a_id", ForeignKey("a.id")), - *make_some_columns() + *make_some_columns(), ) Table( "f", @@ -767,7 +767,7 @@ class JoinedEagerLoadTest(NoCache, fixtures.MappedTest): "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("e_id", ForeignKey("e.id")), - *make_some_columns() + *make_some_columns(), ) Table( "g", @@ -776,7 +776,7 @@ class JoinedEagerLoadTest(NoCache, fixtures.MappedTest): "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("e_id", ForeignKey("e.id")), - *make_some_columns() + *make_some_columns(), ) @classmethod @@ -1024,7 +1024,7 @@ class BranchedOptionTest(NoCache, fixtures.MappedTest): Column( "id", Integer, primary_key=True, test_needs_autoincrement=True ), - *make_some_columns() + *make_some_columns(), ) Table( "b", @@ -1033,7 +1033,7 @@ class BranchedOptionTest(NoCache, fixtures.MappedTest): "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("a_id", ForeignKey("a.id")), - *make_some_columns() + *make_some_columns(), ) Table( "c", @@ -1042,7 +1042,7 @@ class BranchedOptionTest(NoCache, fixtures.MappedTest): "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("b_id", ForeignKey("b.id")), - *make_some_columns() + *make_some_columns(), ) Table( "d", @@ -1051,7 +1051,7 @@ class BranchedOptionTest(NoCache, fixtures.MappedTest): "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("b_id", ForeignKey("b.id")), - *make_some_columns() + *make_some_columns(), ) Table( "e", @@ -1060,7 +1060,7 @@ class BranchedOptionTest(NoCache, fixtures.MappedTest): "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("b_id", ForeignKey("b.id")), - *make_some_columns() + *make_some_columns(), ) Table( "f", @@ -1069,7 +1069,7 @@ class BranchedOptionTest(NoCache, fixtures.MappedTest): "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("b_id", ForeignKey("b.id")), - *make_some_columns() + *make_some_columns(), ) Table( "g", @@ -1078,7 +1078,7 @@ class BranchedOptionTest(NoCache, fixtures.MappedTest): "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("a_id", ForeignKey("a.id")), - *make_some_columns() + *make_some_columns(), ) @classmethod diff --git a/test/aaa_profiling/test_resultset.py b/test/aaa_profiling/test_resultset.py index 12921a7dc3..479a2472f4 100644 --- a/test/aaa_profiling/test_resultset.py +++ b/test/aaa_profiling/test_resultset.py @@ -29,7 +29,7 @@ class ResultSetTest(fixtures.TablesTest, AssertsExecutionResults): *[ Column("field%d" % fnum, String(50)) for fnum in range(NUM_FIELDS) - ] + ], ) Table( "table2", @@ -37,7 +37,7 @@ class ResultSetTest(fixtures.TablesTest, AssertsExecutionResults): *[ Column("field%d" % fnum, Unicode(50)) for fnum in range(NUM_FIELDS) - ] + ], ) @classmethod diff --git a/test/dialect/mssql/test_reflection.py b/test/dialect/mssql/test_reflection.py index f877d2c5c7..1489f9a6d9 100644 --- a/test/dialect/mssql/test_reflection.py +++ b/test/dialect/mssql/test_reflection.py @@ -260,12 +260,12 @@ class ReflectionTest(fixtures.TestBase, ComparesTables, AssertsCompiledSQL): [ { "id": 1, - "txt": u"foo", + "txt": "foo", "dt2": datetime.datetime(2020, 1, 1, 1, 1, 1), }, { "id": 2, - "txt": u"bar", + "txt": "bar", "dt2": datetime.datetime(2020, 2, 2, 2, 2, 2), }, ], @@ -587,7 +587,7 @@ class ReflectHugeViewTest(fixtures.TablesTest): *[ Column("long_named_column_number_%d" % i, Integer) for i in range(col_num) - ] + ], ) cls.view_str = ( view_str diff --git a/test/dialect/mysql/test_reflection.py b/test/dialect/mysql/test_reflection.py index 08c7d9a4d2..f414c9c376 100644 --- a/test/dialect/mysql/test_reflection.py +++ b/test/dialect/mysql/test_reflection.py @@ -327,7 +327,7 @@ class ReflectionTest(fixtures.TestBase, AssertsCompiledSQL): metadata, Column("c1", Integer()), comment=comment, - **kwargs + **kwargs, ) conn = connection diff --git a/test/dialect/oracle/test_dialect.py b/test/dialect/oracle/test_dialect.py index 18996c3f9c..c06baace03 100644 --- a/test/dialect/oracle/test_dialect.py +++ b/test/dialect/oracle/test_dialect.py @@ -501,7 +501,7 @@ class CompatFlagsTest(fixtures.TestBase, AssertsCompiledSQL): version="0.0.0", paramstyle="named", ), - **kw + **kw, ) dialect._get_server_version_info = server_version_info diff --git a/test/dialect/oracle/test_types.py b/test/dialect/oracle/test_types.py index d9a350947f..715a90000c 100644 --- a/test/dialect/oracle/test_types.py +++ b/test/dialect/oracle/test_types.py @@ -1003,11 +1003,11 @@ class LOBFetchTest(fixtures.TablesTest): long_text.create(connection) if isinstance(datatype, UnicodeText): - word_seed = u"ab🐍’«cdefg" + word_seed = "ab🐍’«cdefg" else: word_seed = "abcdef" - some_text = u" ".join( + some_text = " ".join( "".join(random.choice(word_seed) for j in range(150)) for i in range(datasize) ) @@ -1033,9 +1033,9 @@ class LOBFetchTest(fixtures.TablesTest): ) long_text.create(connection) - word_seed = u"ab🐍’«cdefg" + word_seed = "ab🐍’«cdefg" - some_text = u" ".join( + some_text = " ".join( "".join(random.choice(word_seed) for j in range(10)) for i in range(15) ) diff --git a/test/dialect/postgresql/test_async_pg_py3k.py b/test/dialect/postgresql/test_async_pg_py3k.py index 782cf33dd3..4ccc847dcc 100644 --- a/test/dialect/postgresql/test_async_pg_py3k.py +++ b/test/dialect/postgresql/test_async_pg_py3k.py @@ -120,7 +120,7 @@ class AsyncPgTest(fixtures.TestBase): "name", ENUM( *("beans", "means", "keens", "faux", "beau", "flow"), - name="my_enum" + name="my_enum", ), ), ) diff --git a/test/dialect/postgresql/test_dialect.py b/test/dialect/postgresql/test_dialect.py index 02d7ad483e..cd6c127b8c 100644 --- a/test/dialect/postgresql/test_dialect.py +++ b/test/dialect/postgresql/test_dialect.py @@ -374,7 +374,7 @@ class ExecuteManyMode: {"x": "x2", "y": "y2"}, {"x": "x3", "y": "y3"}, ), - **expected_kwargs + **expected_kwargs, ) ], ) @@ -423,7 +423,7 @@ class ExecuteManyMode: {"x": "x2", "y": "y2"}, {"x": "x3", "y": "y3"}, ), - **expected_kwargs + **expected_kwargs, ) ], ) @@ -476,7 +476,7 @@ class ExecuteManyMode: {"x": "x2", "y": "y2"}, {"x": "x3", "y": "y3"}, ), - **expected_kwargs + **expected_kwargs, ) ], ) @@ -529,7 +529,7 @@ class ExecuteManyMode: {"xval": "x1", "yval": "y5"}, {"xval": "x3", "yval": "y6"}, ), - **expected_kwargs + **expected_kwargs, ) ], ) diff --git a/test/dialect/postgresql/test_reflection.py b/test/dialect/postgresql/test_reflection.py index 0e8a18c0fc..fa04dee480 100644 --- a/test/dialect/postgresql/test_reflection.py +++ b/test/dialect/postgresql/test_reflection.py @@ -1698,10 +1698,10 @@ class ReflectionTest( eq_( check_constraints, { - u"cc1": u"(a > 1) AND (a < 5)", - u"cc2": u"(a = 1) OR ((a > 2) AND (a < 5))", - u"cc3": u"is_positive(a)", - u"cc4": u"(b)::text <> 'hi\nim a name \nyup\n'::text", + "cc1": "(a > 1) AND (a < 5)", + "cc2": "(a = 1) OR ((a > 2) AND (a < 5))", + "cc3": "is_positive(a)", + "cc4": "(b)::text <> 'hi\nim a name \nyup\n'::text", }, ) diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py index 69b06403e4..f399397621 100644 --- a/test/dialect/postgresql/test_types.py +++ b/test/dialect/postgresql/test_types.py @@ -1515,14 +1515,14 @@ class ArrayRoundTripTest: { "id": 1, "intarr": [1, 2, 3], - "strarr": [u"one", u"two", u"three"], + "strarr": ["one", "two", "three"], }, { "id": 2, "intarr": [4, 5, 6], - "strarr": [u"four", u"five", u"six"], + "strarr": ["four", "five", "six"], }, - {"id": 3, "intarr": [1, 5], "strarr": [u"one", u"five"]}, + {"id": 3, "intarr": [1, 5], "strarr": ["one", "five"]}, {"id": 4, "intarr": [], "strarr": []}, ], ) @@ -1556,9 +1556,9 @@ class ArrayRoundTripTest: .where( arrtable.c.strarr.in_( [ - [u"one", u"five"], - [u"four", u"five", u"six"], - [u"nine", u"ten"], + ["one", "five"], + ["four", "five", "six"], + ["nine", "ten"], ] ) ) diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py index 141033c1b6..516730159b 100644 --- a/test/dialect/test_sqlite.py +++ b/test/dialect/test_sqlite.py @@ -2278,8 +2278,8 @@ class ConstraintReflectionTest(fixtures.TestBase): [ { "unique": 0, - "name": u"ix_main_l_bar", - "column_names": [u"bar"], + "name": "ix_main_l_bar", + "column_names": ["bar"], } ], ) diff --git a/test/engine/test_parseconnect.py b/test/engine/test_parseconnect.py index 19fce5c189..00d9390b4c 100644 --- a/test/engine/test_parseconnect.py +++ b/test/engine/test_parseconnect.py @@ -319,7 +319,7 @@ class URLTest(fixtures.TestBase): "%s must be a string" % argname, url.URL.create, "somedriver", - **{argname: value} + **{argname: value}, ) @testing.combinations("username", "host", "database", argnames="argname") @@ -352,7 +352,7 @@ class URLTest(fixtures.TestBase): TypeError, "%s must be a string" % argname, u1.set, - **{argname: 35.8} + **{argname: 35.8}, ) def test_only_str_query_key_constructor(self): diff --git a/test/engine/test_reconnect.py b/test/engine/test_reconnect.py index f37d1893f0..74b5b2df5a 100644 --- a/test/engine/test_reconnect.py +++ b/test/engine/test_reconnect.py @@ -173,7 +173,7 @@ class PrePingMockTest(fixtures.TestBase): creator=lambda: self.dbapi.connect("foo.db"), pre_ping=pre_ping, dialect=dialect, - **(pool_kw if pool_kw else {}) + **(pool_kw if pool_kw else {}), ) dialect.is_disconnect = lambda e, conn, cursor: isinstance( diff --git a/test/engine/test_reflection.py b/test/engine/test_reflection.py index efd30071ef..42c83d87b4 100644 --- a/test/engine/test_reflection.py +++ b/test/engine/test_reflection.py @@ -257,7 +257,10 @@ class ReflectionTest(fixtures.TestBase, ComparesTables): foo = Table( "foo", meta, - *[Column(n, sa.String(30)) for n in ["a", "b", "c", "d", "e", "f"]] + *[ + Column(n, sa.String(30)) + for n in ["a", "b", "c", "d", "e", "f"] + ], ) meta.create_all(connection) meta2 = MetaData() diff --git a/test/ext/test_associationproxy.py b/test/ext/test_associationproxy.py index 93da104de7..3fa7b4999f 100644 --- a/test/ext/test_associationproxy.py +++ b/test/ext/test_associationproxy.py @@ -3095,7 +3095,7 @@ class MultiOwnerTest( "Association proxy D.c refers to an attribute 'csub_only_data'", fn, *arg, - **kw + **kw, ) def _assert_raises_attribute(self, message, fn, *arg, **kw): diff --git a/test/ext/test_automap.py b/test/ext/test_automap.py index 625bb8da25..df60a9a653 100644 --- a/test/ext/test_automap.py +++ b/test/ext/test_automap.py @@ -287,7 +287,7 @@ class AutomapTest(fixtures.MappedTest): attrname, local_cls, referred_cls, - **kw + **kw, ) Base.prepare(generate_relationship=_gen_relationship) diff --git a/test/ext/test_baked.py b/test/ext/test_baked.py index a06bbf46b6..7bb428ea13 100644 --- a/test/ext/test_baked.py +++ b/test/ext/test_baked.py @@ -746,7 +746,7 @@ class ResultTest(BakedTest): result = bq(sess).all() if cond1: - eq_(result, [(8, u"ed"), (9, u"fred"), (10, u"chuck")]) + eq_(result, [(8, "ed"), (9, "fred"), (10, "chuck")]) else: eq_(result, [(7, "jack")]) @@ -993,7 +993,7 @@ class CustomIntegrationTest(testing.AssertsCompiledSQL, BakedTest): Address, order_by=self.tables.addresses.c.id, lazy=lazy, - **kw + **kw, ) }, ) diff --git a/test/ext/test_horizontal_shard.py b/test/ext/test_horizontal_shard.py index e25e8c8ab9..a599560625 100644 --- a/test/ext/test_horizontal_shard.py +++ b/test/ext/test_horizontal_shard.py @@ -902,7 +902,7 @@ class RefreshDeferExpireTest(fixtures.DeclarativeMappedTest): shard_chooser=lambda *args: "main", id_chooser=lambda *args: ["fake", "main"], execute_chooser=lambda *args: ["fake", "main"], - **kw + **kw, ) def test_refresh(self): diff --git a/test/orm/inheritance/test_poly_persistence.py b/test/orm/inheritance/test_poly_persistence.py index 8c03a40d64..319456b2e9 100644 --- a/test/orm/inheritance/test_poly_persistence.py +++ b/test/orm/inheritance/test_poly_persistence.py @@ -334,13 +334,13 @@ class RoundTripTest(PolymorphTest): Manager( status="AAB", manager_name="manager1", - **{person_attribute_name: "pointy haired boss"} + **{person_attribute_name: "pointy haired boss"}, ), Engineer( status="BBA", engineer_name="engineer1", primary_language="java", - **{person_attribute_name: "dilbert"} + **{person_attribute_name: "dilbert"}, ), ] if include_base: @@ -350,12 +350,12 @@ class RoundTripTest(PolymorphTest): status="CGG", engineer_name="engineer2", primary_language="python", - **{person_attribute_name: "wally"} + **{person_attribute_name: "wally"}, ), Manager( status="ABA", manager_name="manager2", - **{person_attribute_name: "jsmith"} + **{person_attribute_name: "jsmith"}, ), ] @@ -567,7 +567,7 @@ class RoundTripTest(PolymorphTest): status="BBB", manager_name="boss", golf_swing="fore", - **{person_attribute_name: "daboss"} + **{person_attribute_name: "daboss"}, ) session.add(daboss) assert_raises(sa_exc.DBAPIError, session.flush) diff --git a/test/orm/test_attributes.py b/test/orm/test_attributes.py index 08de5d3d97..7c0aeabb4b 100644 --- a/test/orm/test_attributes.py +++ b/test/orm/test_attributes.py @@ -1782,7 +1782,7 @@ class HistoryTest(fixtures.TestBase): uselist=uselist, useobject=useobject, active_history=active_history, - **kw + **kw, ) return Foo diff --git a/test/orm/test_inspect.py b/test/orm/test_inspect.py index f468fc5c24..b14f16c3c7 100644 --- a/test/orm/test_inspect.py +++ b/test/orm/test_inspect.py @@ -560,7 +560,7 @@ class %s(SuperCls): "t", m, Column("id", Integer, primary_key=True), - *[Column(name, Integer) for name in names] + *[Column(name, Integer) for name in names], ) m = self.mapper_registry.map_imperatively(MyClass, t) diff --git a/test/orm/test_rel_fn.py b/test/orm/test_rel_fn.py index dfce8e3829..ea292a43e4 100644 --- a/test/orm/test_rel_fn.py +++ b/test/orm/test_rel_fn.py @@ -213,7 +213,7 @@ class _JoinFixtures: self.m2mleft, self.m2mright, secondary=self.m2msecondary, - **kw + **kw, ) def _join_fixture_m2m_backref(self, **kw): @@ -257,7 +257,7 @@ class _JoinFixtures: self.selfref, self.selfref, remote_side=set([self.selfref.c.id]), - **kw + **kw, ) def _join_fixture_o2m_composite_selfref(self, **kw): @@ -266,7 +266,7 @@ class _JoinFixtures: self.composite_selfref, self.composite_selfref, self.composite_selfref, - **kw + **kw, ) def _join_fixture_m2o_composite_selfref(self, **kw): @@ -281,7 +281,7 @@ class _JoinFixtures: self.composite_selfref.c.group_id, ] ), - **kw + **kw, ) def _join_fixture_o2m_composite_selfref_func(self, **kw): @@ -296,7 +296,7 @@ class _JoinFixtures: self.composite_selfref.c.parent_id == self.composite_selfref.c.id, ), - **kw + **kw, ) def _join_fixture_o2m_composite_selfref_func_remote_side(self, **kw): @@ -312,7 +312,7 @@ class _JoinFixtures: == self.composite_selfref.c.id, ), remote_side=set([self.composite_selfref.c.parent_id]), - **kw + **kw, ) def _join_fixture_o2m_composite_selfref_func_annotated(self, **kw): @@ -327,7 +327,7 @@ class _JoinFixtures: remote(self.composite_selfref.c.parent_id) == self.composite_selfref.c.id, ), - **kw + **kw, ) def _join_fixture_compound_expression_1(self, **kw): @@ -340,7 +340,7 @@ class _JoinFixtures: == relationships.remote( relationships.foreign(self.right.c.x * self.right.c.y) ), - **kw + **kw, ) def _join_fixture_compound_expression_2(self, **kw): @@ -351,7 +351,7 @@ class _JoinFixtures: self.right, primaryjoin=(self.left.c.x + self.left.c.y) == relationships.foreign(self.right.c.x * self.right.c.y), - **kw + **kw, ) def _join_fixture_compound_expression_1_non_annotated(self, **kw): @@ -362,7 +362,7 @@ class _JoinFixtures: self.right, primaryjoin=(self.left.c.x + self.left.c.y) == (self.right.c.x * self.right.c.y), - **kw + **kw, ) def _join_fixture_base_to_joined_sub(self, **kw): @@ -377,7 +377,7 @@ class _JoinFixtures: self.base_w_sub_rel, self.rel_sub, primaryjoin=self.base_w_sub_rel.c.sub_id == self.rel_sub.c.id, - **kw + **kw, ) def _join_fixture_o2m_joined_sub_to_base(self, **kw): @@ -460,7 +460,7 @@ class _JoinFixtures: self.left, self.right, primaryjoin=self.left.c.id == foreign(func.foo(self.right.c.lid)), - **kw + **kw, ) def _join_fixture_o2m_to_oldstyle_func(self, **kw): @@ -471,7 +471,7 @@ class _JoinFixtures: self.right, primaryjoin=self.left.c.id == func.foo(self.right.c.lid), consider_as_foreign_keys={self.right.c.lid}, - **kw + **kw, ) def _join_fixture_overlapping_composite_fks(self, **kw): @@ -484,7 +484,7 @@ class _JoinFixtures: self.composite_multi_ref.c.uid2, self.composite_multi_ref.c.oid, }, - **kw + **kw, ) def _join_fixture_o2m_o_side_none(self, **kw): @@ -496,7 +496,7 @@ class _JoinFixtures: primaryjoin=and_( self.left.c.id == self.right.c.lid, self.left.c.x == 5 ), - **kw + **kw, ) def _join_fixture_purely_single_o2m(self, **kw): @@ -595,7 +595,7 @@ class _JoinFixtures: % (primary, expr, relname), fn, *arg, - **kw + **kw, ) def _assert_raises_no_equality( @@ -614,7 +614,7 @@ class _JoinFixtures: % (primary, expr, relname), fn, *arg, - **kw + **kw, ) def _assert_raises_ambig_join( @@ -634,7 +634,7 @@ class _JoinFixtures: % (relname, secondary_arg), fn, *arg, - **kw + **kw, ) else: assert_raises_message( @@ -645,7 +645,7 @@ class _JoinFixtures: % (relname,), fn, *arg, - **kw + **kw, ) def _assert_raises_no_join(self, fn, relname, secondary_arg, *arg, **kw): @@ -662,7 +662,7 @@ class _JoinFixtures: "'secondaryjoin' expressions" % (relname, secondary_arg), fn, *arg, - **kw + **kw, ) else: assert_raises_message( @@ -676,7 +676,7 @@ class _JoinFixtures: "expression." % (relname,), fn, *arg, - **kw + **kw, ) diff --git a/test/orm/test_relationship_criteria.py b/test/orm/test_relationship_criteria.py index d8d3844cd1..90d8aba2d3 100644 --- a/test/orm/test_relationship_criteria.py +++ b/test/orm/test_relationship_criteria.py @@ -1070,7 +1070,7 @@ class TemporalFixtureTest(testing.fixtures.DeclarativeMappedTest): datetime.datetime(2009, 10, 16, 12, 00, 00), datetime.datetime(2009, 10, 18, 12, 00, 00), ), - *loader_options + *loader_options, ) ) if is_joined: @@ -1090,7 +1090,7 @@ class TemporalFixtureTest(testing.fixtures.DeclarativeMappedTest): datetime.datetime(2009, 10, 15, 11, 00, 00), datetime.datetime(2009, 10, 18, 12, 00, 00), ), - *loader_options + *loader_options, ) ) if is_joined: diff --git a/test/orm/test_relationships.py b/test/orm/test_relationships.py index 9ceaf4b6c8..2050ca2b75 100644 --- a/test/orm/test_relationships.py +++ b/test/orm/test_relationships.py @@ -62,7 +62,7 @@ class _RelationshipErrors: % (primary, expr, relname), fn, *arg, - **kw + **kw, ) def _assert_raises_no_equality( @@ -81,7 +81,7 @@ class _RelationshipErrors: % (primary, expr, relname), fn, *arg, - **kw + **kw, ) def _assert_raises_ambig_join( @@ -101,7 +101,7 @@ class _RelationshipErrors: % (relname, secondary_arg), fn, *arg, - **kw + **kw, ) else: assert_raises_message( @@ -115,7 +115,7 @@ class _RelationshipErrors: "foreign key reference to the parent table." % (relname,), fn, *arg, - **kw + **kw, ) def _assert_raises_no_join(self, fn, relname, secondary_arg, *arg, **kw): @@ -132,7 +132,7 @@ class _RelationshipErrors: "'secondaryjoin' expressions" % (relname, secondary_arg), fn, *arg, - **kw + **kw, ) else: assert_raises_message( @@ -146,7 +146,7 @@ class _RelationshipErrors: "expression." % (relname,), fn, *arg, - **kw + **kw, ) def _assert_raises_ambiguous_direction(self, fn, relname, *arg, **kw): @@ -161,7 +161,7 @@ class _RelationshipErrors: "via the foreign_keys argument." % relname, fn, *arg, - **kw + **kw, ) def _assert_raises_no_local_remote(self, fn, relname, *arg, **kw): @@ -176,7 +176,7 @@ class _RelationshipErrors: % (relname), fn, *arg, - **kw + **kw, ) diff --git a/test/sql/test_constraints.py b/test/sql/test_constraints.py index 8c1fa54243..2661e6c8fd 100644 --- a/test/sql/test_constraints.py +++ b/test/sql/test_constraints.py @@ -1026,7 +1026,7 @@ class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL): Column("a", Integer), Column("b", Integer), Column("c", Integer), - *fkcs + *fkcs, ) Table("remote", m, Column("id", Integer, primary_key=True)) diff --git a/test/sql/test_deprecations.py b/test/sql/test_deprecations.py index 1a839a5f82..ea075b36d2 100644 --- a/test/sql/test_deprecations.py +++ b/test/sql/test_deprecations.py @@ -1294,7 +1294,7 @@ class DMLTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): (t, combination) for i, combination in zip(range(10), combinations()) ], - argnames="t, idx_to_value" + argnames="t, idx_to_value", ) @random_update_order_parameters() diff --git a/test/sql/test_metadata.py b/test/sql/test_metadata.py index b9abe4e71b..8a9c868be3 100644 --- a/test/sql/test_metadata.py +++ b/test/sql/test_metadata.py @@ -1941,7 +1941,7 @@ class TableTest(fixtures.TestBase, AssertsCompiledSQL): "a", metadata, Column("foo", String, primary_key=True), - **_kwargs + **_kwargs, ) eq_(getattr(table_a, attrib), _attrib_value) eq_(getattr(metadata.tables["a"], attrib), _attrib_value) diff --git a/test/sql/test_quote.py b/test/sql/test_quote.py index 67954d9ce4..07003abcb5 100644 --- a/test/sql/test_quote.py +++ b/test/sql/test_quote.py @@ -248,9 +248,9 @@ class QuoteTest(fixtures.TestBase, AssertsCompiledSQL): ) def test_repr_unicode(self): - name = quoted_name(u"姓名", None) + name = quoted_name("姓名", None) - eq_(repr(name), repr(u"姓名")) + eq_(repr(name), repr("姓名")) def test_lower_case_names(self): # Create table with quote defaults @@ -999,7 +999,7 @@ class NameNormalizeTest(fixtures.TestBase): ("NAME", "name", False), ("NA ME", "NA ME", False), ("NaMe", "NaMe", False), - (u"姓名", u"姓名", False), + ("姓名", "姓名", False), ("name", "name", True), # an all-lower case name needs quote forced ) def test_name_normalize(self, original, normalized, is_quote): @@ -1015,7 +1015,7 @@ class NameNormalizeTest(fixtures.TestBase): ("name", "NAME", False), ("NA ME", "NA ME", False), ("NaMe", "NaMe", False), - (u"姓名", u"姓名", False), + ("姓名", "姓名", False), (quoted_name("name", quote=True), "name", True), ) def test_name_denormalize(self, original, denormalized, is_quote): diff --git a/test/sql/test_text.py b/test/sql/test_text.py index 4fff0ed7ef..81b20f86f0 100644 --- a/test/sql/test_text.py +++ b/test/sql/test_text.py @@ -786,7 +786,7 @@ class TextErrorsTest(fixtures.TestBase, AssertsCompiledSQL): r"explicitly declared (?:with|as) text\(%(stmt)r\)" % {"stmt": util.ellipses_string(offending_clause)}, fn, - *arg + *arg, ) def test_where(self): diff --git a/test/sql/test_types.py b/test/sql/test_types.py index d930464a61..fb1bdad2e6 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -533,7 +533,7 @@ class _UserDefinedTypeFixture: def process_bind_param(self, value, dialect): if value is None: - value = u"" + value = "" return "BIND_IN" + value def process_result_value(self, value, dialect): @@ -575,7 +575,7 @@ class _UserDefinedTypeFixture: def process(value): if value is None: - value = u"" + value = "" return "BIND_IN" + impl_processor(value) @@ -2417,7 +2417,7 @@ class EnumTest(AssertsCompiledSQL, fixtures.TablesTest): *[v.name for v in values], name="myenum", native_enum=False, - create_constraint=True + create_constraint=True, ) # future method diff --git a/test/sql/test_update.py b/test/sql/test_update.py index f59f02a7b1..619cbd863b 100644 --- a/test/sql/test_update.py +++ b/test/sql/test_update.py @@ -829,7 +829,7 @@ class UpdateTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): (t, combination) for i, combination in zip(range(10), combinations()) ], - argnames="t, idx_to_value" + argnames="t, idx_to_value", ) @random_update_order_parameters() diff --git a/tox.ini b/tox.ini index 715f8d27b1..def2108260 100644 --- a/tox.ini +++ b/tox.ini @@ -144,13 +144,13 @@ deps= flake8 flake8-import-order flake8-builtins - flake8-docstrings>=1.3.1 + flake8-docstrings>=1.6.0 flake8-rst-docstrings # flake8-rst-docstrings dependency, leaving it here # in case it requires a version pin pydocstyle pygments - black==21.5b1 + black==21.12b0 commands = flake8 ./lib/ ./test/ ./examples/ setup.py doc/build/conf.py {posargs} black --check ./lib/ ./test/ ./examples/ setup.py doc/build/conf.py -- 2.47.2