Remove more calls to decode using u prefix

This commit is contained in:
Alex Hall 2019-04-25 20:51:55 +02:00 committed by Ram Rachum
parent aedaa7ee56
commit 93edf6fced
2 changed files with 2 additions and 6 deletions

View file

@ -139,9 +139,7 @@ class Tracer:
if self.overwrite and not self._did_overwrite:
self.truncate()
self._did_overwrite = True
s = '{self.prefix}{s}\n'.format(**locals())
if isinstance(s, bytes): # Python 2 compatibility
s = s.decode()
s = u'{self.prefix}{s}\n'.format(**locals())
self._write(s)
def __enter__(self):

View file

@ -275,13 +275,11 @@ def test_unavailable_source():
sys_tools.TempSysPathAdder(str(folder)):
module_name = 'iaerojajsijf'
python_file_path = folder / ('%s.py' % (module_name,))
content = ('import pysnooper\n'
content = (u'import pysnooper\n'
'\n'
'@pysnooper.snoop()\n'
'def f(x):\n'
' return x\n')
if six.PY2:
content = content.decode()
with python_file_path.open('w') as python_file:
python_file.write(content)
module = __import__(module_name)