Fixing flake8 warnings and errors
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude benchmark Excluding the benchmark directory (due to protobuf generated files) Also removing some Python2 specific code
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
from distutils import ccompiler
|
||||
from distutils.sysconfig import customize_compiler
|
||||
@@ -14,13 +13,8 @@ from subprocess import Popen, PIPE
|
||||
pjoin = os.path.join
|
||||
|
||||
|
||||
if sys.version_info[0] >= 3:
|
||||
u = lambda x: x
|
||||
else:
|
||||
u = lambda x: x.decode('utf8', 'replace')
|
||||
|
||||
|
||||
def customize_mingw(cc):
|
||||
"""customize mingw"""
|
||||
# strip -mno-cygwin from mingw32 (Python Issue #12641)
|
||||
for cmd in [cc.compiler, cc.compiler_cxx, cc.compiler_so, cc.linker_exe, cc.linker_so]:
|
||||
if '-mno-cygwin' in cmd:
|
||||
@@ -55,11 +49,10 @@ def get_output_error(cmd):
|
||||
try:
|
||||
result = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
||||
except IOError as e:
|
||||
return -1, u(''), u('Failed to run %r: %r' % (cmd, e))
|
||||
return -1, '', 'Failed to run %r: %r' % (cmd, e)
|
||||
so, se = result.communicate()
|
||||
# unicode:
|
||||
so = so.decode('utf8', 'replace')
|
||||
se = se.decode('utf8', 'replace')
|
||||
|
||||
return result.returncode, so, se
|
||||
|
||||
|
||||
Reference in New Issue
Block a user