diff options
| author | Federico Caselli <cfederico87@gmail.com> | 2022-07-31 11:56:07 +0200 |
|---|---|---|
| committer | Federico Caselli <cfederico87@gmail.com> | 2022-07-31 12:07:01 +0200 |
| commit | cde43899d6c872f6d58354f7324f707b9c8bcd8e (patch) | |
| tree | 10f76c0c210ebe7daa0f3d5541779c65da7112b3 /lib/sqlalchemy | |
| parent | 7014e04999045a605bab4a5e024bdfc6dd929985 (diff) | |
| download | sqlalchemy-cde43899d6c872f6d58354f7324f707b9c8bcd8e.tar.gz | |
Update to flake8 5.
Change-Id: I5a241a70efba68bcea9819ddce6aebc25703e68d
(cherry picked from commit f8c4dba4e9f130c18ce00597c036bc26ae7abf90)
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/dialects/mysql/dml.py | 3 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/cursor.py | 6 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/result.py | 3 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/row.py | 3 | ||||
| -rw-r--r-- | lib/sqlalchemy/ext/asyncio/result.py | 8 | ||||
| -rw-r--r-- | lib/sqlalchemy/ext/mypy/util.py | 5 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 3 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/events.py | 30 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/dml.py | 4 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/functions.py | 3 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/selectable.py | 17 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/type_api.py | 10 | ||||
| -rw-r--r-- | lib/sqlalchemy/testing/requirements.py | 5 |
13 files changed, 60 insertions, 40 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/dml.py b/lib/sqlalchemy/dialects/mysql/dml.py index 0b508fe49..0c8791a0d 100644 --- a/lib/sqlalchemy/dialects/mysql/dml.py +++ b/lib/sqlalchemy/dialects/mysql/dml.py @@ -29,7 +29,8 @@ class Insert(StandardInsert): @property def inserted(self): - """Provide the "inserted" namespace for an ON DUPLICATE KEY UPDATE statement + """Provide the "inserted" namespace for an ON DUPLICATE KEY UPDATE + statement MySQL's ON DUPLICATE KEY UPDATE clause allows reference to the row that would be inserted, via a special function called ``VALUES()``. diff --git a/lib/sqlalchemy/engine/cursor.py b/lib/sqlalchemy/engine/cursor.py index abe58e2fd..774916d95 100644 --- a/lib/sqlalchemy/engine/cursor.py +++ b/lib/sqlalchemy/engine/cursor.py @@ -1371,7 +1371,8 @@ class BaseCursorResult(object): @property def inserted_primary_key_rows(self): - """Return the value of :attr:`_engine.CursorResult.inserted_primary_key` + """Return the value of + :attr:`_engine.CursorResult.inserted_primary_key` as a row contained within a list; some dialects may support a multiple row form as well. @@ -1712,7 +1713,8 @@ class BaseCursorResult(object): @property def returns_rows(self): - """True if this :class:`_engine.CursorResult` returns zero or more rows. + """True if this :class:`_engine.CursorResult` returns zero or more + rows. I.e. if it is legal to call the methods :meth:`_engine.CursorResult.fetchone`, diff --git a/lib/sqlalchemy/engine/result.py b/lib/sqlalchemy/engine/result.py index 912dccf4b..1fd4e1c92 100644 --- a/lib/sqlalchemy/engine/result.py +++ b/lib/sqlalchemy/engine/result.py @@ -1768,7 +1768,8 @@ def null_result(): class ChunkedIteratorResult(IteratorResult): - """An :class:`.IteratorResult` that works from an iterator-producing callable. + """An :class:`.IteratorResult` that works from an iterator-producing + callable. The given ``chunks`` argument is a function that is given a number of rows to return in each chunk, or ``None`` for all rows. The function should diff --git a/lib/sqlalchemy/engine/row.py b/lib/sqlalchemy/engine/row.py index e6c329773..e80e8c6be 100644 --- a/lib/sqlalchemy/engine/row.py +++ b/lib/sqlalchemy/engine/row.py @@ -549,7 +549,8 @@ class ROMappingView( class RowMapping(BaseRow, collections_abc.Mapping): - """A ``Mapping`` that maps column names and objects to :class:`.Row` values. + """A ``Mapping`` that maps column names and objects to :class:`.Row` + values. The :class:`.RowMapping` is available from a :class:`.Row` via the :attr:`.Row._mapping` attribute, as well as from the iterable interface diff --git a/lib/sqlalchemy/ext/asyncio/result.py b/lib/sqlalchemy/ext/asyncio/result.py index c69fe191b..a77b6a8c9 100644 --- a/lib/sqlalchemy/ext/asyncio/result.py +++ b/lib/sqlalchemy/ext/asyncio/result.py @@ -323,8 +323,8 @@ class AsyncResult(AsyncCommon): return await greenlet_spawn(FrozenResult, self) def merge(self, *others): - """Merge this :class:`_asyncio.AsyncResult` with other compatible result - objects. + """Merge this :class:`_asyncio.AsyncResult` with other compatible + result objects. The object returned is an instance of :class:`_engine.MergedResult`, which will be composed of iterators from the given result @@ -495,8 +495,8 @@ class AsyncScalarResult(AsyncCommon): class AsyncMappingResult(AsyncCommon): - """A wrapper for a :class:`_asyncio.AsyncResult` that returns dictionary values - rather than :class:`_engine.Row` values. + """A wrapper for a :class:`_asyncio.AsyncResult` that returns dictionary + values rather than :class:`_engine.Row` values. The :class:`_asyncio.AsyncMappingResult` object is acquired by calling the :meth:`_asyncio.AsyncResult.mappings` method. diff --git a/lib/sqlalchemy/ext/mypy/util.py b/lib/sqlalchemy/ext/mypy/util.py index 4d55cb728..16b365e1e 100644 --- a/lib/sqlalchemy/ext/mypy/util.py +++ b/lib/sqlalchemy/ext/mypy/util.py @@ -64,8 +64,9 @@ class SQLAlchemyAttribute: } def expand_typevar_from_subtype(self, sub_type: TypeInfo) -> None: - """Expands type vars in the context of a subtype when an attribute is inherited - from a generic super type.""" + """Expands type vars in the context of a subtype when an attribute is + inherited from a generic super type. + """ if not isinstance(self.type, TypeVarType): return diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 2a1d3a2c3..efa20fb1c 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -376,7 +376,8 @@ else: class Mapped(QueryableAttribute, _Generic_T): - """Represent an ORM mapped :term:`descriptor` attribute for typing purposes. + """Represent an ORM mapped :term:`descriptor` attribute for typing + purposes. This class represents the complete descriptor interface for any class attribute that will have been :term:`instrumented` by the ORM diff --git a/lib/sqlalchemy/orm/events.py b/lib/sqlalchemy/orm/events.py index 2bef6394d..39659c723 100644 --- a/lib/sqlalchemy/orm/events.py +++ b/lib/sqlalchemy/orm/events.py @@ -1895,7 +1895,8 @@ class SessionEvents(event.Events): @_lifecycle_event def transient_to_pending(self, session, instance): - """Intercept the "transient to pending" transition for a specific object. + """Intercept the "transient to pending" transition for a specific + object. This event is a specialization of the :meth:`.SessionEvents.after_attach` event which is only invoked @@ -1916,7 +1917,8 @@ class SessionEvents(event.Events): @_lifecycle_event def pending_to_transient(self, session, instance): - """Intercept the "pending to transient" transition for a specific object. + """Intercept the "pending to transient" transition for a specific + object. This less common transition occurs when an pending object that has not been flushed is evicted from the session; this can occur @@ -1937,7 +1939,8 @@ class SessionEvents(event.Events): @_lifecycle_event def persistent_to_transient(self, session, instance): - """Intercept the "persistent to transient" transition for a specific object. + """Intercept the "persistent to transient" transition for a specific + object. This less common transition occurs when an pending object that has has been flushed is evicted from the session; this can occur @@ -1957,7 +1960,8 @@ class SessionEvents(event.Events): @_lifecycle_event def pending_to_persistent(self, session, instance): - """Intercept the "pending to persistent"" transition for a specific object. + """Intercept the "pending to persistent"" transition for a specific + object. This event is invoked within the flush process, and is similar to scanning the :attr:`.Session.new` collection within @@ -1979,7 +1983,8 @@ class SessionEvents(event.Events): @_lifecycle_event def detached_to_persistent(self, session, instance): - """Intercept the "detached to persistent" transition for a specific object. + """Intercept the "detached to persistent" transition for a specific + object. This event is a specialization of the :meth:`.SessionEvents.after_attach` event which is only invoked @@ -2015,7 +2020,8 @@ class SessionEvents(event.Events): @_lifecycle_event def loaded_as_persistent(self, session, instance): - """Intercept the "loaded as persistent" transition for a specific object. + """Intercept the "loaded as persistent" transition for a specific + object. This event is invoked within the ORM loading process, and is invoked very similarly to the :meth:`.InstanceEvents.load` event. However, @@ -2050,7 +2056,8 @@ class SessionEvents(event.Events): @_lifecycle_event def persistent_to_deleted(self, session, instance): - """Intercept the "persistent to deleted" transition for a specific object. + """Intercept the "persistent to deleted" transition for a specific + object. This event is invoked when a persistent object's identity is deleted from the database within a flush, however the object @@ -2082,7 +2089,8 @@ class SessionEvents(event.Events): @_lifecycle_event def deleted_to_persistent(self, session, instance): - """Intercept the "deleted to persistent" transition for a specific object. + """Intercept the "deleted to persistent" transition for a specific + object. This transition occurs only when an object that's been deleted successfully in a flush is restored due to a call to @@ -2099,7 +2107,8 @@ class SessionEvents(event.Events): @_lifecycle_event def deleted_to_detached(self, session, instance): - """Intercept the "deleted to detached" transition for a specific object. + """Intercept the "deleted to detached" transition for a specific + object. This event is invoked when a deleted object is evicted from the session. The typical case when this occurs is when @@ -2122,7 +2131,8 @@ class SessionEvents(event.Events): @_lifecycle_event def persistent_to_detached(self, session, instance): - """Intercept the "persistent to detached" transition for a specific object. + """Intercept the "persistent to detached" transition for a specific + object. This event is invoked when a persistent object is evicted from the session. There are many conditions that cause this diff --git a/lib/sqlalchemy/sql/dml.py b/lib/sqlalchemy/sql/dml.py index 4a343147c..07a4d7b2d 100644 --- a/lib/sqlalchemy/sql/dml.py +++ b/lib/sqlalchemy/sql/dml.py @@ -511,8 +511,8 @@ class UpdateBase( @property def entity_description(self): - """Return a :term:`plugin-enabled` description of the table and/or entity - which this DML construct is operating against. + """Return a :term:`plugin-enabled` description of the table and/or + entity which this DML construct is operating against. This attribute is generally useful when using the ORM, as an extended structure which includes information about mapped diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py index 963108d7c..29f41223d 100644 --- a/lib/sqlalchemy/sql/functions.py +++ b/lib/sqlalchemy/sql/functions.py @@ -418,7 +418,8 @@ class FunctionElement(Executable, ColumnElement, FromClause, Generative): return FunctionFilter(self, *criterion) def as_comparison(self, left_index, right_index): - """Interpret this expression as a boolean comparison between two values. + """Interpret this expression as a boolean comparison between two + values. This method is used for an ORM use case described at :ref:`relationship_custom_operator_sql_function`. diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index 829f26030..8379e1ca7 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -1834,8 +1834,8 @@ class TableValuedAlias(Alias): return tva def lateral(self, name=None): - """Return a new :class:`_sql.TableValuedAlias` with the lateral flag set, - so that it renders as LATERAL. + """Return a new :class:`_sql.TableValuedAlias` with the lateral flag + set, so that it renders as LATERAL. .. seealso:: @@ -5485,10 +5485,9 @@ class Select( ) def outerjoin_from(self, from_, target, onclause=None, full=False): - r"""Create a SQL LEFT OUTER JOIN against this :class:`_expression.Select` - object's criterion - and apply generatively, returning the newly resulting - :class:`_expression.Select`. + r"""Create a SQL LEFT OUTER JOIN against this + :class:`_expression.Select` object's criterion and apply generatively, + returning the newly resulting :class:`_expression.Select`. Usage is the same as that of :meth:`_selectable.Select.join_from`. @@ -6768,7 +6767,8 @@ class Exists(UnaryExpression): return Select._create_select_from_fromclause(self, [self], **kwargs) def correlate(self, *fromclause): - """Apply correlation to the subquery noted by this :class:`_sql.Exists`. + """Apply correlation to the subquery noted by this + :class:`_sql.Exists`. .. seealso:: @@ -6782,7 +6782,8 @@ class Exists(UnaryExpression): return e def correlate_except(self, *fromclause): - """Apply correlation to the subquery noted by this :class:`_sql.Exists`. + """Apply correlation to the subquery noted by this + :class:`_sql.Exists`. .. seealso:: diff --git a/lib/sqlalchemy/sql/type_api.py b/lib/sqlalchemy/sql/type_api.py index 172ce0d88..29dc74971 100644 --- a/lib/sqlalchemy/sql/type_api.py +++ b/lib/sqlalchemy/sql/type_api.py @@ -179,8 +179,8 @@ class TypeEngine(Traversible): """ def evaluates_none(self): - """Return a copy of this type which has the :attr:`.should_evaluate_none` - flag set to True. + """Return a copy of this type which has the + :attr:`.should_evaluate_none` flag set to True. E.g.:: @@ -1105,7 +1105,8 @@ class Emulated(object): """ def adapt_to_emulated(self, impltype, **kw): - """Given an impl class, adapt this type to the impl assuming "emulated". + """Given an impl class, adapt this type to the impl assuming + "emulated". The impl should also be an "emulated" version of this type, most likely the same class as this type itself. @@ -1152,7 +1153,8 @@ class NativeForEmulated(object): @classmethod def adapt_emulated_to_native(cls, impl, **kw): - """Given an impl, adapt this type's class to the impl assuming "native". + """Given an impl, adapt this type's class to the impl assuming + "native". The impl will be an :class:`.Emulated` class but not a :class:`.NativeForEmulated`. diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index b3f7ddb50..857d1fdef 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -228,9 +228,8 @@ class SuiteRequirements(Requirements): @property def standalone_binds(self): - """target database/driver supports bound parameters as column expressions - without being in the context of a typed column. - + """target database/driver supports bound parameters as column + expressions without being in the context of a typed column. """ return exclusions.closed() |
