Skip to content

Commit c98408a

Browse files
committed
fix flake8 findings
1 parent eace757 commit c98408a

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

source/bridgeLogger.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@
2020
@author: HWASSMAN
2121
'''
2222

23-
import json
24-
import re
2523
import logging
26-
import sys
2724
import os
2825

2926
logging.TRACE = 5
3027
logging.addLevelName(logging.TRACE, 'TRACE')
3128

3229
logging.MOREINFO = 15
33-
logging.addLevelName(logging.MOREINFO,"MOREINFO")
30+
logging.addLevelName(logging.MOREINFO, 'MOREINFO')
31+
3432

3533
class MyLogger(logging.getLoggerClass()):
3634

3735
def __init__(self, name, level=logging.NOTSET):
3836
super().__init__(name, level)
3937

38+
4039
def trace(self, msg, *args, **kwargs):
4140
if self.isEnabledFor(logging.TRACE):
4241
self._log(logging.TRACE, msg, args, **kwargs)
4342

43+
4444
def details(self, msg, *args, **kwargs):
4545
if self.isEnabledFor(logging.MOREINFO):
4646
self._log(logging.MOREINFO, msg, args, **kwargs)
@@ -50,7 +50,7 @@ def configureLogging(logPath, logfile, loglevel=logging.INFO):
5050

5151
try:
5252
loglevel = logging._checkLevel(loglevel)
53-
except (ValueError, TypeError) as e:
53+
except (ValueError, TypeError):
5454
loglevel = logging.INFO
5555

5656
# create the logfile path if needed
@@ -79,4 +79,3 @@ def configureLogging(logPath, logfile, loglevel=logging.INFO):
7979

8080
logger.propagate = False # prevent propagation to default (console) logger
8181
return logger
82-

source/confParser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import argparse
2424
import os
25-
import logging.handlers
2625
from messages import MSG
2726
import configparser
2827

@@ -101,7 +100,7 @@ def parse_cmd_args(argv):
101100
In this case make sure the \'query2port = \"9094\"\' is enabled in the ZIMon queryinterface settings (\'ZIMonCollector.cfg\')')
102101
parser.add_argument('-l', '--logPath', action="store", default="/var/log/ibm_bridge_for_grafana", help='location path of the log file (Default: /var/log/ibm_bridge_for_grafana')
103102
parser.add_argument('-f', '--logFile', action="store", default="zserver.log", help='Name of the log file (Default: zserver.log')
104-
parser.add_argument('-c', '--logLevel', action="store", type=int, default=15,
103+
parser.add_argument('-c', '--logLevel', action="store", type=int, default=15,
105104
help='log level. Available levels: 10 (DEBUG), 15 (MOREINFO), 20 (INFO), 30 (WARN), 40 (ERROR) (Default: 15)')
106105
parser.add_argument('-p', '--port', action="store", type=int, choices=[4242, 8443], default=4242, help='port number listening on for HTTP(S) connections (Default: 4242)')
107106
parser.add_argument('-t', '--tlsKeyPath', action="store", default=None, help='Directory path of tls privkey.pem and cert.pem file location (Required only for HTTPS port 8443)')

tests/test_logger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22
from source.bridgeLogger import configureLogging
3-
from nose.tools import assert_raises_regexp, assert_raises
3+
from nose.tools import assert_raises
44

55

66
def test_case01():
@@ -14,5 +14,5 @@ def test_case02():
1414

1515

1616
def test_case03():
17-
result = configureLogging('/tmp','mylog', 'abc')
17+
result = configureLogging('/tmp', 'mylog', 'abc')
1818
assert isinstance(result, logging.Logger)

0 commit comments

Comments
 (0)