summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhippo91 <guillaume.peillex@gmail.com>2019-02-02 10:05:57 +0100
committerhippo91 <guillaume.peillex@gmail.com>2019-02-02 10:05:57 +0100
commitfa113aa2106db6ec7504fdc5ffc2030a4ffcd331 (patch)
tree2c6ad2b78ac34fff97dd9d7e61a240309ce3ddd7
parent098ebd9914e723071902a1c21a835f17e8ecd36f (diff)
parent67bec180dc9ffd954ea2fb0e8f9f5f4993665d02 (diff)
downloadastroid-git-fa113aa2106db6ec7504fdc5ffc2030a4ffcd331.tar.gz
Merge branch 'master' of https://github.com/PyCQA/astroid
-rw-r--r--doc/extending.rst18
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,