From 4d9a88298b7b45b8bd05c3911dfbbbc280a90fa3 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 16 Feb 2015 06:09:43 +0300 Subject: [PATCH] Minor refactoring --- flake8/hooks.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/flake8/hooks.py b/flake8/hooks.py index 1cbe884..e14727e 100644 --- a/flake8/hooks.py +++ b/flake8/hooks.py @@ -128,11 +128,10 @@ def run(command, raw_output=False, decode=True): # endswith to be given a bytes object or a tuple of bytes but not native # string objects. This is simply less mysterious than using b'.py' in the # endswith method. That should work but might still fail horribly. - if hasattr(stdout, 'decode'): - if decode: + if decode: + if hasattr(stdout, 'decode'): stdout = stdout.decode('utf-8') - if hasattr(stderr, 'decode'): - if decode: + if hasattr(stderr, 'decode'): stderr = stderr.decode('utf-8') if not raw_output: stdout = [line.strip() for line in stdout.splitlines()]