spdkcli: fix pylint warnings
Fix Python code for warning produced by pylint. - C1801: Do not use `len(SEQUENCE)` to determine if a sequence is empty (len-as-condition) - W0611: Unused import * (unused-import) - C0411: standard import should be placed before X (wrong-import-order) - C0411: third party import X should be placed before X (wrong-import-order) - C0412: Imports from package X are not grouped (ungrouped-imports) - W0212: Access to a protected member _exit of a client class (protected-access) Change-Id: I2c0e8379f962eb2957b428617836867b2e725aeb Signed-off-by: Karol Latecki <karol.latecki@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471482 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
c4b94d878b
commit
2f05fbb6d1
@ -1,14 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import argparse
|
||||
import configshell_fb
|
||||
from os import getuid
|
||||
from rpc.client import JSONRPCException
|
||||
from configshell_fb import ConfigShell, shell, ExecutionError
|
||||
from spdkcli import UIRoot
|
||||
import rpc.client
|
||||
from pyparsing import (alphanums, Optional, Suppress, Word, Regex,
|
||||
removeQuotes, dblQuotedString, OneOrMore)
|
||||
from rpc.client import JSONRPCException, JSONRPCClient
|
||||
from spdkcli import UIRoot
|
||||
|
||||
|
||||
def add_quotes_to_shell(spdk_shell):
|
||||
@ -49,7 +46,7 @@ def main():
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
client = rpc.client.JSONRPCClient(args.server_addr, port=args.port)
|
||||
client = JSONRPCClient(args.server_addr, port=args.port)
|
||||
except JSONRPCException as e:
|
||||
spdk_shell.log.error("%s. SPDK not running?" % e)
|
||||
sys.exit(1)
|
||||
@ -62,7 +59,7 @@ def main():
|
||||
except BaseException:
|
||||
pass
|
||||
|
||||
if len(args.commands) > 0:
|
||||
if args.commands:
|
||||
try:
|
||||
spdk_shell.interactive = False
|
||||
spdk_shell.run_cmdline(" ".join(args.commands))
|
||||
@ -73,14 +70,13 @@ def main():
|
||||
|
||||
spdk_shell.con.display("SPDK CLI v0.1")
|
||||
spdk_shell.con.display("")
|
||||
while not spdk_shell._exit:
|
||||
try:
|
||||
spdk_shell.run_interactive()
|
||||
except (JSONRPCException, ExecutionError) as e:
|
||||
spdk_shell.log.error("%s" % e)
|
||||
except BrokenPipeError as e:
|
||||
spdk_shell.log.error("Lost connection with SPDK: %s" % e)
|
||||
break
|
||||
|
||||
try:
|
||||
spdk_shell.run_interactive()
|
||||
except (JSONRPCException, ExecutionError) as e:
|
||||
spdk_shell.log.error("%s" % e)
|
||||
except BrokenPipeError as e:
|
||||
spdk_shell.log.error("Lost connection with SPDK: %s" % e)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user