summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2022-04-11 22:21:20 +0200
committerFederico Caselli <cfederico87@gmail.com>2022-04-11 22:48:23 +0200
commit11bf82447438a9d5d9df9d613bf245694d6120dc (patch)
tree727dd81d7dbf9811b15639aabb4ee69ce4ee5646 /lib/sqlalchemy/sql
parentfd052732604a0d03167978215f0077e60b75851d (diff)
downloadsqlalchemy-11bf82447438a9d5d9df9d613bf245694d6120dc.tar.gz
update flake8 noqa skips with proper syntax
Change-Id: I42ed77f559e3ee5b8c600d98457ee37803ef0ea6
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/_selectable_constructors.py2
-rw-r--r--lib/sqlalchemy/sql/base.py2
-rw-r--r--lib/sqlalchemy/sql/crud.py2
-rw-r--r--lib/sqlalchemy/sql/dml.py4
-rw-r--r--lib/sqlalchemy/sql/elements.py6
-rw-r--r--lib/sqlalchemy/sql/functions.py14
-rw-r--r--lib/sqlalchemy/sql/operators.py2
-rw-r--r--lib/sqlalchemy/sql/schema.py20
-rw-r--r--lib/sqlalchemy/sql/selectable.py10
-rw-r--r--lib/sqlalchemy/sql/traversals.py4
-rw-r--r--lib/sqlalchemy/sql/type_api.py8
-rw-r--r--lib/sqlalchemy/sql/util.py4
-rw-r--r--lib/sqlalchemy/sql/visitors.py4
13 files changed, 41 insertions, 41 deletions
diff --git a/lib/sqlalchemy/sql/_selectable_constructors.py b/lib/sqlalchemy/sql/_selectable_constructors.py
index 7896c02c2..37d44976a 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 f766a5ac5..7fb9c2602 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 f6db2c4b2..e4408cd31 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 f23ba2e6e..8307f6400 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 7ea09e758..805758283 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 db4bb5837..a66a1eb92 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 7db1631c8..ebc8a28ce 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 883439ca5..c9b67caca 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 292225ce2..d7cc32733 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 c3653c264..cbc4e9e70 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 82adf4a4f..3293ecac0 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 80711c4b5..2790bf373 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 081faf1e9..5ff746bb3 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