advise from pylint
This commit is contained in:
parent
1dfdd264b7
commit
bbce3456e8
|
@ -75,7 +75,7 @@ class Result:
|
|||
self.mat_physics += f['/'.join([self.increments[0],'materialpoint',m])].keys()
|
||||
self.mat_physics = list(set(self.mat_physics)) # make unique
|
||||
|
||||
self.selection= {'increments': self.increments,
|
||||
self.selection = {'increments': self.increments,
|
||||
'constituents': self.constituents,'materialpoints': self.materialpoints,
|
||||
'con_physics': self.con_physics, 'mat_physics': self.mat_physics
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ class Result:
|
|||
iterator = map(float,choice)
|
||||
choice = []
|
||||
for c in iterator:
|
||||
idx=np.searchsorted(self.times,c)
|
||||
idx = np.searchsorted(self.times,c)
|
||||
if np.isclose(c,self.times[idx]):
|
||||
choice.append(self.increments[idx])
|
||||
elif np.isclose(c,self.times[idx+1]):
|
||||
|
@ -141,12 +141,12 @@ class Result:
|
|||
if action == 'set':
|
||||
self.selection[what] = valid
|
||||
elif action == 'add':
|
||||
add=existing.union(valid)
|
||||
add_sorted=sorted(add, key=lambda x: int("".join([i for i in x if i.isdigit()])))
|
||||
add = existing.union(valid)
|
||||
add_sorted = sorted(add, key=lambda x: int("".join([i for i in x if i.isdigit()])))
|
||||
self.selection[what] = add_sorted
|
||||
elif action == 'del':
|
||||
diff=existing.difference(valid)
|
||||
diff_sorted=sorted(diff, key=lambda x: int("".join([i for i in x if i.isdigit()])))
|
||||
diff = existing.difference(valid)
|
||||
diff_sorted = sorted(diff, key=lambda x: int("".join([i for i in x if i.isdigit()])))
|
||||
self.selection[what] = diff_sorted
|
||||
|
||||
|
||||
|
@ -350,7 +350,7 @@ class Result:
|
|||
groups.append(group)
|
||||
else:
|
||||
match = [e for e_ in [glob.fnmatch.filter(f[group].keys(),s) for s in sets] for e in e_]
|
||||
if len(set(match)) == len(sets) : groups.append(group)
|
||||
if len(set(match)) == len(sets): groups.append(group)
|
||||
return groups
|
||||
|
||||
|
||||
|
@ -359,17 +359,17 @@ class Result:
|
|||
message = ''
|
||||
with h5py.File(self.fname,'r') as f:
|
||||
for i in self.iterate('increments'):
|
||||
message+='\n{} ({}s)\n'.format(i,self.times[self.increments.index(i)])
|
||||
message += '\n{} ({}s)\n'.format(i,self.times[self.increments.index(i)])
|
||||
for o,p in zip(['constituents','materialpoints'],['con_physics','mat_physics']):
|
||||
for oo in self.iterate(o):
|
||||
message+=' {}\n'.format(oo)
|
||||
message += ' {}\n'.format(oo)
|
||||
for pp in self.iterate(p):
|
||||
message+=' {}\n'.format(pp)
|
||||
message += ' {}\n'.format(pp)
|
||||
group = '/'.join([i,o[:-1],oo,pp]) # o[:-1]: plural/singular issue
|
||||
for d in f[group].keys():
|
||||
try:
|
||||
dataset = f['/'.join([group,d])]
|
||||
message+=' {} / ({}): {}\n'.\
|
||||
message += ' {} / ({}): {}\n'.\
|
||||
format(d,dataset.attrs['Unit'].decode(),dataset.attrs['Description'].decode())
|
||||
except KeyError:
|
||||
pass
|
||||
|
@ -425,7 +425,7 @@ class Result:
|
|||
for pa in path:
|
||||
label = pa.split('/')[2]
|
||||
|
||||
if (pa.split('/')[1] == 'geometry'):
|
||||
if pa.split('/')[1] == 'geometry':
|
||||
dataset = np.array(f[pa])
|
||||
continue
|
||||
|
||||
|
|
|
@ -365,8 +365,7 @@ class Rotation:
|
|||
|
||||
|
||||
@staticmethod
|
||||
def fromAverage(rotations,
|
||||
weights = []):
|
||||
def fromAverage(rotations,weights = None):
|
||||
"""
|
||||
Average rotation.
|
||||
|
||||
|
@ -387,7 +386,7 @@ class Rotation:
|
|||
raise TypeError("Only instances of Rotation can be averaged.")
|
||||
|
||||
N = len(rotations)
|
||||
if weights == [] or not weights:
|
||||
if not weights:
|
||||
weights = np.ones(N,dtype='i')
|
||||
|
||||
for i,(r,n) in enumerate(zip(rotations,weights)):
|
||||
|
|
|
@ -327,9 +327,9 @@ class Table:
|
|||
seen = set()
|
||||
labels = []
|
||||
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))
|
||||
elif(len(self.shapes[l]) == 1):
|
||||
elif len(self.shapes[l]) == 1:
|
||||
labels += ['{}_{}'.format(i+1,l) \
|
||||
for i in range(self.shapes[l][0])]
|
||||
else:
|
||||
|
|
|
@ -103,7 +103,7 @@ class VTK:
|
|||
Spatial position of the points.
|
||||
|
||||
"""
|
||||
vtk_points= vtk.vtkPoints()
|
||||
vtk_points = vtk.vtkPoints()
|
||||
vtk_points.SetData(np_to_vtk(points))
|
||||
|
||||
geom = vtk.vtkPolyData()
|
||||
|
@ -168,11 +168,11 @@ class VTK:
|
|||
Filename for writing.
|
||||
|
||||
"""
|
||||
if (isinstance(self.geom,vtk.vtkRectilinearGrid)):
|
||||
if isinstance(self.geom,vtk.vtkRectilinearGrid):
|
||||
writer = vtk.vtkXMLRectilinearGridWriter()
|
||||
elif(isinstance(self.geom,vtk.vtkUnstructuredGrid)):
|
||||
elif isinstance(self.geom,vtk.vtkUnstructuredGrid):
|
||||
writer = vtk.vtkXMLUnstructuredGridWriter()
|
||||
elif(isinstance(self.geom,vtk.vtkPolyData)):
|
||||
elif isinstance(self.geom,vtk.vtkPolyData):
|
||||
writer = vtk.vtkXMLPolyDataWriter()
|
||||
|
||||
default_ext = writer.GetDefaultFileExtension()
|
||||
|
@ -234,17 +234,17 @@ class VTK:
|
|||
|
||||
ren = vtk.vtkRenderer()
|
||||
|
||||
renWin = vtk.vtkRenderWindow()
|
||||
renWin.AddRenderer(ren)
|
||||
window = vtk.vtkRenderWindow()
|
||||
window.AddRenderer(ren)
|
||||
|
||||
ren.AddActor(actor)
|
||||
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.SetRenderWindow(renWin)
|
||||
iren.SetRenderWindow(window)
|
||||
|
||||
iren.Initialize()
|
||||
renWin.Render()
|
||||
window.Render()
|
||||
iren.Start()
|
||||
|
|
Loading…
Reference in New Issue