From: Federico Caselli Date: Mon, 11 Apr 2022 20:21:20 +0000 (+0200) Subject: update flake8 noqa skips with proper syntax X-Git-Tag: rel_2_0_0b1~360 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11bf82447438a9d5d9df9d613bf245694d6120dc;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git update flake8 noqa skips with proper syntax Change-Id: I42ed77f559e3ee5b8c600d98457ee37803ef0ea6 --- diff --git a/lib/sqlalchemy/connectors/pyodbc.py b/lib/sqlalchemy/connectors/pyodbc.py index 59951cd041..c24fa344b2 100644 --- a/lib/sqlalchemy/connectors/pyodbc.py +++ b/lib/sqlalchemy/connectors/pyodbc.py @@ -180,7 +180,7 @@ class PyODBCConnector(Connector): dbapi_con = connection.connection.dbapi_connection version: Tuple[Union[int, str], ...] = () r = re.compile(r"[.\-]") - for n in r.split(dbapi_con.getinfo(self.dbapi.SQL_DBMS_VER)): # type: ignore[union-attr] # noqa E501 + for n in r.split(dbapi_con.getinfo(self.dbapi.SQL_DBMS_VER)): # type: ignore[union-attr] # noqa: E501 try: version += (int(n),) except ValueError: @@ -215,7 +215,7 @@ class PyODBCConnector(Connector): def get_isolation_level_values( self, dbapi_connection: interfaces.DBAPIConnection ) -> List[_IsolationLevel]: - return super().get_isolation_level_values(dbapi_connection) + [ # type: ignore # noqa E501 + return super().get_isolation_level_values(dbapi_connection) + [ # type: ignore # noqa: E501 "AUTOCOMMIT" ] diff --git a/lib/sqlalchemy/dialects/oracle/provision.py b/lib/sqlalchemy/dialects/oracle/provision.py index 8ce58782be..74ad1f2a4b 100644 --- a/lib/sqlalchemy/dialects/oracle/provision.py +++ b/lib/sqlalchemy/dialects/oracle/provision.py @@ -63,7 +63,7 @@ def stop_test_class_outside_fixtures(config, db, cls): try: with db.begin() as conn: # run magic command to get rid of identity sequences - # https://floo.bar/2019/11/29/drop-the-underlying-sequence-of-an-identity-column/ # noqa E501 + # https://floo.bar/2019/11/29/drop-the-underlying-sequence-of-an-identity-column/ # noqa: E501 conn.exec_driver_sql("purge recyclebin") except exc.DatabaseError as err: log.warning("purge recyclebin command failed: %s", err) diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 9994528049..503bcc03bc 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -1421,7 +1421,7 @@ E.g.:: ) -""" # noqa E501 +""" # noqa: E501 from collections import defaultdict import datetime as dt diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index ad31585fb2..4399c68fc4 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -2655,7 +2655,7 @@ class Engine( :meth:`_engine.Engine.get_execution_options` - """ # noqa E501 + """ # noqa: E501 return self._option_cls(self, opt) def get_execution_options(self) -> _ExecuteOptions: diff --git a/lib/sqlalchemy/engine/cursor.py b/lib/sqlalchemy/engine/cursor.py index 4f151e79cc..72102ac264 100644 --- a/lib/sqlalchemy/engine/cursor.py +++ b/lib/sqlalchemy/engine/cursor.py @@ -1637,7 +1637,7 @@ class CursorResult(Result): :ref:`tutorial_update_delete_rowcount` - in the :ref:`unified_tutorial` - """ # noqa E501 + """ # noqa: E501 try: return self.context.rowcount diff --git a/lib/sqlalchemy/engine/result.py b/lib/sqlalchemy/engine/result.py index 05b06e8465..dee80e13fd 100644 --- a/lib/sqlalchemy/engine/result.py +++ b/lib/sqlalchemy/engine/result.py @@ -502,7 +502,7 @@ class ResultInternal(InPlaceGenerative): ) for made_row in made_rows ] - if sig_row not in uniques and not uniques.add(sig_row) # type: ignore # noqa E501 + if sig_row not in uniques and not uniques.add(sig_row) # type: ignore # noqa: E501 ] else: interim_rows = made_rows @@ -749,7 +749,7 @@ class ResultInternal(InPlaceGenerative): real_result = self._real_result if self._real_result else self if ( - real_result._source_supports_scalars # type: ignore[attr-defined] # noqa E501 + real_result._source_supports_scalars # type: ignore[attr-defined] # noqa: E501 and len(indexes) == 1 ): self._generate_rows = False diff --git a/lib/sqlalchemy/event/base.py b/lib/sqlalchemy/event/base.py index 4174b1dbea..8ed4c64bac 100644 --- a/lib/sqlalchemy/event/base.py +++ b/lib/sqlalchemy/event/base.py @@ -319,7 +319,7 @@ class _HasEventsDispatch(Generic[_ET]): assert dispatch_target_cls is not None if ( hasattr(dispatch_target_cls, "__slots__") - and "_slots_dispatch" in dispatch_target_cls.__slots__ # type: ignore # noqa E501 + and "_slots_dispatch" in dispatch_target_cls.__slots__ # type: ignore # noqa: E501 ): dispatch_target_cls.dispatch = slots_dispatcher(cls) else: diff --git a/lib/sqlalchemy/event/legacy.py b/lib/sqlalchemy/event/legacy.py index 75e5be7fe0..8ae9b70352 100644 --- a/lib/sqlalchemy/event/legacy.py +++ b/lib/sqlalchemy/event/legacy.py @@ -51,7 +51,7 @@ def _legacy_signature( def leg(fn: Callable[..., Any]) -> Callable[..., Any]: if not hasattr(fn, "_legacy_signatures"): fn._legacy_signatures = [] # type: ignore[attr-defined] - fn._legacy_signatures.append((since, argnames, converter)) # type: ignore[attr-defined] # noqa E501 + fn._legacy_signatures.append((since, argnames, converter)) # type: ignore[attr-defined] # noqa: E501 return fn return leg diff --git a/lib/sqlalchemy/ext/associationproxy.py b/lib/sqlalchemy/ext/associationproxy.py index 194eabb64e..5ea268a2dd 100644 --- a/lib/sqlalchemy/ext/associationproxy.py +++ b/lib/sqlalchemy/ext/associationproxy.py @@ -1176,7 +1176,7 @@ class ObjectAssociationProxyInstance(AssociationProxyInstance[_T]): **{self.value_attr: other} ) - def __eq__(self, obj: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa E501 + def __eq__(self, obj: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa: E501 # note the has() here will fail for collections; eq_() # is only allowed with a scalar. if obj is None: @@ -1187,7 +1187,7 @@ class ObjectAssociationProxyInstance(AssociationProxyInstance[_T]): else: return self._comparator.has(**{self.value_attr: obj}) - def __ne__(self, obj: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa E501 + def __ne__(self, obj: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa: E501 # note the has() here will fail for collections; eq_() # is only allowed with a scalar. return self._comparator.has( @@ -1203,7 +1203,7 @@ class ColumnAssociationProxyInstance(AssociationProxyInstance[_T]): _target_is_object: bool = False _is_canonical = True - def __eq__(self, other: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa E501 + def __eq__(self, other: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa: E501 # special case "is None" to check for no related row as well expr = self._criterion_exists( self.remote_attr.operate(operators.eq, other) diff --git a/lib/sqlalchemy/ext/asyncio/scoping.py b/lib/sqlalchemy/ext/asyncio/scoping.py index 46c8f0baa7..8eca8c5248 100644 --- a/lib/sqlalchemy/ext/asyncio/scoping.py +++ b/lib/sqlalchemy/ext/asyncio/scoping.py @@ -85,7 +85,7 @@ class async_scoped_session(ScopedSessionMixin): the current scope. A function such as ``asyncio.current_task`` may be useful here. - """ # noqa E501 + """ # noqa: E501 self.session_factory = session_factory self.registry = ScopedRegistry(session_factory, scopefunc) diff --git a/lib/sqlalchemy/ext/asyncio/session.py b/lib/sqlalchemy/ext/asyncio/session.py index 18b38ee0a0..c39a8d6e0a 100644 --- a/lib/sqlalchemy/ext/asyncio/session.py +++ b/lib/sqlalchemy/ext/asyncio/session.py @@ -503,7 +503,7 @@ class AsyncSession(ReversibleProxy): blocking-style code, which will be translated to implicitly async calls at the point of invoking IO on the database drivers. - """ # noqa E501 + """ # noqa: E501 return self.sync_session.get_bind( mapper=mapper, clause=clause, bind=bind, **kw diff --git a/lib/sqlalchemy/log.py b/lib/sqlalchemy/log.py index 2feade04ee..d463f5b9a3 100644 --- a/lib/sqlalchemy/log.py +++ b/lib/sqlalchemy/log.py @@ -64,10 +64,10 @@ def _qual_logger_name_for_cls(cls: Type["Identified"]) -> str: def class_logger(cls: Type[_IT]) -> Type[_IT]: logger = logging.getLogger(_qual_logger_name_for_cls(cls)) - cls._should_log_debug = lambda self: logger.isEnabledFor( # type: ignore[assignment] # noqa E501 + cls._should_log_debug = lambda self: logger.isEnabledFor( # type: ignore[assignment] # noqa: E501 logging.DEBUG ) - cls._should_log_info = lambda self: logger.isEnabledFor( # type: ignore[assignment] # noqa E501 + cls._should_log_info = lambda self: logger.isEnabledFor( # type: ignore[assignment] # noqa: E501 logging.INFO ) cls.logger = logger diff --git a/lib/sqlalchemy/orm/base.py b/lib/sqlalchemy/orm/base.py index cb30701037..a1a9442dca 100644 --- a/lib/sqlalchemy/orm/base.py +++ b/lib/sqlalchemy/orm/base.py @@ -616,7 +616,7 @@ class SQLORMOperations(SQLCoreOperations[_T], TypingOnly): def and_(self, *criteria): ... - def any(self, criterion=None, **kwargs): # noqa A001 + def any(self, criterion=None, **kwargs): # noqa: A001 ... def has(self, criterion=None, **kwargs): diff --git a/lib/sqlalchemy/orm/decl_api.py b/lib/sqlalchemy/orm/decl_api.py index 4e28eeff7f..4a699f63bb 100644 --- a/lib/sqlalchemy/orm/decl_api.py +++ b/lib/sqlalchemy/orm/decl_api.py @@ -249,7 +249,7 @@ class declared_attr(interfaces._MappedAttribute[_T]): :ref:`orm_declarative_dataclasses_mixin` - illustrates special forms for use with Python dataclasses - """ # noqa E501 + """ # noqa: E501 if typing.TYPE_CHECKING: diff --git a/lib/sqlalchemy/orm/loading.py b/lib/sqlalchemy/orm/loading.py index 16ab1f4c84..6f4c654ce4 100644 --- a/lib/sqlalchemy/orm/loading.py +++ b/lib/sqlalchemy/orm/loading.py @@ -757,7 +757,7 @@ def _instance_processor( # test.orm.inheritance.test_basic -> # EagerTargetingTest.test_adapt_stringency # OptimizedLoadTest.test_column_expression_joined - # PolymorphicOnNotLocalTest.test_polymorphic_on_column_prop # noqa E501 + # PolymorphicOnNotLocalTest.test_polymorphic_on_column_prop # noqa: E501 # adapted_col = adapter.columns[col] diff --git a/lib/sqlalchemy/pool/base.py b/lib/sqlalchemy/pool/base.py index 9ab1477100..e22848fd25 100644 --- a/lib/sqlalchemy/pool/base.py +++ b/lib/sqlalchemy/pool/base.py @@ -269,7 +269,7 @@ class Pool(log.Identified, event.EventTarget): # mypy seems to get super confused assigning functions to # attributes - self._invoke_creator = self._should_wrap_creator(creator) # type: ignore # noqa E501 + self._invoke_creator = self._should_wrap_creator(creator) # type: ignore # noqa: E501 @_creator.deleter def _creator(self) -> None: @@ -609,7 +609,7 @@ class _ConnectionRecord(ConnectionPoolEntry): dbapi_connection: Optional[DBAPIConnection] @property - def driver_connection(self) -> Optional[Any]: # type: ignore[override] # mypy#4125 # noqa E501 + def driver_connection(self) -> Optional[Any]: # type: ignore[override] # mypy#4125 # noqa: E501 if self.dbapi_connection is None: return None else: @@ -632,7 +632,7 @@ class _ConnectionRecord(ConnectionPoolEntry): return {} @util.memoized_property - def record_info(self) -> Optional[Dict[str, Any]]: # type: ignore[override] # mypy#4125 # noqa E501 + def record_info(self) -> Optional[Dict[str, Any]]: # type: ignore[override] # mypy#4125 # noqa: E501 return {} @classmethod @@ -1081,7 +1081,7 @@ class _AdhocProxiedConnection(PoolProxiedConnection): self._is_valid = False @property - def record_info(self) -> Optional[Dict[str, Any]]: # type: ignore[override] # mypy#4125 # noqa E501 + def record_info(self) -> Optional[Dict[str, Any]]: # type: ignore[override] # mypy#4125 # noqa: E501 return self._connection_record.record_info def cursor(self, *args: Any, **kwargs: Any) -> DBAPICursor: @@ -1147,7 +1147,7 @@ class _ConnectionFairy(PoolProxiedConnection): _connection_record: Optional[_ConnectionRecord] @property - def driver_connection(self) -> Optional[Any]: # type: ignore[override] # mypy#4125 # noqa E501 + def driver_connection(self) -> Optional[Any]: # type: ignore[override] # mypy#4125 # noqa: E501 if self._connection_record is None: return None return self._connection_record.driver_connection @@ -1322,7 +1322,7 @@ class _ConnectionFairy(PoolProxiedConnection): return self._connection_record.info @property - def record_info(self) -> Optional[Dict[str, Any]]: # type: ignore[override] # mypy#4125 # noqa E501 + def record_info(self) -> Optional[Dict[str, Any]]: # type: ignore[override] # mypy#4125 # noqa: E501 if self._connection_record is None: return None else: diff --git a/lib/sqlalchemy/pool/events.py b/lib/sqlalchemy/pool/events.py index be2b406a34..e961df1a3b 100644 --- a/lib/sqlalchemy/pool/events.py +++ b/lib/sqlalchemy/pool/events.py @@ -50,7 +50,7 @@ class PoolEvents(event.Events[Pool]): # will associate with engine.pool event.listen(engine, 'checkout', my_on_checkout) - """ # noqa E501 + """ # noqa: E501 _target_class_doc = "SomeEngineOrPool" _dispatch_target = Pool diff --git a/lib/sqlalchemy/sql/_selectable_constructors.py b/lib/sqlalchemy/sql/_selectable_constructors.py index 7896c02c24..37d44976a2 100644 --- a/lib/sqlalchemy/sql/_selectable_constructors.py +++ b/lib/sqlalchemy/sql/_selectable_constructors.py @@ -157,7 +157,7 @@ def exists( :meth:`_sql.SelectBase.exists` - method to transform a ``SELECT`` to an ``EXISTS`` clause. - """ # noqa E501 + """ # noqa: E501 return Exists(__argument) diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py index f766a5ac50..7fb9c26026 100644 --- a/lib/sqlalchemy/sql/base.py +++ b/lib/sqlalchemy/sql/base.py @@ -1172,7 +1172,7 @@ class Executable(roles.StatementRole, Generative): :ref:`orm_queryguide_execution_options` - documentation on all ORM-specific execution options - """ # noqa E501 + """ # noqa: E501 if "isolation_level" in kw: raise exc.ArgumentError( "'isolation_level' execution option may only be specified " diff --git a/lib/sqlalchemy/sql/crud.py b/lib/sqlalchemy/sql/crud.py index f6db2c4b25..e4408cd316 100644 --- a/lib/sqlalchemy/sql/crud.py +++ b/lib/sqlalchemy/sql/crud.py @@ -430,7 +430,7 @@ def _key_getters_for_crud_column( _column_as_key = functools.partial( # type: ignore coercions.expect_as_key, roles.DMLColumnRole ) - _getattr_col_key = _col_bind_name = operator.attrgetter("key") # type: ignore # noqa E501 + _getattr_col_key = _col_bind_name = operator.attrgetter("key") # type: ignore # noqa: E501 return _column_as_key, _getattr_col_key, _col_bind_name diff --git a/lib/sqlalchemy/sql/dml.py b/lib/sqlalchemy/sql/dml.py index f23ba2e6e2..8307f64003 100644 --- a/lib/sqlalchemy/sql/dml.py +++ b/lib/sqlalchemy/sql/dml.py @@ -453,7 +453,7 @@ class UpdateBase( :ref:`tutorial_insert_returning` - in the :ref:`unified_tutorial` - """ # noqa E501 + """ # noqa: E501 if self._return_defaults: raise exc.InvalidRequestError( "return_defaults() is already configured on this statement" @@ -610,7 +610,7 @@ class UpdateBase( :ref:`queryguide_inspection` - ORM background - """ # noqa E501 + """ # noqa: E501 meth = DMLState.get_plugin_class( self ).get_returning_column_descriptions diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 7ea09e7583..8057582835 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -2668,11 +2668,11 @@ class BooleanClauseList(ClauseList, ColumnElement[bool]): if lcc > 1: # multiple elements. Return regular BooleanClauseList # which will link elements against the operator. - return cls._construct_raw(operator, convert_clauses) # type: ignore # noqa E501 + return cls._construct_raw(operator, convert_clauses) # type: ignore # noqa: E501 elif lcc == 1: # just one element. return it as a single boolean element, # not a list and discard the operator. - return convert_clauses[0] # type: ignore[no-any-return] # noqa E501 + return convert_clauses[0] # type: ignore[no-any-return] # noqa: E501 else: # no elements period. deprecated use case. return an empty # ClauseList construct that generates nothing unless it has @@ -2689,7 +2689,7 @@ class BooleanClauseList(ClauseList, ColumnElement[bool]): }, version="1.4", ) - return cls._construct_raw(operator) # type: ignore[no-any-return] # noqa E501 + return cls._construct_raw(operator) # type: ignore[no-any-return] # noqa: E501 @classmethod def _construct_for_whereclause( diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py index db4bb58373..a66a1eb929 100644 --- a/lib/sqlalchemy/sql/functions.py +++ b/lib/sqlalchemy/sql/functions.py @@ -200,7 +200,7 @@ class FunctionElement(Executable, ColumnElement[_T], FromClause, Generative): :meth:`_functions.FunctionElement.column_valued` - """ # noqa E501 + """ # noqa: E501 return ScalarFunctionColumn(self, name, type_) @@ -270,7 +270,7 @@ class FunctionElement(Executable, ColumnElement[_T], FromClause, Generative): :meth:`_sql.TableValuedAlias.render_derived` - renders the alias using a derived column clause, e.g. ``AS name(col1, col2, ...)`` - """ # noqa 501 + """ # noqa: 501 new_func = self._generate() @@ -311,7 +311,7 @@ class FunctionElement(Executable, ColumnElement[_T], FromClause, Generative): :meth:`_functions.FunctionElement.table_valued` - """ # noqa 501 + """ # noqa: 501 return self.alias(name=name).column @@ -336,7 +336,7 @@ class FunctionElement(Executable, ColumnElement[_T], FromClause, Generative): :meth:`_functions.FunctionElement.table_valued` - generates table-valued SQL function expressions. - """ # noqa E501 + """ # noqa: E501 return self.c @util.ro_memoized_property @@ -1197,19 +1197,19 @@ class coalesce(ReturnTypeFromArgs[_T]): inherit_cache = True -class max(ReturnTypeFromArgs[_T]): # noqa A001 +class max(ReturnTypeFromArgs[_T]): # noqa: A001 """The SQL MAX() aggregate function.""" inherit_cache = True -class min(ReturnTypeFromArgs[_T]): # noqa A001 +class min(ReturnTypeFromArgs[_T]): # noqa: A001 """The SQL MIN() aggregate function.""" inherit_cache = True -class sum(ReturnTypeFromArgs[_T]): # noqa A001 +class sum(ReturnTypeFromArgs[_T]): # noqa: A001 """The SQL SUM() aggregate function.""" inherit_cache = True diff --git a/lib/sqlalchemy/sql/operators.py b/lib/sqlalchemy/sql/operators.py index 7db1631c85..ebc8a28cee 100644 --- a/lib/sqlalchemy/sql/operators.py +++ b/lib/sqlalchemy/sql/operators.py @@ -417,7 +417,7 @@ class custom_op(OperatorType, Generic[_T]): if hasattr(left, "__sa_operate__"): return left.operate(self, right, *other, **kwargs) elif self.python_impl: - return self.python_impl(left, right, *other, **kwargs) # type: ignore # noqa E501 + return self.python_impl(left, right, *other, **kwargs) # type: ignore # noqa: E501 else: raise exc.InvalidRequestError( f"Custom operator {self.opstring!r} can't be used with " diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index 883439ca53..c9b67caca3 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -683,10 +683,10 @@ class Table(DialectKWArgs, HasSchemaAttr, TableClause): by the SQLAlchemy dialect. .. note:: setting this flag to ``False`` will not provide - case-insensitive behavior for table reflection; table reflection - will always search for a mixed-case name in a case sensitive - fashion. Case insensitive names are specified in SQLAlchemy only - by stating the name with all lower case characters. + case-insensitive behavior for table reflection; table reflection + will always search for a mixed-case name in a case sensitive + fashion. Case insensitive names are specified in SQLAlchemy only + by stating the name with all lower case characters. :param quote_schema: same as 'quote' but applies to the schema identifier. @@ -707,10 +707,10 @@ class Table(DialectKWArgs, HasSchemaAttr, TableClause): specify the special symbol :attr:`.BLANK_SCHEMA`. .. versionadded:: 1.0.14 Added the :attr:`.BLANK_SCHEMA` symbol to - allow a :class:`_schema.Table` - to have a blank schema name even when the - parent :class:`_schema.MetaData` specifies - :paramref:`_schema.MetaData.schema`. + allow a :class:`_schema.Table` + to have a blank schema name even when the + parent :class:`_schema.MetaData` specifies + :paramref:`_schema.MetaData.schema`. The quoting rules for the schema name are the same as those for the ``name`` parameter, in that quoting is applied for reserved words or @@ -730,7 +730,7 @@ class Table(DialectKWArgs, HasSchemaAttr, TableClause): See the documentation regarding an individual dialect at :ref:`dialect_toplevel` for detail on documented arguments. - """ # noqa E501 + """ # noqa: E501 # __init__ is overridden to prevent __new__ from # calling the superclass constructor. @@ -1834,7 +1834,7 @@ class Column(DialectKWArgs, SchemaItem, ColumnClause[_T]): parameter to :class:`_schema.Column`. - """ # noqa E501 + """ # noqa: E501, RST201, RST202 name = kwargs.pop("name", None) type_ = kwargs.pop("type_", None) diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index 292225ce2e..d7cc327333 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -288,7 +288,7 @@ class Selectable(ReturnsRows): object, returning a copy of this :class:`_expression.FromClause`. """ - return util.preloaded.sql_util.ClauseAdapter(alias).traverse( # type: ignore # noqa E501 + return util.preloaded.sql_util.ClauseAdapter(alias).traverse( # type: ignore # noqa: E501 self ) @@ -1040,7 +1040,7 @@ class SelectLabelStyle(Enum): .. versionadded:: 1.4 - """ # noqa E501 + """ # noqa: E501 LABEL_STYLE_TABLENAME_PLUS_COL = 1 """Label style indicating all columns should be labeled as @@ -1691,7 +1691,7 @@ class TableValuedAlias(LateralFromClause, Alias): :ref:`tutorial_functions_table_valued` - in the :ref:`unified_tutorial` - """ # noqa E501 + """ # noqa: E501 __visit_name__ = "table_valued_alias" @@ -1820,7 +1820,7 @@ class TableValuedAlias(LateralFromClause, Alias): datatype specification with each column. This is a special syntax currently known to be required by PostgreSQL for some SQL functions. - """ # noqa E501 + """ # noqa: E501 # note: don't use the @_generative system here, keep a reference # to the original object. otherwise you can have re-use of the @@ -5657,7 +5657,7 @@ class Select( .. versionadded:: 1.4.23 - """ # noqa E501 + """ # noqa: E501 # memoizations should be cleared here as of # I95c560ffcbfa30b26644999412fb6a385125f663 , asserting this diff --git a/lib/sqlalchemy/sql/traversals.py b/lib/sqlalchemy/sql/traversals.py index c3653c2647..cbc4e9e707 100644 --- a/lib/sqlalchemy/sql/traversals.py +++ b/lib/sqlalchemy/sql/traversals.py @@ -146,7 +146,7 @@ class HasShallowCopy(HasTraverseInternals): "_generated_shallow_from_dict_traversal", ) - cls._generated_shallow_from_dict_traversal = shallow_from_dict # type: ignore # noqa E501 + cls._generated_shallow_from_dict_traversal = shallow_from_dict # type: ignore # noqa: E501 shallow_from_dict(self, d) @@ -164,7 +164,7 @@ class HasShallowCopy(HasTraverseInternals): cls._traverse_internals, "_generated_shallow_to_dict_traversal" ) - cls._generated_shallow_to_dict_traversal = shallow_to_dict # type: ignore # noqa E501 + cls._generated_shallow_to_dict_traversal = shallow_to_dict # type: ignore # noqa: E501 return shallow_to_dict(self) def _shallow_copy_to( diff --git a/lib/sqlalchemy/sql/type_api.py b/lib/sqlalchemy/sql/type_api.py index 82adf4a4f9..3293ecac03 100644 --- a/lib/sqlalchemy/sql/type_api.py +++ b/lib/sqlalchemy/sql/type_api.py @@ -176,7 +176,7 @@ class TypeEngine(Visitable, Generic[_T]): op_fn, addtl_kw = default_comparator.operator_lookup[op.__name__] if kwargs: addtl_kw = addtl_kw.union(kwargs) - return op_fn(self.expr, op, other, reverse=True, **addtl_kw) # type: ignore # noqa E501 + return op_fn(self.expr, op, other, reverse=True, **addtl_kw) # type: ignore # noqa: E501 def _adapt_expression( self, @@ -1656,14 +1656,14 @@ class TypeDecorator(SchemaEventTarget, ExternalType, TypeEngine[_T]): def comparator_factory( # type: ignore # mypy properties bug self, ) -> _ComparatorFactory[Any]: - if TypeDecorator.Comparator in self.impl.comparator_factory.__mro__: # type: ignore # noqa E501 + if TypeDecorator.Comparator in self.impl.comparator_factory.__mro__: # type: ignore # noqa: E501 return self.impl.comparator_factory else: # reconcile the Comparator class on the impl with that # of TypeDecorator return type( "TDComparator", - (TypeDecorator.Comparator, self.impl.comparator_factory), # type: ignore # noqa E501 + (TypeDecorator.Comparator, self.impl.comparator_factory), # type: ignore # noqa: E501 {}, ) @@ -2173,7 +2173,7 @@ class TypeDecorator(SchemaEventTarget, ExternalType, TypeEngine[_T]): # mypy property bug @property - def sort_key_function(self) -> Optional[Callable[[Any], Any]]: # type: ignore # noqa E501 + def sort_key_function(self) -> Optional[Callable[[Any], Any]]: # type: ignore # noqa: E501 return self.impl_instance.sort_key_function def __repr__(self) -> str: diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py index 80711c4b57..2790bf3735 100644 --- a/lib/sqlalchemy/sql/util.py +++ b/lib/sqlalchemy/sql/util.py @@ -40,11 +40,11 @@ from .base import _from_objects from .base import ColumnSet from .cache_key import HasCacheKey # noqa from .ddl import sort_tables # noqa -from .elements import _find_columns # noqa +from .elements import _find_columns from .elements import _label_reference from .elements import _textual_label_reference from .elements import BindParameter -from .elements import ClauseElement # noqa +from .elements import ClauseElement from .elements import ColumnClause from .elements import ColumnElement from .elements import Grouping diff --git a/lib/sqlalchemy/sql/visitors.py b/lib/sqlalchemy/sql/visitors.py index 081faf1e9f..5ff746bb3a 100644 --- a/lib/sqlalchemy/sql/visitors.py +++ b/lib/sqlalchemy/sql/visitors.py @@ -130,9 +130,9 @@ class Visitable: try: meth = getter(visitor) except AttributeError as err: - return visitor.visit_unsupported_compilation(self, err, **kw) # type: ignore # noqa E501 + return visitor.visit_unsupported_compilation(self, err, **kw) # type: ignore # noqa: E501 else: - return meth(self, **kw) # type: ignore # noqa E501 + return meth(self, **kw) # type: ignore # noqa: E501 cls._compiler_dispatch = ( # type: ignore cls._original_compiler_dispatch diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index a5c601995e..01c7b07686 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -1420,7 +1420,7 @@ class SuiteRequirements(Requirements): def greenlet(self): def go(config): try: - import greenlet # noqa F401 + import greenlet # noqa: F401 except ImportError: return False else: diff --git a/lib/sqlalchemy/util/_collections.py b/lib/sqlalchemy/util/_collections.py index bcb2ad4230..eb5b16b650 100644 --- a/lib/sqlalchemy/util/_collections.py +++ b/lib/sqlalchemy/util/_collections.py @@ -388,11 +388,11 @@ class UniqueAppender(Generic[_T]): self.data = data self._unique = {} if via: - self._data_appender = getattr(data, via) # type: ignore[assignment] # noqa E501 + self._data_appender = getattr(data, via) # type: ignore[assignment] # noqa: E501 elif hasattr(data, "append"): - self._data_appender = cast("List[_T]", data).append # type: ignore[assignment] # noqa E501 + self._data_appender = cast("List[_T]", data).append # type: ignore[assignment] # noqa: E501 elif hasattr(data, "add"): - self._data_appender = cast("Set[_T]", data).add # type: ignore[assignment] # noqa E501 + self._data_appender = cast("Set[_T]", data).add # type: ignore[assignment] # noqa: E501 def append(self, item: _T) -> None: id_ = id(item) diff --git a/lib/sqlalchemy/util/_concurrency_py3k.py b/lib/sqlalchemy/util/_concurrency_py3k.py index b17b408dd7..28b062d3d9 100644 --- a/lib/sqlalchemy/util/_concurrency_py3k.py +++ b/lib/sqlalchemy/util/_concurrency_py3k.py @@ -122,7 +122,7 @@ def await_fallback(awaitable: Awaitable[_T]) -> _T: "loop is already running; can't call await_() here. " "Was IO attempted in an unexpected place?" ) - return loop.run_until_complete(awaitable) # type: ignore[no-any-return] # noqa E501 + return loop.run_until_complete(awaitable) # type: ignore[no-any-return] # noqa: E501 return current.driver.switch(awaitable) # type: ignore[no-any-return] diff --git a/lib/sqlalchemy/util/_py_collections.py b/lib/sqlalchemy/util/_py_collections.py index 1016871aa7..d649a0bea7 100644 --- a/lib/sqlalchemy/util/_py_collections.py +++ b/lib/sqlalchemy/util/_py_collections.py @@ -195,7 +195,7 @@ class OrderedSet(Set[_T]): return self # type: ignore def union(self, *other: Iterable[_S]) -> "OrderedSet[Union[_T, _S]]": - result: "OrderedSet[Union[_T, _S]]" = self.__class__(self) # type: ignore # noqa E501 + result: "OrderedSet[Union[_T, _S]]" = self.__class__(self) # type: ignore # noqa: E501 for o in other: result.update(o) return result diff --git a/lib/sqlalchemy/util/concurrency.py b/lib/sqlalchemy/util/concurrency.py index 778d1275b9..c1d53cc16f 100644 --- a/lib/sqlalchemy/util/concurrency.py +++ b/lib/sqlalchemy/util/concurrency.py @@ -12,7 +12,7 @@ import typing have_greenlet = False greenlet_error = None try: - import greenlet # type: ignore # noqa F401 + import greenlet # type: ignore # noqa: F401 except ImportError as e: greenlet_error = str(e) pass @@ -25,9 +25,9 @@ else: from ._concurrency_py3k import AsyncAdaptedLock as AsyncAdaptedLock from ._concurrency_py3k import ( _util_async_run as _util_async_run, - ) # noqa F401 + ) # noqa: F401 from ._concurrency_py3k import ( - _util_async_run_coroutine_function as _util_async_run_coroutine_function, # noqa F401, E501 + _util_async_run_coroutine_function as _util_async_run_coroutine_function, # noqa: F401, E501 ) if not typing.TYPE_CHECKING and not have_greenlet: @@ -45,23 +45,23 @@ if not typing.TYPE_CHECKING and not have_greenlet: else "" ) - def is_exit_exception(e): # noqa F811 + def is_exit_exception(e): return not isinstance(e, Exception) - def await_only(thing): # type: ignore # noqa F811 + def await_only(thing): # type: ignore _not_implemented() - def await_fallback(thing): # type: ignore # noqa F81 + def await_fallback(thing): # type: ignore return thing - def greenlet_spawn(fn, *args, **kw): # type: ignore # noqa F81 + def greenlet_spawn(fn, *args, **kw): # type: ignore _not_implemented() - def AsyncAdaptedLock(*args, **kw): # type: ignore # noqa F81 + def AsyncAdaptedLock(*args, **kw): # type: ignore _not_implemented() - def _util_async_run(fn, *arg, **kw): # type: ignore # noqa F81 + def _util_async_run(fn, *arg, **kw): # type: ignore return fn(*arg, **kw) - def _util_async_run_coroutine_function(fn, *arg, **kw): # type: ignore # noqa F81 + def _util_async_run_coroutine_function(fn, *arg, **kw): # type: ignore _not_implemented() diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py index 00097fd9e7..8f0ec700f9 100644 --- a/lib/sqlalchemy/util/langhelpers.py +++ b/lib/sqlalchemy/util/langhelpers.py @@ -510,7 +510,7 @@ def get_callable_argspec( fn.__init__, no_self=no_self, _is_init=True ) elif hasattr(fn, "__func__"): - return compat.inspect_getfullargspec(fn.__func__) # type: ignore[attr-defined] # noqa E501 + return compat.inspect_getfullargspec(fn.__func__) # type: ignore[attr-defined] # noqa: E501 elif hasattr(fn, "__call__"): if inspect.ismethod(fn.__call__): # type: ignore [operator] return get_callable_argspec( @@ -711,7 +711,7 @@ def create_proxy_methods( else: code = ( "def %(name)s%(grouped_args)s:\n" - " return %(self_arg)s._proxied.%(name)s(%(apply_kw_proxied)s)" # noqa E501 + " return %(self_arg)s._proxied.%(name)s(%(apply_kw_proxied)s)" # noqa: E501 % metadata ) @@ -1544,7 +1544,7 @@ def assert_arg_type( if isinstance(argtype, tuple): raise exc.ArgumentError( "Argument '%s' is expected to be one of type %s, got '%s'" - % (name, " or ".join("'%s'" % a for a in argtype), type(arg)) # type: ignore # noqa E501 + % (name, " or ".join("'%s'" % a for a in argtype), type(arg)) # type: ignore # noqa: E501 ) else: raise exc.ArgumentError( diff --git a/lib/sqlalchemy/util/typing.py b/lib/sqlalchemy/util/typing.py index 0b9d8c62c7..df54017da7 100644 --- a/lib/sqlalchemy/util/typing.py +++ b/lib/sqlalchemy/util/typing.py @@ -47,16 +47,16 @@ else: if typing.TYPE_CHECKING or compat.py310: from typing import Annotated as Annotated else: - from typing_extensions import Annotated as Annotated # noqa F401 + from typing_extensions import Annotated as Annotated # noqa: F401 if typing.TYPE_CHECKING or compat.py38: from typing import Literal as Literal from typing import Protocol as Protocol from typing import TypedDict as TypedDict else: - from typing_extensions import Literal as Literal # noqa F401 - from typing_extensions import Protocol as Protocol # noqa F401 - from typing_extensions import TypedDict as TypedDict # noqa F401 + from typing_extensions import Literal as Literal # noqa: F401 + from typing_extensions import Protocol as Protocol # noqa: F401 + from typing_extensions import TypedDict as TypedDict # noqa: F401 # copied from TypeShed, required in order to implement # MutableMapping.update() @@ -77,8 +77,8 @@ if typing.TYPE_CHECKING or not compat.py310: from typing_extensions import Concatenate as Concatenate from typing_extensions import ParamSpec as ParamSpec else: - from typing import Concatenate as Concatenate # noqa F401 - from typing import ParamSpec as ParamSpec # noqa F401 + from typing import Concatenate as Concatenate # noqa: F401 + from typing import ParamSpec as ParamSpec # noqa: F401 def de_stringify_annotation( diff --git a/test/aaa_profiling/test_orm.py b/test/aaa_profiling/test_orm.py index e03a8415d0..23f03cc04f 100644 --- a/test/aaa_profiling/test_orm.py +++ b/test/aaa_profiling/test_orm.py @@ -1196,7 +1196,7 @@ class AnnotatedOverheadTest(NoCache, fixtures.MappedTest): for i in range(100): # test counts assume objects remain in the session # from previous run - r = q.all() # noqa F841 + r = q.all() # noqa: F841 go() @@ -1212,7 +1212,7 @@ class AnnotatedOverheadTest(NoCache, fixtures.MappedTest): for i in range(100): # test counts assume objects remain in the session # from previous run - r = q.all() # noqa F841 + r = q.all() # noqa: F841 go() @@ -1226,7 +1226,7 @@ class AnnotatedOverheadTest(NoCache, fixtures.MappedTest): for i in range(100): # test counts assume objects remain in the session # from previous run - r = q.all() # noqa F841 + r = q.all() # noqa: F841 go() @@ -1240,7 +1240,7 @@ class AnnotatedOverheadTest(NoCache, fixtures.MappedTest): for i in range(100): # test counts assume objects remain in the session # from previous run - r = q.all() # noqa F841 + r = q.all() # noqa: F841 go() @@ -1255,7 +1255,7 @@ class AnnotatedOverheadTest(NoCache, fixtures.MappedTest): for i in range(100): # test counts assume objects remain in the session # from previous run - r = q.all() # noqa F841 + r = q.all() # noqa: F841 go() @@ -1270,7 +1270,7 @@ class AnnotatedOverheadTest(NoCache, fixtures.MappedTest): for i in range(100): # test counts assume objects remain in the session # from previous run - r = q.all() # noqa F841 + r = q.all() # noqa: F841 go() @@ -1284,7 +1284,7 @@ class AnnotatedOverheadTest(NoCache, fixtures.MappedTest): for i in range(100): # test counts assume objects remain in the session # from previous run - r = q.all() # noqa F841 + r = q.all() # noqa: F841 go() @@ -1299,7 +1299,7 @@ class AnnotatedOverheadTest(NoCache, fixtures.MappedTest): for i in range(100): # test counts assume objects remain in the session # from previous run - r = q.all() # noqa F841 + r = q.all() # noqa: F841 go() @@ -1313,6 +1313,6 @@ class AnnotatedOverheadTest(NoCache, fixtures.MappedTest): for i in range(100): # test counts assume objects remain in the session # from previous run - r = q.all() # noqa F841 + r = q.all() # noqa: F841 go() diff --git a/test/dialect/oracle/test_reflection.py b/test/dialect/oracle/test_reflection.py index 08d727cb0d..bf76dca43d 100644 --- a/test/dialect/oracle/test_reflection.py +++ b/test/dialect/oracle/test_reflection.py @@ -820,7 +820,7 @@ class TypeReflectionTest(fixtures.TestBase): oracle.FLOAT(16), ), # using conversion (FLOAT(), DOUBLE_PRECISION()), - # from https://docs.oracle.com/cd/B14117_01/server.101/b10758/sqlqr06.htm # noqa E501 + # from https://docs.oracle.com/cd/B14117_01/server.101/b10758/sqlqr06.htm # noqa: E501 # DOUBLE PRECISION == precision 126 # REAL == precision 63 (oracle.FLOAT(126), DOUBLE_PRECISION()), diff --git a/test/ext/mypy/plugin_files/ensure_descriptor_type_fully_inferred.py b/test/ext/mypy/plugin_files/ensure_descriptor_type_fully_inferred.py index 1a89041474..9ee9c76f46 100644 --- a/test/ext/mypy/plugin_files/ensure_descriptor_type_fully_inferred.py +++ b/test/ext/mypy/plugin_files/ensure_descriptor_type_fully_inferred.py @@ -16,5 +16,5 @@ class User: u1 = User() -# EXPECTED_MYPY: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str") # noqa E501 +# EXPECTED_MYPY: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str") # noqa: E501 p: str = u1.name diff --git a/test/ext/mypy/plugin_files/ensure_descriptor_type_noninferred.py b/test/ext/mypy/plugin_files/ensure_descriptor_type_noninferred.py index b1dabe8dc9..e8ce35114e 100644 --- a/test/ext/mypy/plugin_files/ensure_descriptor_type_noninferred.py +++ b/test/ext/mypy/plugin_files/ensure_descriptor_type_noninferred.py @@ -19,5 +19,5 @@ class User: u1 = User() -# EXPECTED_MYPY: Incompatible types in assignment (expression has type "Optional[str]", variable has type "Optional[int]") # noqa E501 +# EXPECTED_MYPY: Incompatible types in assignment (expression has type "Optional[str]", variable has type "Optional[int]") # noqa: E501 p: Optional[int] = u1.name diff --git a/test/ext/mypy/plugin_files/ensure_descriptor_type_semiinferred.py b/test/ext/mypy/plugin_files/ensure_descriptor_type_semiinferred.py index 2154ff074c..d72649b62a 100644 --- a/test/ext/mypy/plugin_files/ensure_descriptor_type_semiinferred.py +++ b/test/ext/mypy/plugin_files/ensure_descriptor_type_semiinferred.py @@ -22,5 +22,5 @@ class User: u1 = User() -# EXPECTED_MYPY: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str") # noqa E501 +# EXPECTED_MYPY: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str") # noqa: E501 p: str = u1.name diff --git a/test/ext/mypy/plugin_files/invalid_noninferred_lh_type.py b/test/ext/mypy/plugin_files/invalid_noninferred_lh_type.py index 5084de7225..e9ff303ca7 100644 --- a/test/ext/mypy/plugin_files/invalid_noninferred_lh_type.py +++ b/test/ext/mypy/plugin_files/invalid_noninferred_lh_type.py @@ -11,5 +11,5 @@ class User: __tablename__ = "user" id = Column(Integer(), primary_key=True) - # EXPECTED: Left hand assignment 'name: "int"' not compatible with ORM mapped expression # noqa E501 + # EXPECTED: Left hand assignment 'name: "int"' not compatible with ORM mapped expression # noqa: E501 name: int = Column(String()) diff --git a/test/ext/mypy/plugin_files/typeless_fk_col_cant_infer.py b/test/ext/mypy/plugin_files/typeless_fk_col_cant_infer.py index beb4a7a5d0..0b933db478 100644 --- a/test/ext/mypy/plugin_files/typeless_fk_col_cant_infer.py +++ b/test/ext/mypy/plugin_files/typeless_fk_col_cant_infer.py @@ -20,6 +20,6 @@ class Address: __tablename__ = "address" id = Column(Integer, primary_key=True) - # EXPECTED: Can't infer type from ORM mapped expression assigned to attribute 'user_id'; # noqa E501 + # EXPECTED: Can't infer type from ORM mapped expression assigned to attribute 'user_id'; # noqa: E501 user_id = Column(ForeignKey("user.id")) email_address = Column(String) diff --git a/test/ext/mypy/test_mypy_plugin_py3k.py b/test/ext/mypy/test_mypy_plugin_py3k.py index daa8a85779..3a932021de 100644 --- a/test/ext/mypy/test_mypy_plugin_py3k.py +++ b/test/ext/mypy/test_mypy_plugin_py3k.py @@ -231,7 +231,7 @@ class MypyPluginTest(fixtures.TestBase): is_re = bool(m.group(2)) is_type = bool(m.group(3)) - expected_msg = re.sub(r"# noqa ?.*", "", m.group(4)) + expected_msg = re.sub(r"# noqa[:]? ?.*", "", m.group(4)) if is_type: is_mypy = is_re = True expected_msg = f'Revealed type is "{expected_msg}"' @@ -281,7 +281,7 @@ class MypyPluginTest(fixtures.TestBase): for idx, (typ, errmsg) in enumerate(output): if is_re: if re.match( - rf".*{filename}\:{num}\: {typ}\: {prefix}{msg}", # noqa E501 + rf".*{filename}\:{num}\: {typ}\: {prefix}{msg}", # noqa: E501 errmsg, ): break diff --git a/test/orm/declarative/test_typed_mapping.py b/test/orm/declarative/test_typed_mapping.py index 57ce969ac8..9ddd2f40e2 100644 --- a/test/orm/declarative/test_typed_mapping.py +++ b/test/orm/declarative/test_typed_mapping.py @@ -621,7 +621,7 @@ class RelationshipLHSTest(fixtures.TestBase, testing.AssertsCompiledSQL): __sa_dataclass_metadata_key__ = "sa" id: Mapped[int] = mapped_column(primary_key=True) - bs: List["B"] = dataclasses.field( # noqa: F821 + bs: List["B"] = dataclasses.field( default_factory=list, metadata={"sa": relationship()} ) @@ -642,9 +642,7 @@ class RelationshipLHSTest(fixtures.TestBase, testing.AssertsCompiledSQL): id: Mapped[int] = mapped_column(primary_key=True) data: Mapped[str] = mapped_column() - bs: Mapped[List["B"]] = relationship( # noqa F821 - back_populates="a" - ) + bs: Mapped[List["B"]] = relationship(back_populates="a") class B(decl_base): __tablename__ = "b" @@ -719,16 +717,10 @@ class RelationshipLHSTest(fixtures.TestBase, testing.AssertsCompiledSQL): id: Mapped[int] = mapped_column(primary_key=True) data: Mapped[str] = mapped_column() - bs_list: Mapped[List["B"]] = relationship( # noqa F821 - viewonly=True - ) - bs_set: Mapped[Set["B"]] = relationship(viewonly=True) # noqa F821 - bs_list_warg: Mapped[List["B"]] = relationship( # noqa F821 - "B", viewonly=True - ) - bs_set_warg: Mapped[Set["B"]] = relationship( # noqa F821 - "B", viewonly=True - ) + bs_list: Mapped[List["B"]] = relationship(viewonly=True) + bs_set: Mapped[Set["B"]] = relationship(viewonly=True) + bs_list_warg: Mapped[List["B"]] = relationship("B", viewonly=True) + bs_set_warg: Mapped[Set["B"]] = relationship("B", viewonly=True) class B(decl_base): __tablename__ = "b" @@ -756,7 +748,7 @@ class RelationshipLHSTest(fixtures.TestBase, testing.AssertsCompiledSQL): id: Mapped[int] = mapped_column(primary_key=True) data: Mapped[str] = mapped_column() - bs: Mapped[Dict[str, "B"]] = relationship() # noqa F821 + bs: Mapped[Dict[str, "B"]] = relationship() class B(decl_base): __tablename__ = "b" @@ -779,7 +771,7 @@ class RelationshipLHSTest(fixtures.TestBase, testing.AssertsCompiledSQL): id: Mapped[int] = mapped_column(primary_key=True) data: Mapped[str] = mapped_column() - bs: Mapped[MappedCollection[str, "B"]] = relationship( # noqa F821 + bs: Mapped[MappedCollection[str, "B"]] = relationship( collection_class=attribute_mapped_collection("name") ) @@ -1048,7 +1040,7 @@ class AllYourFavoriteHitsTest(fixtures.TestBase, testing.AssertsCompiledSQL): name: Mapped[str50] - employees: Mapped[Set["Person"]] = relationship() # noqa F821 + employees: Mapped[Set["Person"]] = relationship() class Person(decl_base): __tablename__ = "person" diff --git a/test/orm/test_deprecations.py b/test/orm/test_deprecations.py index 97ee97bc08..587c498eae 100644 --- a/test/orm/test_deprecations.py +++ b/test/orm/test_deprecations.py @@ -1345,7 +1345,7 @@ class NonPrimaryMapperTest(_fixtures.FixtureTest, AssertsCompiledSQL): with testing.expect_deprecated( "The mapper.non_primary parameter is deprecated" ): - m = self.mapper_registry.map_imperatively( # noqa F841 + m = self.mapper_registry.map_imperatively( # noqa: F841 User, users, non_primary=True, @@ -1402,7 +1402,7 @@ class NonPrimaryMapperTest(_fixtures.FixtureTest, AssertsCompiledSQL): with testing.expect_deprecated( "The mapper.non_primary parameter is deprecated" ): - m = registry.map_imperatively( # noqa F841 + m = registry.map_imperatively( # noqa: F841 User, users, non_primary=True, diff --git a/test/sql/test_functions.py b/test/sql/test_functions.py index c055bc1507..693a41c3ac 100644 --- a/test/sql/test_functions.py +++ b/test/sql/test_functions.py @@ -1394,7 +1394,7 @@ class TableValuedCompileTest(fixtures.TestBase, AssertsCompiledSQL): `WITH ORDINALITY AS unnested(unnested, ordinality) ON true LEFT OUTER JOIN b ON unnested.unnested = b.ref - """ # noqa 501 + """ # noqa: 501 a = table("a", column("id"), column("refs")) b = table("b", column("id"), column("ref"))