Fix syntax error in an example in the ast documentation and sync docstrings (GH-18946)
This commit is contained in:
parent
276a84a0a6
commit
c00c86b904
|
@ -1704,7 +1704,7 @@ and classes for traversing abstract syntax trees:
|
||||||
value=Name(id='data', ctx=Load()),
|
value=Name(id='data', ctx=Load()),
|
||||||
slice=Constant(value=node.id),
|
slice=Constant(value=node.id),
|
||||||
ctx=node.ctx
|
ctx=node.ctx
|
||||||
), node)
|
)
|
||||||
|
|
||||||
Keep in mind that if the node you're operating on has child nodes you must
|
Keep in mind that if the node you're operating on has child nodes you must
|
||||||
either transform the child nodes yourself or call the :meth:`generic_visit`
|
either transform the child nodes yourself or call the :meth:`generic_visit`
|
||||||
|
|
|
@ -443,11 +443,11 @@ class NodeTransformer(NodeVisitor):
|
||||||
class RewriteName(NodeTransformer):
|
class RewriteName(NodeTransformer):
|
||||||
|
|
||||||
def visit_Name(self, node):
|
def visit_Name(self, node):
|
||||||
return copy_location(Subscript(
|
return Subscript(
|
||||||
value=Name(id='data', ctx=Load()),
|
value=Name(id='data', ctx=Load()),
|
||||||
slice=Constant(value=node.id),
|
slice=Constant(value=node.id),
|
||||||
ctx=node.ctx
|
ctx=node.ctx
|
||||||
), node)
|
)
|
||||||
|
|
||||||
Keep in mind that if the node you're operating on has child nodes you must
|
Keep in mind that if the node you're operating on has child nodes you must
|
||||||
either transform the child nodes yourself or call the :meth:`generic_visit`
|
either transform the child nodes yourself or call the :meth:`generic_visit`
|
||||||
|
|
Loading…
Reference in New Issue