summaryrefslogtreecommitdiff
path: root/astroid/helpers.py
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-02-17 23:19:05 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-02-17 23:51:41 +0100
commitea96fc4bce94673671958e15d17bbcd75914b3f9 (patch)
tree2c0872b4701f60f2469753f9793f7ac95a0b2475 /astroid/helpers.py
parent14395e6e5d9d75b6fe1f87a44b77cfe71a538083 (diff)
downloadastroid-git-ea96fc4bce94673671958e15d17bbcd75914b3f9.tar.gz
Move from % syntax to format or f-strings
This is possible with python 3.6
Diffstat (limited to 'astroid/helpers.py')
-rw-r--r--astroid/helpers.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/astroid/helpers.py b/astroid/helpers.py
index a35635e8..b4ead8eb 100644
--- a/astroid/helpers.py
+++ b/astroid/helpers.py
@@ -142,7 +142,7 @@ def object_issubclass(node, class_or_seq, context=None):
or its type's mro doesn't work
"""
if not isinstance(node, nodes.ClassDef):
- raise TypeError("{node} needs to be a ClassDef node".format(node=node))
+ raise TypeError(f"{node} needs to be a ClassDef node")
return _object_type_is_subclass(node, class_or_seq, context=context)
@@ -286,7 +286,7 @@ def object_len(node, context=None):
len_call = next(node_type.igetattr("__len__", context=context))
except exceptions.AttributeInferenceError as e:
raise exceptions.AstroidTypeError(
- "object of type '{}' has no len()".format(node_type.pytype())
+ f"object of type '{node_type.pytype()}' has no len()"
) from e
result_of_len = next(len_call.infer_call_result(node, context))
@@ -301,5 +301,5 @@ def object_len(node, context=None):
# Fake a result as we don't know the arguments of the instance call.
return 0
raise exceptions.AstroidTypeError(
- "'{}' object cannot be interpreted as an integer".format(result_of_len)
+ f"'{result_of_len}' object cannot be interpreted as an integer"
)