Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
myint committed Mar 7, 2014
1 parent 8f6b80c commit 5dda2ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion autoflake.py
Expand Up @@ -113,7 +113,7 @@ def check(source):
# call to compile() will complain. See PEP 263. This only affects
# Python 2.
try:
source = source.encode('utf-8')
source = source.encode()
except UnicodeError: # pragma: no cover
return []

Expand Down
8 changes: 4 additions & 4 deletions test_autoflake.py
Expand Up @@ -830,7 +830,7 @@ def test_end_to_end(self):
+import os
x = os.sep
print(x)
""", '\n'.join(process.communicate()[0].decode('utf-8').split('\n')[3:]))
""", '\n'.join(process.communicate()[0].decode().split('\n')[3:]))

def test_end_to_end_with_remove_all_unused_imports(self):
with temporary_file("""\
Expand All @@ -849,7 +849,7 @@ def test_end_to_end_with_remove_all_unused_imports(self):
+import os
x = os.sep
print(x)
""", '\n'.join(process.communicate()[0].decode('utf-8').split('\n')[3:]))
""", '\n'.join(process.communicate()[0].decode().split('\n')[3:]))

def test_end_to_end_with_error(self):
with temporary_file("""\
Expand All @@ -865,7 +865,7 @@ def test_end_to_end_with_error(self):
stderr=subprocess.PIPE)
self.assertIn(
'redundant',
process.communicate()[1].decode('utf-8'))
process.communicate()[1].decode())


@contextlib.contextmanager
Expand All @@ -874,7 +874,7 @@ def temporary_file(contents, directory='.', prefix=''):
f = tempfile.NamedTemporaryFile(suffix='.py', prefix=prefix,
delete=False, dir=directory)
try:
f.write(contents.encode('utf8'))
f.write(contents.encode())
f.close()
yield f.name
finally:
Expand Down

0 comments on commit 5dda2ca

Please sign in to comment.