From 2e8d5023a20a1ab35d465f3ad8bed0cb63ac74a6 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 22 Jan 2017 08:48:28 +0300 Subject: test: fix Pylint warnings --- test/.pylintrc | 31 ------------------------------- test/cavp.py | 10 +++++----- test/file.py | 10 +++++----- test/nist-sp-800-38a.py | 13 ++++++------- 4 files changed, 16 insertions(+), 48 deletions(-) diff --git a/test/.pylintrc b/test/.pylintrc index 3ef0c07..57a9737 100644 --- a/test/.pylintrc +++ b/test/.pylintrc @@ -1,34 +1,3 @@ [MASTER] -#disable=coerce-method,import-star-module-level,basestring-builtin,old-ne-operator,raising-string,apply-builtin,unicode-builtin,buffer-builtin,delslice-method,input-builtin,xrange-builtin,round-builtin,hex-method,using-cmp-argument,standarderror-builtin,print-statement,unichr-builtin,cmp-builtin,map-builtin-not-iterating,oct-method,filter-builtin-not-iterating,parameter-unpacking,old-raise-syntax,backtick,old-octal-literal,suppressed-message,long-builtin,unpacking-in-except,metaclass-assignment,no-absolute-import,execfile-builtin,nonzero-method,missing-docstring,long-suffix,raw_input-builtin,old-division,getslice-method,indexing-exception,next-method-called,dict-iter-method,reload-builtin,coerce-builtin,dict-view-method,cmp-method,setslice-method,range-builtin-not-iterating,useless-suppression,zip-builtin-not-iterating,intern-builtin,file-builtin,reduce-builtin disable=invalid-name,missing-docstring - -[BASIC] - -#bad-functions=map,filter -#good-names=i,j,k,ex,Run,_ -#bad-names=foo,bar,baz,toto,tutu,tata -#name-group= -#include-naming-hint=no -#method-rgx=[a-z_][a-z0-9_]{2,30}$ -#method-name-hint=[a-z_][a-z0-9_]{2,30}$ -#attr-rgx=[a-z_][a-z0-9_]{2,30}$ -#attr-name-hint=[a-z_][a-z0-9_]{2,30}$ -#module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ -#module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ -#argument-rgx=[a-z_][a-z0-9_]{2,30}$ -#argument-name-hint=[a-z_][a-z0-9_]{2,30}$ -#class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ -#class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ -#class-rgx=[A-Z_][a-zA-Z0-9]+$ -#class-name-hint=[A-Z_][a-zA-Z0-9]+$ -#const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ -#const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ -#variable-rgx=[a-z_][a-z0-9_]{2,30}$ -#variable-name-hint=[a-z_][a-z0-9_]{2,30}$ -#inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ -#inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ -#function-rgx=[a-z_][a-z0-9_]{2,30}$ -#function-name-hint=[a-z_][a-z0-9_]{2,30}$ -#no-docstring-rgx=^_ -#docstring-min-length=-1 diff --git a/test/cavp.py b/test/cavp.py index b8513e8..87c582f 100644 --- a/test/cavp.py +++ b/test/cavp.py @@ -216,9 +216,10 @@ def run_tests(archive_path, tools_path=(), use_sde=False, use_boxes=False, log_p else: return 1 -def _parse_args(args=sys.argv): +def _parse_args(args=None): + if args is None: + args = sys.argv[1:] parser = argparse.ArgumentParser() - parser.add_argument('--path', '-p', dest='tools_path', metavar='PATH', nargs='*', help='set block encryption utilities directory path') @@ -231,10 +232,9 @@ def _parse_args(args=sys.argv): help='set test vectors archive file path') parser.add_argument('--log', '-l', dest='log_path', metavar='PATH', help='set log file path') + return parser.parse_args(args) - return parser.parse_args(args[1:]) - -def main(args=sys.argv): +def main(args=None): args = _parse_args(args) return run_tests(**vars(args)) diff --git a/test/file.py b/test/file.py index d6d691a..2a7707e 100644 --- a/test/file.py +++ b/test/file.py @@ -186,9 +186,10 @@ def run_tests(suite_path, tools_path=(), log_path=None, use_sde=False, force=Fal else: return 1 -def _parse_args(args=sys.argv): +def _parse_args(args=None): + if args is None: + args = sys.argv[1:] parser = argparse.ArgumentParser() - parser.add_argument('--path', '-p', dest='tools_path', metavar='PATH', nargs='*', help='set file encryption utilities directory path') @@ -200,10 +201,9 @@ def _parse_args(args=sys.argv): help='overwrite ciphertext files') parser.add_argument('--suite', '-s', dest='suite_path', default='file/', help='set test suite directory path') + return parser.parse_args(args) - return parser.parse_args(args[1:]) - -def main(args=sys.argv): +def main(args=None): return run_tests(**vars(_parse_args(args))) if __name__ == '__main__': diff --git a/test/nist-sp-800-38a.py b/test/nist-sp-800-38a.py index 024cfe6..3aa9ed2 100644 --- a/test/nist-sp-800-38a.py +++ b/test/nist-sp-800-38a.py @@ -247,9 +247,10 @@ def run_tests(tools_path=(), use_sde=False, use_boxes=False, log_path=None): else: return 1 -def _parse_args(args=sys.argv): +def _parse_args(args=None): + if args is None: + args = sys.argv[1:] parser = argparse.ArgumentParser() - parser.add_argument('--path', '-p', dest='tools_path', metavar='PATH', nargs='*', help='set block encryption utilities directory path') @@ -259,12 +260,10 @@ def _parse_args(args=sys.argv): help='use the "boxes" interface') parser.add_argument('--log', '-l', dest='log_path', metavar='PATH', help='set log file path') + return parser.parse_args(args) - return parser.parse_args(args[1:]) - -def main(args=sys.argv): - args = _parse_args(args) - return run_tests(**vars(args)) +def main(args=None): + return run_tests(**vars(_parse_args(args))) if __name__ == '__main__': sys.exit(main()) -- cgit v1.2.3