advise from pylint

This commit is contained in:
Martin Diehl 2020-03-22 17:03:28 +01:00
parent 1dfdd264b7
commit bbce3456e8
5 changed files with 142 additions and 143 deletions

View File

@ -425,7 +425,7 @@ class Result:
for pa in path: for pa in path:
label = pa.split('/')[2] label = pa.split('/')[2]
if (pa.split('/')[1] == 'geometry'): if pa.split('/')[1] == 'geometry':
dataset = np.array(f[pa]) dataset = np.array(f[pa])
continue continue

View File

@ -365,8 +365,7 @@ class Rotation:
@staticmethod @staticmethod
def fromAverage(rotations, def fromAverage(rotations,weights = None):
weights = []):
""" """
Average rotation. Average rotation.
@ -387,7 +386,7 @@ class Rotation:
raise TypeError("Only instances of Rotation can be averaged.") raise TypeError("Only instances of Rotation can be averaged.")
N = len(rotations) N = len(rotations)
if weights == [] or not weights: if not weights:
weights = np.ones(N,dtype='i') weights = np.ones(N,dtype='i')
for i,(r,n) in enumerate(zip(rotations,weights)): for i,(r,n) in enumerate(zip(rotations,weights)):

View File

@ -327,9 +327,9 @@ class Table:
seen = set() seen = set()
labels = [] labels = []
for l in [x for x in self.data.columns if not (x in seen or seen.add(x))]: for l in [x for x in self.data.columns if not (x in seen or seen.add(x))]:
if(self.shapes[l] == (1,)): if self.shapes[l] == (1,):
labels.append('{}'.format(l)) labels.append('{}'.format(l))
elif(len(self.shapes[l]) == 1): elif len(self.shapes[l]) == 1:
labels += ['{}_{}'.format(i+1,l) \ labels += ['{}_{}'.format(i+1,l) \
for i in range(self.shapes[l][0])] for i in range(self.shapes[l][0])]
else: else:

View File

@ -168,11 +168,11 @@ class VTK:
Filename for writing. Filename for writing.
""" """
if (isinstance(self.geom,vtk.vtkRectilinearGrid)): if isinstance(self.geom,vtk.vtkRectilinearGrid):
writer = vtk.vtkXMLRectilinearGridWriter() writer = vtk.vtkXMLRectilinearGridWriter()
elif(isinstance(self.geom,vtk.vtkUnstructuredGrid)): elif isinstance(self.geom,vtk.vtkUnstructuredGrid):
writer = vtk.vtkXMLUnstructuredGridWriter() writer = vtk.vtkXMLUnstructuredGridWriter()
elif(isinstance(self.geom,vtk.vtkPolyData)): elif isinstance(self.geom,vtk.vtkPolyData):
writer = vtk.vtkXMLPolyDataWriter() writer = vtk.vtkXMLPolyDataWriter()
default_ext = writer.GetDefaultFileExtension() default_ext = writer.GetDefaultFileExtension()
@ -234,17 +234,17 @@ class VTK:
ren = vtk.vtkRenderer() ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow() window = vtk.vtkRenderWindow()
renWin.AddRenderer(ren) window.AddRenderer(ren)
ren.AddActor(actor) ren.AddActor(actor)
ren.SetBackground(0.2,0.2,0.2) ren.SetBackground(0.2,0.2,0.2)
renWin.SetSize(Environment().screen_width,Environment().screen_height) window.SetSize(Environment().screen_width,Environment().screen_height)
iren = vtk.vtkRenderWindowInteractor() iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin) iren.SetRenderWindow(window)
iren.Initialize() iren.Initialize()
renWin.Render() window.Render()
iren.Start() iren.Start()