fixed python flake complaints.

This commit is contained in:
Aritra Chakraborty 2016-05-16 20:09:00 -04:00
parent 8e01247597
commit 8d6c601a45
3 changed files with 15 additions and 14 deletions

View File

@ -139,10 +139,10 @@ class ASCIItable():
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def head_read(self): def head_read(self):
""" """
get column labels by either reading get column labels
the first row or, if keyword "head[*]" is present, by either reading the first row or,
the last line of the header if keyword "head[*]" is present, the last line of the header
""" """
import re,shlex import re,shlex
@ -275,14 +275,13 @@ class ASCIItable():
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def labels(self, def labels(self,
tags = None, tags = None,
raw = False, raw = False):
):
""" """
returns abstract labels (e.g. "x" for "1_x","2_x",...) tell abstract labels.
unless raw output is requested.
"x" for "1_x","2_x",... unless raw output is requested.
operates on object tags or given list. operates on object tags or given list.
""" """
from collections import Iterable from collections import Iterable
if tags is None: tags = self.tags if tags is None: tags = self.tags

View File

@ -167,8 +167,8 @@ for name in filenames:
oldIndices = table.label_indexrange(label) oldIndices = table.label_indexrange(label)
Nold = max(1,len(oldIndices)) # Nold could be zero for new columns Nold = max(1,len(oldIndices)) # Nold could be zero for new columns
Nnew = len(output.label_indexrange(label)) Nnew = len(output.label_indexrange(label))
output.data_append(eval(evaluator[label]) if label in options.labels output.data_append(eval(evaluator[label]) if label in options.labels and
and (condition == '' or eval(eval(evaluator_condition))) (condition == '' or eval(eval(evaluator_condition)))
else np.tile([table.data[i] for i in oldIndices] else np.tile([table.data[i] for i in oldIndices]
if label in tabLabels if label in tabLabels
else np.nan, else np.nan,

View File

@ -64,10 +64,12 @@ for name in filenames:
errors = [] errors = []
remarks = [] remarks = []
if table.label_dimension(options.pos) != 3: errors.append('coordinates "{}" are not a vector.'.format(options.pos)) if table.label_dimension(options.pos) != 3:
errors.append('coordinates "{}" are not a vector.'.format(options.pos))
else: colCoord = table.label_index(options.pos) else: colCoord = table.label_index(options.pos)
if table.label_dimension(options.defgrad) != 9: errors.append('deformation gradient "{}" is not a tensor.'.format(options.defgrad)) if table.label_dimension(options.defgrad) != 9:
errors.append('deformation gradient "{}" is not a tensor.'.format(options.defgrad))
else: colF = table.label_index(options.defgrad) else: colF = table.label_index(options.defgrad)
if remarks != []: damask.util.croak(remarks) if remarks != []: damask.util.croak(remarks)
@ -91,7 +93,7 @@ for name in filenames:
maxcorner = np.array(map(max,coords)) maxcorner = np.array(map(max,coords))
grid = np.array(map(len,coords),'i') grid = np.array(map(len,coords),'i')
size = grid/np.maximum(np.ones(3,'d'), grid-1.0) * (maxcorner-mincorner) # size from edge to edge = dim * n/(n-1) size = grid/np.maximum(np.ones(3,'d'), grid-1.0) * (maxcorner-mincorner) # size from edge to edge = dim * n/(n-1)
size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # spacing for grid==1 set to smallest among other spacings size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # grid==1 spacing set to smallest among other ones
N = grid.prod() N = grid.prod()