From 8e52a404f9a99f93d57f8600b20d92519be66181 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 10 Oct 2016 11:14:25 +0300 Subject: test: fix Pylint warnings --- test/.pylintrc | 131 +++++++++++++-------------------------------------------- test/cavp.py | 4 +- test/file.py | 14 +++--- 3 files changed, 38 insertions(+), 111 deletions(-) diff --git a/test/.pylintrc b/test/.pylintrc index 3a9b28f..050452e 100644 --- a/test/.pylintrc +++ b/test/.pylintrc @@ -1,108 +1,35 @@ [MESSAGES CONTROL] -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED -confidence= - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). See also the "--disable" option for examples. -#enable= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once).You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use"--disable=all --enable=classes -# --disable=W" +#disable=reload-builtin,next-method-called,old-division,unicode-builtin,basestring-builtin,delslice-method,getslice-method,old-octal-literal,standarderror-builtin,reduce-builtin,xrange-builtin,coerce-builtin,coerce-method,buffer-builtin,file-builtin,filter-builtin-not-iterating,raising-string,no-absolute-import,print-statement,range-builtin-not-iterating,using-cmp-argument,map-builtin-not-iterating,indexing-exception,long-builtin,input-builtin,import-star-module-level,hex-method,unichr-builtin,zip-builtin-not-iterating,dict-view-method,backtick,cmp-builtin,old-raise-syntax,long-suffix,raw_input-builtin,execfile-builtin,dict-iter-method,parameter-unpacking,suppressed-message,unpacking-in-except,cmp-method,intern-builtin,metaclass-assignment,old-ne-operator,apply-builtin,round-builtin,oct-method,useless-suppression,setslice-method,nonzero-method disable=missing-docstring [BASIC] -# List of builtins function names that should not be used, separated by a comma -bad-functions= - -# Good variable names which should always be accepted, separated by a comma -good-names=i,e,fd,fp,iv - -# Bad variable names which should always be refused, separated by a comma -bad-names= - -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= - -# Include a hint for the correct naming format with invalid-name -include-naming-hint=no - -# Regular expression matching correct method names -method-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Naming hint for method names -method-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct inline iteration names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Naming hint for inline iteration names -inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ - -# Regular expression matching correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Naming hint for module names -module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression matching correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Naming hint for class names -class-name-hint=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression matching correct function names -function-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Naming hint for function names -function-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct class attribute names -class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ - -# Naming hint for class attribute names -class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ - -# Regular expression matching correct variable names -variable-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Naming hint for variable names -variable-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct constant names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Naming hint for constant names -const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Regular expression matching correct attribute names -attr-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Naming hint for attribute names -attr-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct argument names -argument-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Naming hint for argument names -argument-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=^_ - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=-1 +#bad-functions=map,filter +#good-names=i,j,k,ex,Run,_ +good-names=e,fd,i,iv +#bad-names=foo,bar,baz,toto,tutu,tata +#name-group= +#include-naming-hint=no +#variable-rgx=[a-z_][a-z0-9_]{2,30}$ +#variable-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]+))$ +#class-rgx=[A-Z_][a-zA-Z0-9]+$ +#class-name-hint=[A-Z_][a-zA-Z0-9]+$ +#method-rgx=[a-z_][a-z0-9_]{2,30}$ +#method-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}|(__.*__))$ +#const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ +#const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ +#function-rgx=[a-z_][a-z0-9_]{2,30}$ +#function-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}$ +#argument-rgx=[a-z_][a-z0-9_]{2,30}$ +#argument-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_]*$ +#no-docstring-rgx=^_ +#docstring-min-length=-1 diff --git a/test/cavp.py b/test/cavp.py index a08c94b..b8513e8 100644 --- a/test/cavp.py +++ b/test/cavp.py @@ -180,8 +180,8 @@ class TestArchive(zipfile.ZipFile): def enum_test_files(self): with TemporaryDirectory() as tmp_dir: - for fp in self.namelist(): - yield TestFile(self.extract(fp, tmp_dir)) + for path in self.namelist(): + yield TestFile(self.extract(path, tmp_dir)) def _build_default_log_path(): return datetime.now().strftime('{}_%Y-%m-%d_%H-%M-%S.log').format( diff --git a/test/file.py b/test/file.py index 6953d49..d6d691a 100644 --- a/test/file.py +++ b/test/file.py @@ -27,15 +27,15 @@ _PLAIN_EXT = 'plain' _CIPHER_EXT = 'cipher' def _list_dirs(root_path): - for fp in os.listdir(root_path): - fp = os.path.join(root_path, fp) - if os.path.isdir(fp): - yield fp + for path in os.listdir(root_path): + path = os.path.join(root_path, path) + if os.path.isdir(path): + yield path def _list_files(root_path, ext): - for fp in glob(os.path.join(root_path, '*.{}'.format(ext))): - if os.path.isfile(fp): - yield fp + for path in glob(os.path.join(root_path, '*.{}'.format(ext))): + if os.path.isfile(path): + yield path def _list_keys(root_path): return _list_files(root_path, _KEY_EXT) -- cgit v1.2.3