Skip to content

Commit 11bf824

Browse files
committed
update flake8 noqa skips with proper syntax
Change-Id: I42ed77f559e3ee5b8c600d98457ee37803ef0ea6
1 parent fd05273 commit 11bf824

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+122
-130
lines changed

lib/sqlalchemy/connectors/pyodbc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def _get_server_version_info(
180180
dbapi_con = connection.connection.dbapi_connection
181181
version: Tuple[Union[int, str], ...] = ()
182182
r = re.compile(r"[.\-]")
183-
for n in r.split(dbapi_con.getinfo(self.dbapi.SQL_DBMS_VER)): # type: ignore[union-attr] # noqa E501
183+
for n in r.split(dbapi_con.getinfo(self.dbapi.SQL_DBMS_VER)): # type: ignore[union-attr] # noqa: E501
184184
try:
185185
version += (int(n),)
186186
except ValueError:
@@ -215,7 +215,7 @@ def do_set_input_sizes(
215215
def get_isolation_level_values(
216216
self, dbapi_connection: interfaces.DBAPIConnection
217217
) -> List[_IsolationLevel]:
218-
return super().get_isolation_level_values(dbapi_connection) + [ # type: ignore # noqa E501
218+
return super().get_isolation_level_values(dbapi_connection) + [ # type: ignore # noqa: E501
219219
"AUTOCOMMIT"
220220
]
221221

lib/sqlalchemy/dialects/oracle/provision.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def stop_test_class_outside_fixtures(config, db, cls):
6363
try:
6464
with db.begin() as conn:
6565
# run magic command to get rid of identity sequences
66-
# https://floo.bar/2019/11/29/drop-the-underlying-sequence-of-an-identity-column/ # noqa E501
66+
# https://floo.bar/2019/11/29/drop-the-underlying-sequence-of-an-identity-column/ # noqa: E501
6767
conn.exec_driver_sql("purge recyclebin")
6868
except exc.DatabaseError as err:
6969
log.warning("purge recyclebin command failed: %s", err)

lib/sqlalchemy/dialects/postgresql/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1421,7 +1421,7 @@ def bind_expression(self, bindvalue):
14211421
)
14221422
14231423
1424-
""" # noqa E501
1424+
""" # noqa: E501
14251425

14261426
from collections import defaultdict
14271427
import datetime as dt

lib/sqlalchemy/engine/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2655,7 +2655,7 @@ def _switch_shard(conn, cursor, stmt,
26552655
:meth:`_engine.Engine.get_execution_options`
26562656
26572657
2658-
""" # noqa E501
2658+
""" # noqa: E501
26592659
return self._option_cls(self, opt)
26602660

26612661
def get_execution_options(self) -> _ExecuteOptions:

lib/sqlalchemy/engine/cursor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,7 @@ def rowcount(self):
16371637
16381638
:ref:`tutorial_update_delete_rowcount` - in the :ref:`unified_tutorial`
16391639
1640-
""" # noqa E501
1640+
""" # noqa: E501
16411641

16421642
try:
16431643
return self.context.rowcount

lib/sqlalchemy/engine/result.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ def _allrows(self) -> List[_RowData]:
502502
)
503503
for made_row in made_rows
504504
]
505-
if sig_row not in uniques and not uniques.add(sig_row) # type: ignore # noqa E501
505+
if sig_row not in uniques and not uniques.add(sig_row) # type: ignore # noqa: E501
506506
]
507507
else:
508508
interim_rows = made_rows
@@ -749,7 +749,7 @@ def _column_slices(
749749
real_result = self._real_result if self._real_result else self
750750

751751
if (
752-
real_result._source_supports_scalars # type: ignore[attr-defined] # noqa E501
752+
real_result._source_supports_scalars # type: ignore[attr-defined] # noqa: E501
753753
and len(indexes) == 1
754754
):
755755
self._generate_rows = False

lib/sqlalchemy/event/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def _create_dispatcher_class(
319319
assert dispatch_target_cls is not None
320320
if (
321321
hasattr(dispatch_target_cls, "__slots__")
322-
and "_slots_dispatch" in dispatch_target_cls.__slots__ # type: ignore # noqa E501
322+
and "_slots_dispatch" in dispatch_target_cls.__slots__ # type: ignore # noqa: E501
323323
):
324324
dispatch_target_cls.dispatch = slots_dispatcher(cls)
325325
else:

lib/sqlalchemy/event/legacy.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _legacy_signature(
5151
def leg(fn: Callable[..., Any]) -> Callable[..., Any]:
5252
if not hasattr(fn, "_legacy_signatures"):
5353
fn._legacy_signatures = [] # type: ignore[attr-defined]
54-
fn._legacy_signatures.append((since, argnames, converter)) # type: ignore[attr-defined] # noqa E501
54+
fn._legacy_signatures.append((since, argnames, converter)) # type: ignore[attr-defined] # noqa: E501
5555
return fn
5656

5757
return leg

lib/sqlalchemy/ext/associationproxy.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ def contains(self, other: Any, **kw: Any) -> ColumnElement[bool]:
11761176
**{self.value_attr: other}
11771177
)
11781178

1179-
def __eq__(self, obj: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa E501
1179+
def __eq__(self, obj: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa: E501
11801180
# note the has() here will fail for collections; eq_()
11811181
# is only allowed with a scalar.
11821182
if obj is None:
@@ -1187,7 +1187,7 @@ def __eq__(self, obj: Any) -> ColumnElement[bool]: # type: ignore[override] #
11871187
else:
11881188
return self._comparator.has(**{self.value_attr: obj})
11891189

1190-
def __ne__(self, obj: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa E501
1190+
def __ne__(self, obj: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa: E501
11911191
# note the has() here will fail for collections; eq_()
11921192
# is only allowed with a scalar.
11931193
return self._comparator.has(
@@ -1203,7 +1203,7 @@ class ColumnAssociationProxyInstance(AssociationProxyInstance[_T]):
12031203
_target_is_object: bool = False
12041204
_is_canonical = True
12051205

1206-
def __eq__(self, other: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa E501
1206+
def __eq__(self, other: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa: E501
12071207
# special case "is None" to check for no related row as well
12081208
expr = self._criterion_exists(
12091209
self.remote_attr.operate(operators.eq, other)

lib/sqlalchemy/ext/asyncio/scoping.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def __init__(self, session_factory, scopefunc):
8585
the current scope. A function such as ``asyncio.current_task``
8686
may be useful here.
8787
88-
""" # noqa E501
88+
""" # noqa: E501
8989

9090
self.session_factory = session_factory
9191
self.registry = ScopedRegistry(session_factory, scopefunc)

lib/sqlalchemy/ext/asyncio/session.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def get_bind(self, mapper=None, clause=None, **kw):
503503
blocking-style code, which will be translated to implicitly async calls
504504
at the point of invoking IO on the database drivers.
505505
506-
""" # noqa E501
506+
""" # noqa: E501
507507

508508
return self.sync_session.get_bind(
509509
mapper=mapper, clause=clause, bind=bind, **kw

lib/sqlalchemy/log.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ def _qual_logger_name_for_cls(cls: Type["Identified"]) -> str:
6464

6565
def class_logger(cls: Type[_IT]) -> Type[_IT]:
6666
logger = logging.getLogger(_qual_logger_name_for_cls(cls))
67-
cls._should_log_debug = lambda self: logger.isEnabledFor( # type: ignore[assignment] # noqa E501
67+
cls._should_log_debug = lambda self: logger.isEnabledFor( # type: ignore[assignment] # noqa: E501
6868
logging.DEBUG
6969
)
70-
cls._should_log_info = lambda self: logger.isEnabledFor( # type: ignore[assignment] # noqa E501
70+
cls._should_log_info = lambda self: logger.isEnabledFor( # type: ignore[assignment] # noqa: E501
7171
logging.INFO
7272
)
7373
cls.logger = logger

lib/sqlalchemy/orm/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ def of_type(self, class_):
616616
def and_(self, *criteria):
617617
...
618618

619-
def any(self, criterion=None, **kwargs): # noqa A001
619+
def any(self, criterion=None, **kwargs): # noqa: A001
620620
...
621621

622622
def has(self, criterion=None, **kwargs):

lib/sqlalchemy/orm/decl_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ class AddressMixin:
249249
:ref:`orm_declarative_dataclasses_mixin` - illustrates special forms
250250
for use with Python dataclasses
251251
252-
""" # noqa E501
252+
""" # noqa: E501
253253

254254
if typing.TYPE_CHECKING:
255255

lib/sqlalchemy/orm/loading.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ def _instance_processor(
757757
# test.orm.inheritance.test_basic ->
758758
# EagerTargetingTest.test_adapt_stringency
759759
# OptimizedLoadTest.test_column_expression_joined
760-
# PolymorphicOnNotLocalTest.test_polymorphic_on_column_prop # noqa E501
760+
# PolymorphicOnNotLocalTest.test_polymorphic_on_column_prop # noqa: E501
761761
#
762762

763763
adapted_col = adapter.columns[col]

lib/sqlalchemy/pool/base.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def _creator(
269269

270270
# mypy seems to get super confused assigning functions to
271271
# attributes
272-
self._invoke_creator = self._should_wrap_creator(creator) # type: ignore # noqa E501
272+
self._invoke_creator = self._should_wrap_creator(creator) # type: ignore # noqa: E501
273273

274274
@_creator.deleter
275275
def _creator(self) -> None:
@@ -609,7 +609,7 @@ def __init__(self, pool: Pool, connect: bool = True):
609609
dbapi_connection: Optional[DBAPIConnection]
610610

611611
@property
612-
def driver_connection(self) -> Optional[Any]: # type: ignore[override] # mypy#4125 # noqa E501
612+
def driver_connection(self) -> Optional[Any]: # type: ignore[override] # mypy#4125 # noqa: E501
613613
if self.dbapi_connection is None:
614614
return None
615615
else:
@@ -632,7 +632,7 @@ def info(self) -> Dict[str, Any]: # type: ignore[override] # mypy#4125
632632
return {}
633633

634634
@util.memoized_property
635-
def record_info(self) -> Optional[Dict[str, Any]]: # type: ignore[override] # mypy#4125 # noqa E501
635+
def record_info(self) -> Optional[Dict[str, Any]]: # type: ignore[override] # mypy#4125 # noqa: E501
636636
return {}
637637

638638
@classmethod
@@ -1081,7 +1081,7 @@ def invalidate(
10811081
self._is_valid = False
10821082

10831083
@property
1084-
def record_info(self) -> Optional[Dict[str, Any]]: # type: ignore[override] # mypy#4125 # noqa E501
1084+
def record_info(self) -> Optional[Dict[str, Any]]: # type: ignore[override] # mypy#4125 # noqa: E501
10851085
return self._connection_record.record_info
10861086

10871087
def cursor(self, *args: Any, **kwargs: Any) -> DBAPICursor:
@@ -1147,7 +1147,7 @@ def __init__(
11471147
_connection_record: Optional[_ConnectionRecord]
11481148

11491149
@property
1150-
def driver_connection(self) -> Optional[Any]: # type: ignore[override] # mypy#4125 # noqa E501
1150+
def driver_connection(self) -> Optional[Any]: # type: ignore[override] # mypy#4125 # noqa: E501
11511151
if self._connection_record is None:
11521152
return None
11531153
return self._connection_record.driver_connection
@@ -1322,7 +1322,7 @@ def info(self) -> Dict[str, Any]: # type: ignore[override] # mypy#4125
13221322
return self._connection_record.info
13231323

13241324
@property
1325-
def record_info(self) -> Optional[Dict[str, Any]]: # type: ignore[override] # mypy#4125 # noqa E501
1325+
def record_info(self) -> Optional[Dict[str, Any]]: # type: ignore[override] # mypy#4125 # noqa: E501
13261326
if self._connection_record is None:
13271327
return None
13281328
else:

lib/sqlalchemy/pool/events.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def my_on_checkout(dbapi_conn, connection_rec, connection_proxy):
5050
# will associate with engine.pool
5151
event.listen(engine, 'checkout', my_on_checkout)
5252
53-
""" # noqa E501
53+
""" # noqa: E501
5454

5555
_target_class_doc = "SomeEngineOrPool"
5656
_dispatch_target = Pool

lib/sqlalchemy/sql/_selectable_constructors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def exists(
157157
:meth:`_sql.SelectBase.exists` - method to transform a ``SELECT`` to an
158158
``EXISTS`` clause.
159159
160-
""" # noqa E501
160+
""" # noqa: E501
161161

162162
return Exists(__argument)
163163

lib/sqlalchemy/sql/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ def _process_opt(conn, statement, multiparams, params, execution_options):
11721172
:ref:`orm_queryguide_execution_options` - documentation on all
11731173
ORM-specific execution options
11741174
1175-
""" # noqa E501
1175+
""" # noqa: E501
11761176
if "isolation_level" in kw:
11771177
raise exc.ArgumentError(
11781178
"'isolation_level' execution option may only be specified "

lib/sqlalchemy/sql/crud.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ def _col_bind_name(col: ColumnClause[Any]) -> str:
430430
_column_as_key = functools.partial( # type: ignore
431431
coercions.expect_as_key, roles.DMLColumnRole
432432
)
433-
_getattr_col_key = _col_bind_name = operator.attrgetter("key") # type: ignore # noqa E501
433+
_getattr_col_key = _col_bind_name = operator.attrgetter("key") # type: ignore # noqa: E501
434434

435435
return _column_as_key, _getattr_col_key, _col_bind_name
436436

lib/sqlalchemy/sql/dml.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def returning(
453453
454454
:ref:`tutorial_insert_returning` - in the :ref:`unified_tutorial`
455455
456-
""" # noqa E501
456+
""" # noqa: E501
457457
if self._return_defaults:
458458
raise exc.InvalidRequestError(
459459
"return_defaults() is already configured on this statement"
@@ -610,7 +610,7 @@ def returning_column_descriptions(self) -> List[Dict[str, Any]]:
610610
611611
:ref:`queryguide_inspection` - ORM background
612612
613-
""" # noqa E501
613+
""" # noqa: E501
614614
meth = DMLState.get_plugin_class(
615615
self
616616
).get_returning_column_descriptions

lib/sqlalchemy/sql/elements.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2668,11 +2668,11 @@ def _construct(
26682668
if lcc > 1:
26692669
# multiple elements. Return regular BooleanClauseList
26702670
# which will link elements against the operator.
2671-
return cls._construct_raw(operator, convert_clauses) # type: ignore # noqa E501
2671+
return cls._construct_raw(operator, convert_clauses) # type: ignore # noqa: E501
26722672
elif lcc == 1:
26732673
# just one element. return it as a single boolean element,
26742674
# not a list and discard the operator.
2675-
return convert_clauses[0] # type: ignore[no-any-return] # noqa E501
2675+
return convert_clauses[0] # type: ignore[no-any-return] # noqa: E501
26762676
else:
26772677
# no elements period. deprecated use case. return an empty
26782678
# ClauseList construct that generates nothing unless it has
@@ -2689,7 +2689,7 @@ def _construct(
26892689
},
26902690
version="1.4",
26912691
)
2692-
return cls._construct_raw(operator) # type: ignore[no-any-return] # noqa E501
2692+
return cls._construct_raw(operator) # type: ignore[no-any-return] # noqa: E501
26932693

26942694
@classmethod
26952695
def _construct_for_whereclause(

lib/sqlalchemy/sql/functions.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def scalar_table_valued(self, name, type_=None):
200200
201201
:meth:`_functions.FunctionElement.column_valued`
202202
203-
""" # noqa E501
203+
""" # noqa: E501
204204

205205
return ScalarFunctionColumn(self, name, type_)
206206

@@ -270,7 +270,7 @@ def table_valued(self, *expr, **kw):
270270
:meth:`_sql.TableValuedAlias.render_derived` - renders the alias
271271
using a derived column clause, e.g. ``AS name(col1, col2, ...)``
272272
273-
""" # noqa 501
273+
""" # noqa: 501
274274

275275
new_func = self._generate()
276276

@@ -311,7 +311,7 @@ def column_valued(self, name=None):
311311
312312
:meth:`_functions.FunctionElement.table_valued`
313313
314-
""" # noqa 501
314+
""" # noqa: 501
315315

316316
return self.alias(name=name).column
317317

@@ -336,7 +336,7 @@ def columns(self):
336336
:meth:`_functions.FunctionElement.table_valued` - generates table-valued
337337
SQL function expressions.
338338
339-
""" # noqa E501
339+
""" # noqa: E501
340340
return self.c
341341

342342
@util.ro_memoized_property
@@ -1197,19 +1197,19 @@ class coalesce(ReturnTypeFromArgs[_T]):
11971197
inherit_cache = True
11981198

11991199

1200-
class max(ReturnTypeFromArgs[_T]): # noqa A001
1200+
class max(ReturnTypeFromArgs[_T]): # noqa: A001
12011201
"""The SQL MAX() aggregate function."""
12021202

12031203
inherit_cache = True
12041204

12051205

1206-
class min(ReturnTypeFromArgs[_T]): # noqa A001
1206+
class min(ReturnTypeFromArgs[_T]): # noqa: A001
12071207
"""The SQL MIN() aggregate function."""
12081208

12091209
inherit_cache = True
12101210

12111211

1212-
class sum(ReturnTypeFromArgs[_T]): # noqa A001
1212+
class sum(ReturnTypeFromArgs[_T]): # noqa: A001
12131213
"""The SQL SUM() aggregate function."""
12141214

12151215
inherit_cache = True

lib/sqlalchemy/sql/operators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def __call__(
417417
if hasattr(left, "__sa_operate__"):
418418
return left.operate(self, right, *other, **kwargs)
419419
elif self.python_impl:
420-
return self.python_impl(left, right, *other, **kwargs) # type: ignore # noqa E501
420+
return self.python_impl(left, right, *other, **kwargs) # type: ignore # noqa: E501
421421
else:
422422
raise exc.InvalidRequestError(
423423
f"Custom operator {self.opstring!r} can't be used with "

0 commit comments

Comments
 (0)