We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0f40154 commit 4b60e82Copy full SHA for 4b60e82
1 file changed
progressbar/utils.py
@@ -18,9 +18,11 @@
18
assert epoch
19
20
21
-def len_color(text):
22
- '''Return the length of text without ANSI escape codes'''
23
- return len(re.sub(u'\u001b\\[.*?[@-~]', '', text))
+def len_color(value):
+ '''Return the length of `value` without ANSI escape codes'''
+ if isinstance(value, str):
24
+ value = re.sub(u'\u001b\\[.*?[@-~]', '', value)
25
+ return len(value)
26
27
28
class WrappingIO:
0 commit comments