diff options
| author | hippo91 <guillaume.peillex@gmail.com> | 2019-02-02 10:05:57 +0100 |
|---|---|---|
| committer | hippo91 <guillaume.peillex@gmail.com> | 2019-02-02 10:05:57 +0100 |
| commit | fa113aa2106db6ec7504fdc5ffc2030a4ffcd331 (patch) | |
| tree | 2c6ad2b78ac34fff97dd9d7e61a240309ce3ddd7 | |
| parent | 098ebd9914e723071902a1c21a835f17e8ecd36f (diff) | |
| parent | 67bec180dc9ffd954ea2fb0e8f9f5f4993665d02 (diff) | |
| download | astroid-git-fa113aa2106db6ec7504fdc5ffc2030a4ffcd331.tar.gz | |
Merge branch 'master' of https://github.com/PyCQA/astroid
| -rw-r--r-- | doc/extending.rst | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/doc/extending.rst b/doc/extending.rst index 9f9e7b80..ab80115a 100644 --- a/doc/extending.rst +++ b/doc/extending.rst @@ -115,20 +115,20 @@ Now, with this knowledge, let's see how our transform might look:: lineno=node.lineno, col_offset=node.col_offset, parent=node.parent, - ) - formatted_value_node = astroid.FormattedValue( + ) + formatted_value_node = astroid.FormattedValue( lineno=node.lineno, col_offset=node.col_offset, parent=node.parent, - ) - new_node.postinit(value=node.args[0]) + ) + formatted_value_node.postinit(value=node.args[0]) - # Need to extract the part of the string that doesn't - # have the formatting placeholders - string = extract_string_without_placeholder(node.func.expr) + # Removes the {} since it will be represented as + # formatted_value_node + string = astroid.Const(node.func.expr.value.replace('{}', '')) - f_string_node.postinit(values=[string, f_string_node]) - return new_node + f_string_node.postinit(values=[string, formatted_value_node]) + return f_string_node astroid.MANAGER.register_transform( astroid.Call, |
