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:
Jacob Alexander
2019-09-26 22:18:28 -07:00
parent 1f0200af9c
commit b3021e4f6b
37 changed files with 536 additions and 452 deletions

View File

@@ -9,9 +9,9 @@ import os
import sys
import logging
#-----------------------------------------------------------------------------
#
# Logging (adapted from h5py: http://h5py.googlecode.com)
#-----------------------------------------------------------------------------
#
logger = logging.getLogger()
@@ -22,18 +22,22 @@ else:
logger.addHandler(logging.StreamHandler(sys.stderr))
def debug(msg):
"""Debug"""
logger.debug(msg)
def info(msg):
"""Info"""
logger.info(msg)
def fatal(msg, code=1):
logger.error("Fatal: " + msg)
"""Fatal"""
logger.error("Fatal: %s", msg)
exit(code)
def warn(msg):
logger.error("Warning: " + msg)
"""Warning"""
logger.error("Warning: %s", msg)
def line(c='*', width=48):
"""Horizontal rule"""
print(c * (width // len(c)))