Skip to content

Commit

Permalink
Revert "ensure length padding works with py2 by enforcing unicode awa…
Browse files Browse the repository at this point in the history
…reness (pwndbg#416)"

This reverts commit 8ecaa67.
  • Loading branch information
cebrusfs committed Feb 27, 2018
1 parent ba1eb5b commit b8339ab
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions pwndbg/color/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import re

import six

import pwndbg.memoize

NORMAL = "\x1b[0m"
Expand Down Expand Up @@ -74,17 +72,9 @@ def terminateWith(x, color):
return re.sub('\x1b\\[0m', NORMAL + color, x)

def ljust_colored(x, length, char=' '):
# TODO: workaround until issue #404
if six.PY2:
x = x if isinstance(x, six.text_type) else x.decode('utf8')
char = char if isinstance(char, six.text_type) else char.decode('utf8')
remaining = length - len(strip(x))
return x + ((remaining // len(char) + 1) * char)[:remaining]

def rjust_colored(x, length, char=' '):
# TODO: workaround until issue #404
if six.PY2:
x = x if isinstance(x, six.text_type) else x.decode('utf8')
char = char if isinstance(char, six.text_type) else char.decode('utf8')
remaining = length - len(strip(x))
return ((remaining // len(char) + 1) * char)[:remaining] + x

0 comments on commit b8339ab

Please sign in to comment.