From 2c0361566eb7cdc69f1bed1b78f18afb8cdea4bf Mon Sep 17 00:00:00 2001 From: aplatkouski <5857672+aplatkouski@users.noreply.github.com> Date: Thu, 11 Jun 2020 23:14:12 +0300 Subject: [PATCH] Fix typos in 'SQL Statements and Expressions API' Signed-off-by: aplatkouski <5857672+aplatkouski@users.noreply.github.com> --- lib/sqlalchemy/sql/dml.py | 4 ++-- lib/sqlalchemy/sql/functions.py | 10 ++++----- lib/sqlalchemy/sql/visitors.py | 40 ++++++++++++++++----------------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/sqlalchemy/sql/dml.py b/lib/sqlalchemy/sql/dml.py index d72450fb5c..e5f8567881 100644 --- a/lib/sqlalchemy/sql/dml.py +++ b/lib/sqlalchemy/sql/dml.py @@ -457,7 +457,7 @@ class ValuesBase(UpdateBase): @_generative def values(self, *args, **kwargs): - r"""specify a fixed VALUES clause for an INSERT statement, or the SET + r"""Specify a fixed VALUES clause for an INSERT statement, or the SET clause for an UPDATE. Note that the :class:`_expression.Insert` and @@ -1122,7 +1122,7 @@ class Update(DMLWhereBase, ValuesBase): a scalar-returning :func:`_expression.select` construct, etc. - when combining :func:`_expression.select` constructs within the + When combining :func:`_expression.select` constructs within the values clause of an :func:`_expression.update` construct, the subquery represented by the :func:`_expression.select` should be *correlated* to the diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py index 7b723f371a..057a881a9c 100644 --- a/lib/sqlalchemy/sql/functions.py +++ b/lib/sqlalchemy/sql/functions.py @@ -125,7 +125,7 @@ class FunctionElement(Executable, ColumnElement, FromClause): @property def columns(self): - """The set of columns exported by this :class:`.FunctionElement`. + r"""The set of columns exported by this :class:`.FunctionElement`. Function objects currently have no result column names built in; this method returns a single-element column collection with @@ -951,7 +951,7 @@ class user(AnsiFunction): class array_agg(GenericFunction): - """support for the ARRAY_AGG function. + """Support for the ARRAY_AGG function. The ``func.array_agg(expr)`` construct returns an expression of type :class:`_types.ARRAY`. @@ -1011,7 +1011,7 @@ class OrderedSetAgg(GenericFunction): class mode(OrderedSetAgg): - """implement the ``mode`` ordered-set aggregate function. + """Implement the ``mode`` ordered-set aggregate function. This function must be used with the :meth:`.FunctionElement.within_group` modifier to supply a sort expression to operate upon. @@ -1026,7 +1026,7 @@ class mode(OrderedSetAgg): class percentile_cont(OrderedSetAgg): - """implement the ``percentile_cont`` ordered-set aggregate function. + """Implement the ``percentile_cont`` ordered-set aggregate function. This function must be used with the :meth:`.FunctionElement.within_group` modifier to supply a sort expression to operate upon. @@ -1044,7 +1044,7 @@ class percentile_cont(OrderedSetAgg): class percentile_disc(OrderedSetAgg): - """implement the ``percentile_disc`` ordered-set aggregate function. + """Implement the ``percentile_disc`` ordered-set aggregate function. This function must be used with the :meth:`.FunctionElement.within_group` modifier to supply a sort expression to operate upon. diff --git a/lib/sqlalchemy/sql/visitors.py b/lib/sqlalchemy/sql/visitors.py index 9047020030..4d1638b156 100644 --- a/lib/sqlalchemy/sql/visitors.py +++ b/lib/sqlalchemy/sql/visitors.py @@ -181,7 +181,7 @@ class InternalTraversal(util.with_metaclass(_InternalTraversalType, object)): ] Above, the :class:`.Case` class indicates its internal state as the - attributes named ``value``, ``whens``, and ``else\_``. They each + attributes named ``value``, ``whens``, and ``else_``. They each link to an :class:`.InternalTraversal` method which indicates the type of datastructure referred towards. @@ -330,7 +330,7 @@ class InternalTraversal(util.with_metaclass(_InternalTraversalType, object)): """ dp_dialect_options = symbol("DO") - """visit a dialect options structure.""" + """Visit a dialect options structure.""" dp_string_clauseelement_dict = symbol("CD") """Visit a dictionary of string keys to :class:`_expression.ClauseElement` @@ -400,17 +400,17 @@ class InternalTraversal(util.with_metaclass(_InternalTraversalType, object)): """ dp_dml_ordered_values = symbol("DML_OV") - """visit the values() ordered tuple list of an + """Visit the values() ordered tuple list of an :class:`_expression.Update` object.""" dp_dml_values = symbol("DML_V") - """visit the values() dictionary of a :class:`.ValuesBase` + """Visit the values() dictionary of a :class:`.ValuesBase` (e.g. Insert or Update) object. """ dp_dml_multi_values = symbol("DML_MV") - """visit the values() multi-valued list of dictionaries of an + """Visit the values() multi-valued list of dictionaries of an :class:`_expression.Insert` object. """ @@ -479,14 +479,14 @@ class ExternalTraversal(object): return meth(obj, **kw) def iterate(self, obj): - """traverse the given expression structure, returning an iterator + """Traverse the given expression structure, returning an iterator of all elements. """ return iterate(obj, self.__traverse_options__) def traverse(self, obj): - """traverse and visit the given expression structure.""" + """Traverse and visit the given expression structure.""" return traverse(obj, self.__traverse_options__, self._visitor_dict) @@ -501,7 +501,7 @@ class ExternalTraversal(object): @property def visitor_iterator(self): - """iterate through this visitor and each 'chained' visitor.""" + """Iterate through this visitor and each 'chained' visitor.""" v = self while v: @@ -509,9 +509,9 @@ class ExternalTraversal(object): v = getattr(v, "_next", None) def chain(self, visitor): - """'chain' an additional ClauseVisitor onto this ClauseVisitor. + """'Chain' an additional ClauseVisitor onto this ClauseVisitor. - the chained visitor will receive all visit events after this one. + The chained visitor will receive all visit events after this one. """ tail = list(self.visitor_iterator)[-1] @@ -537,7 +537,7 @@ class CloningExternalTraversal(ExternalTraversal): return [self.traverse(x) for x in list_] def traverse(self, obj): - """traverse and visit the given expression structure.""" + """Traverse and visit the given expression structure.""" return cloned_traverse( obj, self.__traverse_options__, self._visitor_dict @@ -554,7 +554,7 @@ class ReplacingExternalTraversal(CloningExternalTraversal): """ def replace(self, elem): - """receive pre-copied elements during a cloning traversal. + """Receive pre-copied elements during a cloning traversal. If the method returns a new element, the element is used instead of creating a simple copy of the element. Traversal @@ -563,7 +563,7 @@ class ReplacingExternalTraversal(CloningExternalTraversal): return None def traverse(self, obj): - """traverse and visit the given expression structure.""" + """Traverse and visit the given expression structure.""" def replace(elem): for v in self.visitor_iterator: @@ -583,9 +583,9 @@ ReplacingCloningVisitor = ReplacingExternalTraversal def iterate(obj, opts=util.immutabledict()): - r"""traverse the given expression structure, returning an iterator. + r"""Traverse the given expression structure, returning an iterator. - traversal is configured to be breadth-first. + Traversal is configured to be breadth-first. The central API feature used by the :func:`.visitors.iterate` function is the @@ -618,7 +618,7 @@ def iterate(obj, opts=util.immutabledict()): def traverse_using(iterator, obj, visitors): - """visit the given expression structure using the given iterator of + """Visit the given expression structure using the given iterator of objects. :func:`.visitors.traverse_using` is usually called internally as the result @@ -650,7 +650,7 @@ def traverse_using(iterator, obj, visitors): def traverse(obj, opts, visitors): - """traverse and visit the given expression structure using the default + """Traverse and visit the given expression structure using the default iterator. e.g.:: @@ -683,7 +683,7 @@ def traverse(obj, opts, visitors): def cloned_traverse(obj, opts, visitors): - """clone the given expression structure, allowing modifications by + """Clone the given expression structure, allowing modifications by visitors. Traversal usage is the same as that of :func:`.visitors.traverse`. @@ -738,14 +738,14 @@ def cloned_traverse(obj, opts, visitors): def replacement_traverse(obj, opts, replace): - """clone the given expression structure, allowing element + """Clone the given expression structure, allowing element replacement by a given replacement function. This function is very similar to the :func:`.visitors.cloned_traverse` function, except instead of being passed a dictionary of visitors, all elements are unconditionally passed into the given replace function. The replace function then has the option to return an entirely new object - which will replace the one given. if it returns ``None``, then the object + which will replace the one given. If it returns ``None``, then the object is kept in place. The difference in usage between :func:`.visitors.cloned_traverse` and -- 2.47.3