aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-08-29 03:47:44 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-08-29 03:47:44 +0300
commit1f13a4984ff3255c1c6eba9d97bbae97c4c25e59 (patch)
tree481bdd4fcccd47373e6b78c9b490948a7eefcc93
parentadd README (diff)
downloadfilters-1f13a4984ff3255c1c6eba9d97bbae97c4c25e59.tar.gz
filters-1f13a4984ff3255c1c6eba9d97bbae97c4c25e59.zip
fix Pylint warnings
-rw-r--r--.pylintrc130
-rw-r--r--gaussian.py6
-rw-r--r--mean.py4
-rw-r--r--shift.py42
4 files changed, 156 insertions, 26 deletions
diff --git a/.pylintrc b/.pylintrc
new file mode 100644
index 0000000..d657af9
--- /dev/null
+++ b/.pylintrc
@@ -0,0 +1,130 @@
+[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=missing-docstring
+
+[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
+
+[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=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/gaussian.py b/gaussian.py
index 743b70d..2e5ad90 100644
--- a/gaussian.py
+++ b/gaussian.py
@@ -31,8 +31,8 @@ def convolve(img, kernel):
DEFAULT_SIGMA = 1.
DEFAULT_RADIUS = 1
-def do(img_path, radius=DEFAULT_RADIUS, sigma=DEFAULT_SIGMA,
- output_path=None):
+def gaussian(img_path, radius=DEFAULT_RADIUS, sigma=DEFAULT_SIGMA,
+ output_path=None):
img = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE)
kernel = gen_kernel(radius, sigma)
@@ -65,7 +65,7 @@ def _parse_args(args=sys.argv):
return parser.parse_args(args[1:])
def main(args=sys.argv):
- do(**vars(_parse_args(args)))
+ gaussian(**vars(_parse_args(args)))
if __name__ == '__main__':
main()
diff --git a/mean.py b/mean.py
index 6b09eda..9fbfc03 100644
--- a/mean.py
+++ b/mean.py
@@ -25,7 +25,7 @@ def convolve(img, kernel):
DEFAULT_RADIUS = 1
-def do(img_path, radius=DEFAULT_RADIUS, output_path=None):
+def mean(img_path, radius=DEFAULT_RADIUS, output_path=None):
img = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE)
kernel = gen_kernel(radius)
output = convolve(img, kernel)
@@ -55,7 +55,7 @@ def _parse_args(args=sys.argv):
return parser.parse_args(args[1:])
def main(args=sys.argv):
- do(**vars(_parse_args(args)))
+ mean(**vars(_parse_args(args)))
if __name__ == '__main__':
main()
diff --git a/shift.py b/shift.py
index 76ca09a..ce4353b 100644
--- a/shift.py
+++ b/shift.py
@@ -11,14 +11,14 @@ import cv2
import numpy as np
class Direction(Enum):
- N = 'N'
- NE = 'NE'
- E = 'E'
- SE = 'SE'
- S = 'S'
- SW = 'SW'
- W = 'W'
- NW = 'NW'
+ NORTH = 'N'
+ NORTH_EAST = 'NE'
+ NORTH_WEST = 'NW'
+ SOUTH = 'S'
+ SOUTH_EAST = 'SE'
+ SOUTH_WEST = 'SW'
+ EAST = 'E'
+ WEST = 'W'
def gen_kernel(self, distance):
radius = distance
@@ -26,21 +26,21 @@ class Direction(Enum):
kernel = np.zeros((size, size))
x, y = radius, radius
- if self is Direction.N:
+ if self is Direction.NORTH:
x = -1
- elif self is Direction.NE:
+ elif self is Direction.NORTH_EAST:
x, y = -1, 0
- elif self is Direction.E:
+ elif self is Direction.EAST:
y = 0
- elif self is Direction.SE:
+ elif self is Direction.SOUTH_EAST:
x, y = 0, 0
- elif self is Direction.S:
+ elif self is Direction.SOUTH:
x = 0
- elif self is Direction.SW:
+ elif self is Direction.SOUTH_WEST:
x, y = 0, -1
- elif self is Direction.W:
+ elif self is Direction.WEST:
y = -1
- elif self is Direction.NW:
+ elif self is Direction.NORTH_WEST:
x, y = -1, -1
else:
raise NotImplementedError('unsupported direction: ' + str(self))
@@ -49,7 +49,7 @@ class Direction(Enum):
return kernel
def __str__(self):
- return self.name
+ return self.value
def convolve(img, kernel):
#print(kernel)
@@ -61,11 +61,11 @@ def convolve(img, kernel):
output[i, j] = np.sum(neighborhood * kernel)
return output
-DEFAULT_DIRECTION = Direction.SE
+DEFAULT_DIRECTION = Direction.SOUTH_EAST
DEFAULT_DISTANCE = 1
-def do(img_path, direction=DEFAULT_DIRECTION, distance=DEFAULT_DISTANCE,
- output_path=None):
+def shift(img_path, direction=DEFAULT_DIRECTION, distance=DEFAULT_DISTANCE,
+ output_path=None):
img = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE)
kernel = direction.gen_kernel(distance)
@@ -106,7 +106,7 @@ def _parse_args(args=sys.argv):
return parser.parse_args(args[1:])
def main(args=sys.argv):
- do(**vars(_parse_args(args)))
+ shift(**vars(_parse_args(args)))
if __name__ == '__main__':
main()