diff options
| author | Oleg Broytman <phd@phdru.name> | 2015-02-16 06:09:43 +0300 |
|---|---|---|
| committer | Oleg Broytman <phd@phdru.name> | 2015-02-16 06:09:43 +0300 |
| commit | 4d9a88298b7b45b8bd05c3911dfbbbc280a90fa3 (patch) | |
| tree | 5cb225b4035357da9393870761819371cf8c5490 /flake8/hooks.py | |
| parent | 2f577791db7206e54677dee4482cc065d39aa91e (diff) | |
| download | flake8-4d9a88298b7b45b8bd05c3911dfbbbc280a90fa3.tar.gz | |
Minor refactoring
Diffstat (limited to 'flake8/hooks.py')
| -rw-r--r-- | flake8/hooks.py | 7 |
1 files 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()] |
