removing unused functionality

should simplify transition to new table class
This commit is contained in:
Martin Diehl 2020-03-03 08:21:19 +01:00
parent c360785217
commit b1f21b189b
1 changed files with 15 additions and 27 deletions

View File

@ -16,7 +16,7 @@ class ASCIItable():
def __init__(self, def __init__(self,
name = None, name = None,
outname = None, outname = None,
buffered = False, # flush writes buffered = False, # is ignored, only exists for compatibility reasons
labeled = True, # assume table has labels labeled = True, # assume table has labels
readonly = False, # no reading from file readonly = False, # no reading from file
): ):
@ -63,14 +63,6 @@ class ASCIItable():
except AttributeError: except AttributeError:
return str(string) return str(string)
# ------------------------------------------------------------------
def _quote(self,
what):
"""Quote empty or white space-containing output."""
return '{quote}{content}{quote}'.format(
quote = ('"' if str(what)=='' or re.search(r"\s",str(what)) else ''),
content = what)
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def close(self, def close(self,
dismiss = False): dismiss = False):
@ -161,7 +153,7 @@ class ASCIItable():
head = ['{}\theader'.format(len(self.info)+self.__IO__['labeled'])] if header else [] head = ['{}\theader'.format(len(self.info)+self.__IO__['labeled'])] if header else []
head.append(self.info) head.append(self.info)
if self.__IO__['labeled']: if self.__IO__['labeled']:
head.append('\t'.join(map(self._quote,self.tags))) head.append('\t'.join(self.tags))
if len(self.tags) == 0: raise ValueError('no labels present.') if len(self.tags) == 0: raise ValueError('no labels present.')
return self.output_write(head) return self.output_write(head)
@ -178,15 +170,11 @@ class ASCIItable():
'grid': lambda x: int(x), 'grid': lambda x: int(x),
'size': lambda x: float(x), 'size': lambda x: float(x),
'origin': lambda x: float(x), 'origin': lambda x: float(x),
'homogenization': lambda x: int(x),
'microstructures': lambda x: int(x),
} }
info = { info = {
'grid': np.zeros(3,'i'), 'grid': np.zeros(3,'i'),
'size': np.zeros(3,'d'), 'size': np.zeros(3,'d'),
'origin': np.zeros(3,'d'), 'origin': np.zeros(3,'d'),
'homogenization': 0,
'microstructures': 0,
} }
extra_header = [] extra_header = []
@ -434,9 +422,9 @@ class ASCIItable():
if len(self.data) == 0: return True if len(self.data) == 0: return True
if isinstance(self.data[0],list): if isinstance(self.data[0],list):
return self.output_write([delimiter.join(map(self._quote,items)) for items in self.data]) return self.output_write([delimiter.join(items) for items in self.data])
else: else:
return self.output_write( delimiter.join(map(self._quote,self.data))) return self.output_write( delimiter.join(self.data))
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def data_writeArray(self, def data_writeArray(self,