From 5e13683adca8ee5f3874b35c03c2c60f698d8774 Mon Sep 17 00:00:00 2001 From: aplatkouski <5857672+aplatkouski@users.noreply.github.com> Date: Sun, 7 Jun 2020 14:22:35 +0300 Subject: [PATCH] Fix typos in documentation - ORM Extensions Signed-off-by: aplatkouski <5857672+aplatkouski@users.noreply.github.com> --- doc/build/changelog/migration_14.rst | 2 +- .../orm/extensions/declarative/relationships.rst | 2 +- lib/sqlalchemy/ext/horizontal_shard.py | 6 +++--- lib/sqlalchemy/ext/hybrid.py | 10 +++++----- lib/sqlalchemy/ext/instrumentation.py | 4 ++-- lib/sqlalchemy/orm/base.py | 8 ++++---- lib/sqlalchemy/orm/instrumentation.py | 2 +- lib/sqlalchemy/orm/state.py | 12 ++++++------ lib/sqlalchemy/orm/unitofwork.py | 12 ++++++------ lib/sqlalchemy/orm/util.py | 3 ++- lib/sqlalchemy/testing/plugin/pytestplugin.py | 2 +- 11 files changed, 32 insertions(+), 31 deletions(-) diff --git a/doc/build/changelog/migration_14.rst b/doc/build/changelog/migration_14.rst index 6702f86f0c..3314e8d9b6 100644 --- a/doc/build/changelog/migration_14.rst +++ b/doc/build/changelog/migration_14.rst @@ -1615,7 +1615,7 @@ on the table. The :class:`.Sequence` prior to version 1.3 was used to control parameters for the IDENTITY column in SQL Server; this usage emitted deprecation warnings -throughout 1.3 and is now removed in 1.4. For control of paramters for an +throughout 1.3 and is now removed in 1.4. For control of parameters for an IDENTITY column, the ``mssql_identity_start`` and ``mssql_identity_increment`` parameters should be used; see the MSSQL dialect documentation linked below. diff --git a/doc/build/orm/extensions/declarative/relationships.rst b/doc/build/orm/extensions/declarative/relationships.rst index d33d442454..5d81cee30a 100644 --- a/doc/build/orm/extensions/declarative/relationships.rst +++ b/doc/build/orm/extensions/declarative/relationships.rst @@ -155,7 +155,7 @@ the :class:`_schema.MetaData` object used by the declarative base:: keywords = Table( 'keywords', Base.metadata, Column('author_id', Integer, ForeignKey('authors.id')), - Column('keyword_id', Integer, ForeignKey('keywords.id')) + Column('keyword_id', Integer, ForeignKey('keyword.id')) ) class Author(Base): diff --git a/lib/sqlalchemy/ext/horizontal_shard.py b/lib/sqlalchemy/ext/horizontal_shard.py index 0983807cb9..b8ce1e4a0a 100644 --- a/lib/sqlalchemy/ext/horizontal_shard.py +++ b/lib/sqlalchemy/ext/horizontal_shard.py @@ -34,9 +34,9 @@ class ShardedQuery(Query): self._shard_id = None def set_shard(self, shard_id): - """return a new query, limited to a single shard ID. + """Return a new query, limited to a single shard ID. - all subsequent operations with the returned query will + All subsequent operations with the returned query will be against the single shard regardless of other state. The shard_id can be passed for a 2.0 style execution to the @@ -79,7 +79,7 @@ class ShardedSession(Session): where the query should be issued. Results from all shards returned will be combined together into a single listing. - .. versionchanged:: 1.4 The ``execute_chooser`` paramter + .. versionchanged:: 1.4 The ``execute_chooser`` parameter supersedes the ``query_chooser`` parameter. :param shards: A dictionary of string shard names diff --git a/lib/sqlalchemy/ext/hybrid.py b/lib/sqlalchemy/ext/hybrid.py index efd8d7d6b2..6b4cf989ca 100644 --- a/lib/sqlalchemy/ext/hybrid.py +++ b/lib/sqlalchemy/ext/hybrid.py @@ -668,8 +668,8 @@ simple:: return self.parent.parent For the expression, things are not so clear. We'd need to construct a -:class:`_query.Query` where we :meth:`_query.Query.join` twice along ``Node. -parent`` to +:class:`_query.Query` where we :meth:`_query.Query.join` twice along +``Node.parent`` to get to the ``grandparent``. We can instead return a transforming callable that we'll combine with the :class:`.Comparator` class to receive any :class:`_query.Query` object, and return a new one that's joined to the @@ -690,7 +690,7 @@ that we'll combine with the :class:`.Comparator` class to receive any class Node(Base): __tablename__ = 'node' - id =Column(Integer, primary_key=True) + id = Column(Integer, primary_key=True) parent_id = Column(Integer, ForeignKey('node.id')) parent = relationship("Node", remote_side=id) @@ -987,7 +987,7 @@ class hybrid_property(interfaces.InspectionAttrInfo): .. note:: - when referring to a hybrid property from an owning class (e.g. + When referring to a hybrid property from an owning class (e.g. ``SomeClass.some_hybrid``), an instance of :class:`.QueryableAttribute` is returned, representing the expression or comparator object as well as this hybrid object. @@ -1027,7 +1027,7 @@ class hybrid_property(interfaces.InspectionAttrInfo): .. note:: - when referring to a hybrid property from an owning class (e.g. + When referring to a hybrid property from an owning class (e.g. ``SomeClass.some_hybrid``), an instance of :class:`.QueryableAttribute` is returned, representing the expression or comparator object as this hybrid object. However, diff --git a/lib/sqlalchemy/ext/instrumentation.py b/lib/sqlalchemy/ext/instrumentation.py index 378d7445f9..300d0d81cf 100644 --- a/lib/sqlalchemy/ext/instrumentation.py +++ b/lib/sqlalchemy/ext/instrumentation.py @@ -42,10 +42,10 @@ inheritance hierarchy. The value of this attribute must be a callable and will be passed a class object. The callable must return one of: - - An instance of an InstrumentationManager or subclass + - An instance of an :class:`.InstrumentationManager` or subclass - An object implementing all or some of InstrumentationManager (TODO) - A dictionary of callables, implementing all or some of the above (TODO) - - An instance of a ClassManager or subclass + - An instance of a :class:`.ClassManager` or subclass This attribute is consulted by SQLAlchemy instrumentation resolution, once the :mod:`sqlalchemy.ext.instrumentation` module diff --git a/lib/sqlalchemy/orm/base.py b/lib/sqlalchemy/orm/base.py index 54e45cd1a0..1e6f1ee2a1 100644 --- a/lib/sqlalchemy/orm/base.py +++ b/lib/sqlalchemy/orm/base.py @@ -463,8 +463,8 @@ class InspectionAttr(object): __slots__ = () is_selectable = False - """Return True if this object is an instance of """ - """:class:`expression.Selectable`.""" + """Return True if this object is an instance of + :class:`_expression.Selectable`.""" is_aliased_class = False """True if this object is an instance of :class:`.AliasedClass`.""" @@ -505,8 +505,8 @@ class InspectionAttr(object): """ is_clause_element = False - """True if this object is an instance of """ - """:class:`_expression.ClauseElement`.""" + """True if this object is an instance of + :class:`_expression.ClauseElement`.""" extension_type = NOT_EXTENSION """The extension type, if any. diff --git a/lib/sqlalchemy/orm/instrumentation.py b/lib/sqlalchemy/orm/instrumentation.py index 432bff7d41..e2f0c6a288 100644 --- a/lib/sqlalchemy/orm/instrumentation.py +++ b/lib/sqlalchemy/orm/instrumentation.py @@ -40,7 +40,7 @@ from ..util import HasMemoized class ClassManager(HasMemoized, dict): - """tracks state information at the class level.""" + """Tracks state information at the class level.""" MANAGER_ATTR = base.DEFAULT_MANAGER_ATTR STATE_ATTR = base.DEFAULT_STATE_ATTR diff --git a/lib/sqlalchemy/orm/state.py b/lib/sqlalchemy/orm/state.py index 48546f24ea..2332834977 100644 --- a/lib/sqlalchemy/orm/state.py +++ b/lib/sqlalchemy/orm/state.py @@ -119,7 +119,7 @@ class InstanceState(interfaces.InspectionAttrInfo): @property def transient(self): - """Return true if the object is :term:`transient`. + """Return ``True`` if the object is :term:`transient`. .. seealso:: @@ -130,7 +130,7 @@ class InstanceState(interfaces.InspectionAttrInfo): @property def pending(self): - """Return true if the object is :term:`pending`. + """Return ``True`` if the object is :term:`pending`. .. seealso:: @@ -142,7 +142,7 @@ class InstanceState(interfaces.InspectionAttrInfo): @property def deleted(self): - """Return true if the object is :term:`deleted`. + """Return ``True`` if the object is :term:`deleted`. An object that is in the deleted state is guaranteed to not be within the :attr:`.Session.identity_map` of its parent @@ -196,7 +196,7 @@ class InstanceState(interfaces.InspectionAttrInfo): @property def persistent(self): - """Return true if the object is :term:`persistent`. + """Return ``True`` if the object is :term:`persistent`. An object that is in the persistent state is guaranteed to be within the :attr:`.Session.identity_map` of its parent @@ -217,7 +217,7 @@ class InstanceState(interfaces.InspectionAttrInfo): @property def detached(self): - """Return true if the object is :term:`detached`. + """Return ``True`` if the object is :term:`detached`. .. seealso:: @@ -324,7 +324,7 @@ class InstanceState(interfaces.InspectionAttrInfo): """Return ``True`` if this object has an identity key. This should always have the same value as the - expression ``state.persistent or state.detached``. + expression ``state.persistent`` or ``state.detached``. """ return bool(self.key) diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py index 5a3f99e700..97eea48642 100644 --- a/lib/sqlalchemy/orm/unitofwork.py +++ b/lib/sqlalchemy/orm/unitofwork.py @@ -177,7 +177,7 @@ class UOWTransaction(object): return bool(self.states) def was_already_deleted(self, state): - """return true if the given state is expired and was deleted + """Return ``True`` if the given state is expired and was deleted previously. """ if state.expired: @@ -189,7 +189,7 @@ class UOWTransaction(object): return False def is_deleted(self, state): - """return true if the given state is marked as deleted + """Return ``True`` if the given state is marked as deleted within this uowtransaction.""" return state in self.states and self.states[state][0] @@ -202,7 +202,7 @@ class UOWTransaction(object): return ret def remove_state_actions(self, state): - """remove pending actions for a state from the uowtransaction.""" + """Remove pending actions for a state from the uowtransaction.""" isdelete = self.states[state][0] @@ -211,7 +211,7 @@ class UOWTransaction(object): def get_attribute_history( self, state, key, passive=attributes.PASSIVE_NO_INITIALIZE ): - """facade to attributes.get_state_history(), including + """Facade to attributes.get_state_history(), including caching of results.""" hashkey = ("history", state, key) @@ -421,10 +421,10 @@ class UOWTransaction(object): rec.execute(self) def finalize_flush_changes(self): - """mark processed objects as clean / deleted after a successful + """Mark processed objects as clean / deleted after a successful flush(). - this method is called within the flush() method after the + This method is called within the flush() method after the execute() method has succeeded and the transaction has been committed. """ diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index 8726935f84..3630b08af3 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -60,7 +60,8 @@ all_cascades = frozenset( class CascadeOptions(frozenset): - """Keeps track of the options sent to relationship().cascade""" + """Keeps track of the options sent to + :paramref:`.relationship.cascade`""" _add_w_all_cascades = all_cascades.difference( ["all", "none", "delete-orphan"] diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py index 9dc40c9fef..015598952d 100644 --- a/lib/sqlalchemy/testing/plugin/pytestplugin.py +++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py @@ -371,7 +371,7 @@ class PytestFixtureFunctions(plugin_base.FixtureFunctions): } def combinations(self, *arg_sets, **kw): - """facade for pytest.mark.paramtrize. + """Facade for pytest.mark.parametrize. Automatically derives argument names from the callable which in our case is always a method on a class with positional arguments. -- 2.47.3