aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-10-10 10:24:42 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-10-10 10:24:42 +0300
commit27e36a6dd2546731c37fcc42bb372ad9a552e410 (patch)
tree0e6b1a89932cbcfe9db9b798a2b8949b26d187f7
parentcode style (diff)
downloadfilters-27e36a6dd2546731c37fcc42bb372ad9a552e410.tar.gz
filters-27e36a6dd2546731c37fcc42bb372ad9a552e410.zip
fix Pylint warnings
Diffstat (limited to '')
-rw-r--r--.pylintrc152
-rw-r--r--README.md20
-rw-r--r--bin/shift.py6
-rw-r--r--bin/utils/cmd_line.py12
4 files changed, 52 insertions, 138 deletions
diff --git a/.pylintrc b/.pylintrc
index 78e6f48..03ab69b 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -1,130 +1,40 @@
[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=duplicate-code,missing-docstring
+#disable=old-ne-operator,filter-builtin-not-iterating,nonzero-method,long-builtin,unpacking-in-except,backtick,suppressed-message,setslice-method,round-builtin,coerce-builtin,input-builtin,raising-string,raw_input-builtin,apply-builtin,delslice-method,useless-suppression,hex-method,zip-builtin-not-iterating,range-builtin-not-iterating,intern-builtin,old-octal-literal,xrange-builtin,no-absolute-import,cmp-builtin,reduce-builtin,next-method-called,getslice-method,oct-method,reload-builtin,dict-view-method,file-builtin,long-suffix,parameter-unpacking,dict-iter-method,cmp-method,old-division,using-cmp-argument,buffer-builtin,old-raise-syntax,indexing-exception,unicode-builtin,unichr-builtin,coerce-method,basestring-builtin,map-builtin-not-iterating,metaclass-assignment,print-statement,import-star-module-level,standarderror-builtin,execfile-builtin
+disable=bad-whitespace,duplicate-code,missing-docstring,multiple-statements
[BASIC]
-# List of builtins function names that should not be used, separated by a comma
-bad-functions=map,filter
-
-# Good variable names which should always be accepted, separated by a comma
-good-names=x,y,i,j,k,ex,Run,_
-
-# Bad variable names which should always be refused, separated by a comma
-bad-names=foo,bar,baz,toto,tutu,tata
-
-# 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 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 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 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 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 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 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 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 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 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 constant names
-const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
-
-# Naming hint for constant names
-const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
-
-# 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=i,j,n,x,y
+#bad-names=foo,bar,baz,toto,tutu,tata
+#name-group=
+#include-naming-hint=no
+#class-rgx=[A-Z_][a-zA-Z0-9]+$
+#class-name-hint=[A-Z_][a-zA-Z0-9]+$
+#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]+))$
+#inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
+#inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
+#variable-rgx=[a-z_][a-z0-9_]{2,30}$
+#variable-name-hint=[a-z_][a-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}$
+#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}|(__.*__))$
+#no-docstring-rgx=^_
+#docstring-min-length=-1
[TYPECHECK]
-# Tells whether missing members accessed in mixin class should be ignored. A
-# mixin class is detected if its name ends with "mixin" (case insensitive).
-ignore-mixin-members=yes
-
-# List of module names for which member attributes should not be checked
-# (useful for modules/projects where namespaces are manipulated during runtime
-# and thus existing member attributes cannot be deduced by static analysis. It
-# supports qualified module names, as well as Unix pattern matching.
+#ignored-modules=
ignored-modules=cv2
-
-# List of classes names for which member attributes should not be checked
-# (useful for classes with attributes dynamically set). This supports can work
-# with qualified names.
-ignored-classes=
-
-# List of members which are set dynamically and missed by pylint inference
-# system, and so shouldn't trigger E1101 when accessed. Python regular
-# expressions are accepted.
-generated-members=
diff --git a/README.md b/README.md
index b57a9b9..7305a8c 100644
--- a/README.md
+++ b/README.md
@@ -13,11 +13,11 @@ Prerequisites
The versions below have been verified to work properly.
-| Software | Version |
-| ------------- | ------- |
-| CPython | 3.5.1 |
-| numpy | 1.11.0 |
-| opencv-python | 3.1.0 |
+Software | Version
+------------- | -------
+CPython | 3.5.1
+numpy | 1.11.0
+opencv-python | 3.1.0
[numpy]: http://www.numpy.org/
[opencv-python]: http://opencv.org/
@@ -46,11 +46,15 @@ The complete list of usable scripts is given below.
* gaussian_blur.py &mdash; Apply Gaussian blur to an image.
* shift.py &mdash; Shift an image by a few pixels in a specified direction.
-Linting
--------
+Development
+-----------
+
+### Linting
Requires [PyLint].
-Run from the top-level directory:
+
+ > cd
+ D:\workspace\personal\filters
> pylint filters
...
diff --git a/bin/shift.py b/bin/shift.py
index 94db333..b837c53 100644
--- a/bin/shift.py
+++ b/bin/shift.py
@@ -25,11 +25,11 @@ def _main_shift(
else:
image.save(output_path, output)
-def _parse_direction(s):
+def _parse_direction(src):
try:
- return Direction(s)
+ return Direction(src)
except ValueError:
- raise argparse.ArgumentTypeError('invalid direction: ' + s)
+ raise argparse.ArgumentTypeError('invalid direction: ' + src)
def _parse_args(args=sys.argv):
parser = argparse.ArgumentParser(
diff --git a/bin/utils/cmd_line.py b/bin/utils/cmd_line.py
index 6bfeafe..43f7bca 100644
--- a/bin/utils/cmd_line.py
+++ b/bin/utils/cmd_line.py
@@ -5,11 +5,11 @@
import argparse
-def parse_non_negative_integer(s):
+def parse_non_negative_integer(src):
try:
- x = int(s)
+ n = int(src)
except ValueError:
- raise argparse.ArgumentTypeError('must be a non-negative integer: ' + s)
- if x < 0:
- raise argparse.ArgumentTypeError('must be a non-negative integer: ' + s)
- return x
+ raise argparse.ArgumentTypeError('must be a non-negative integer: ' + src)
+ if n < 0:
+ raise argparse.ArgumentTypeError('must be a non-negative integer: ' + src)
+ return n