Skip to content

Commit

Permalink
Remove more calls to decode using u prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmojaki authored and cool-RR committed Apr 26, 2019
1 parent aedaa7e commit 93edf6f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions pysnooper/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ def write(self, s):
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):
Expand Down
4 changes: 1 addition & 3 deletions tests/test_pysnooper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 93edf6f

Please sign in to comment.