Skip to content

Commit 3f4afc3

Browse files
authored
Merge pull request #143 from mtezzele/codacy
fix codacy issues
2 parents dc5482c + b10e3cb commit 3f4afc3

File tree

11 files changed

+300
-303
lines changed

11 files changed

+300
-303
lines changed

pygem/filehandler.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class FileHandler(object):
1010
1111
:cvar string infile: name of the input file to be processed.
1212
:cvar string outfile: name of the output file where to write in.
13-
:cvar list extensions: extensions of the input/output files. It is specific for each
14-
subclass.
13+
:cvar list extensions: extensions of the input/output files. It is specific
14+
for each subclass.
1515
"""
1616

1717
def __init__(self):
@@ -41,22 +41,23 @@ def write(self, *args):
4141

4242
def _check_extension(self, filename):
4343
"""
44-
This private class method checks if the given `filename` has the proper `extension` set
45-
in the child class. If not it raises a ValueError.
44+
This private class method checks if the given `filename` has the proper
45+
`extension` set in the child class. If not it raises a ValueError.
4646
4747
:param string filename: file to check.
4848
"""
4949
__, file_ext = os.path.splitext(filename)
5050
if file_ext not in self.extensions:
5151
raise ValueError(
5252
'The input file does not have the proper extension. \
53-
It is {0!s}, instead of {1!s}.'.format(file_ext,
54-
self.extensions))
53+
It is {0!s}, instead of {1!s}.'
54+
.format(file_ext, self.extensions))
5555

5656
@staticmethod
5757
def _check_filename_type(filename):
5858
"""
59-
This private static method checks if `filename` is a string. If not it raises a TypeError.
59+
This private static method checks if `filename` is a string. If not it
60+
raises a TypeError.
6061
6162
:param string filename: file to check.
6263
"""
@@ -66,9 +67,9 @@ def _check_filename_type(filename):
6667

6768
def _check_infile_instantiation(self):
6869
"""
69-
This private method checks if `self.infile` is instantiated. If not it means
70-
that nobody called the parse method and `self.infile` is None. If the check fails
71-
it raises a RuntimeError.
70+
This private method checks if `self.infile` is instantiated. If not
71+
it means that nobody called the parse method and `self.infile` is None.
72+
If the check fails it raises a RuntimeError.
7273
7374
"""
7475
if not self.infile:

pygem/freeform.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ def perform(self):
9898
self.original_mesh_points - translation, transformation)
9999

100100
# select mesh points inside bounding box
101-
mesh_points = reference_frame_mesh_points[
102-
(reference_frame_mesh_points[:, 0] >= 0.)
103-
& (reference_frame_mesh_points[:, 0] <= 1.) &
104-
(reference_frame_mesh_points[:, 1] >= 0.) &
105-
(reference_frame_mesh_points[:, 1] <= 1.) &
106-
(reference_frame_mesh_points[:, 2] >= 0.) &
107-
(reference_frame_mesh_points[:, 2] <= 1.)]
101+
mesh_points = reference_frame_mesh_points[(
102+
reference_frame_mesh_points[:, 0] >= 0.) & (
103+
reference_frame_mesh_points[:, 0] <= 1.) & (
104+
reference_frame_mesh_points[:, 1] >= 0.) & (
105+
reference_frame_mesh_points[:, 1] <= 1.) & (
106+
reference_frame_mesh_points[:, 2] >= 0.) & (
107+
reference_frame_mesh_points[:, 2] <= 1.)]
108108
(n_rows_mesh, n_cols_mesh) = mesh_points.shape
109109

110110
# Initialization. In order to exploit the contiguity in memory the
@@ -156,13 +156,12 @@ def perform(self):
156156

157157
# merge non-shifted mesh points with shifted ones
158158
self.modified_mesh_points = np.copy(self.original_mesh_points)
159-
self.modified_mesh_points[(reference_frame_mesh_points[:, 0] >= 0.)
160-
& (reference_frame_mesh_points[:, 0] <= 1.) &
161-
(reference_frame_mesh_points[:, 1] >= 0.) &
162-
(reference_frame_mesh_points[:, 1] <= 1.) &
163-
(reference_frame_mesh_points[:, 2] >= 0.) &
164-
(reference_frame_mesh_points[:, 2] <=
165-
1.)] = new_mesh_points
159+
self.modified_mesh_points[(reference_frame_mesh_points[:, 0] >= 0.) & (
160+
reference_frame_mesh_points[:, 0] <= 1.
161+
) & (reference_frame_mesh_points[:, 1] >= 0.) & (
162+
reference_frame_mesh_points[:, 1] <= 1.) & (
163+
reference_frame_mesh_points[:, 2] >= 0.) & (
164+
reference_frame_mesh_points[:, 2] <= 1.)] = new_mesh_points
166165

167166
@staticmethod
168167
def _transform_points(original_points, transformation):

0 commit comments

Comments
 (0)