diff options
Diffstat (limited to 'sqlglot/diff.py')
-rw-r--r-- | sqlglot/diff.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sqlglot/diff.py b/sqlglot/diff.py index fa8bc1b..a5373b0 100644 --- a/sqlglot/diff.py +++ b/sqlglot/diff.py @@ -1,5 +1,6 @@ """ .. include:: ../posts/sql_diff.md +---- """ from __future__ import annotations @@ -75,12 +76,13 @@ def diff(source: exp.Expression, target: exp.Expression) -> t.List[Edit]: ] Args: - source (sqlglot.Expression): the source expression. - target (sqlglot.Expression): the target expression against which the diff should be calculated. + source: the source expression. + target: the target expression against which the diff should be calculated. Returns: - the list of Insert, Remove, Move, Update and Keep objects for each node in the source and the target expression trees. - This list represents a sequence of steps needed to transform the source expression tree into the target one. + the list of Insert, Remove, Move, Update and Keep objects for each node in the source and the + target expression trees. This list represents a sequence of steps needed to transform the source + expression tree into the target one. """ return ChangeDistiller().diff(source.copy(), target.copy()) @@ -258,7 +260,7 @@ class ChangeDistiller: return bigram_histo -def _get_leaves(expression: exp.Expression) -> t.Generator[exp.Expression, None, None]: +def _get_leaves(expression: exp.Expression) -> t.Iterator[exp.Expression]: has_child_exprs = False for a in expression.args.values(): |