Skip to content

Commit 7fa6bbc

Browse files
committed
pylint compliant for py3, no object inheritance, static methods
1 parent 3e657d8 commit 7fa6bbc

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

pygem/rbf_factory.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
import numpy as np
55

66

7-
class classproperty(object):
7+
class classproperty():
88
def __init__(self, f):
99
self.f = f
1010

1111
def __get__(self, obj, owner):
1212
return self.f(owner)
1313

1414

15-
class RBFFactory(object):
15+
class RBFFactory():
1616
"""
1717
Factory class that spawns the radial basis functions.
1818
@@ -24,6 +24,7 @@ class RBFFactory(object):
2424
>>> for fname in RBFFactory.bases:
2525
>>> y = RBFFactory(fname)(x)
2626
"""
27+
@staticmethod
2728
def gaussian_spline(X, r=1):
2829
"""
2930
It implements the following formula:
@@ -40,6 +41,7 @@ def gaussian_spline(X, r=1):
4041
result = np.exp(-(X * X) / (r * r))
4142
return result
4243

44+
@staticmethod
4345
def multi_quadratic_biharmonic_spline(X, r=1):
4446
"""
4547
It implements the following formula:
@@ -56,6 +58,7 @@ def multi_quadratic_biharmonic_spline(X, r=1):
5658
result = np.sqrt((X * X) + (r * r))
5759
return result
5860

61+
@staticmethod
5962
def inv_multi_quadratic_biharmonic_spline(X, r=1):
6063
"""
6164
It implements the following formula:
@@ -73,6 +76,7 @@ def inv_multi_quadratic_biharmonic_spline(X, r=1):
7376
result = 1.0 / (np.sqrt((X * X) + (r * r)))
7477
return result
7578

79+
@staticmethod
7680
def thin_plate_spline(X, r=1):
7781
"""
7882
It implements the following formula:
@@ -93,6 +97,7 @@ def thin_plate_spline(X, r=1):
9397
result = np.where(arg > 0, result * np.log(arg), result)
9498
return result
9599

100+
@staticmethod
96101
def beckert_wendland_c2_basis(X, r=1):
97102
"""
98103
It implements the following formula:
@@ -114,6 +119,7 @@ def beckert_wendland_c2_basis(X, r=1):
114119
result = first * second
115120
return result
116121

122+
@staticmethod
117123
def polyharmonic_spline(X, r=1, k=2):
118124
"""
119125
It implements the following formula:
@@ -162,13 +168,14 @@ def polyharmonic_spline(X, r=1, k=2):
162168
## ##
163169
############################################################################
164170
__bases = {
165-
'gaussian_spline': gaussian_spline,
166-
'multi_quadratic_biharmonic_spline': multi_quadratic_biharmonic_spline,
171+
'gaussian_spline': gaussian_spline.__func__,
172+
'multi_quadratic_biharmonic_spline':
173+
multi_quadratic_biharmonic_spline.__func__,
167174
'inv_multi_quadratic_biharmonic_spline':
168-
inv_multi_quadratic_biharmonic_spline,
169-
'thin_plate_spline': thin_plate_spline,
170-
'beckert_wendland_c2_basis': beckert_wendland_c2_basis,
171-
'polyharmonic_spline': polyharmonic_spline
175+
inv_multi_quadratic_biharmonic_spline.__func__,
176+
'thin_plate_spline': thin_plate_spline.__func__,
177+
'beckert_wendland_c2_basis': beckert_wendland_c2_basis.__func__,
178+
'polyharmonic_spline': polyharmonic_spline.__func__
172179
}
173180

174181
def __new__(self, fname):
@@ -177,11 +184,10 @@ def __new__(self, fname):
177184
# implemented radial basis functions
178185
if fname in self.bases:
179186
return self.__bases[fname]
180-
else:
181-
raise NameError(
182-
"""The name of the basis function in the parameters file is not
183-
correct or not implemented. Check the documentation for
184-
all the available functions.""")
187+
raise NameError(
188+
"""The name of the basis function in the parameters file is not
189+
correct or not implemented. Check the documentation for
190+
all the available functions.""")
185191

186192
@classproperty
187193
def bases(self):

0 commit comments

Comments
 (0)