Skip to content
Snippets Groups Projects

code refactor

Merged Florian Obersteiner requested to merge (removed):master into master
1 file
+ 5
11
Compare changes
  • Side-by-side
  • Inline
+ 5
11
@@ -461,20 +461,12 @@ class Dataset:
dmp = [word.strip(" ") for word in dmp.split(self.splitChar)]
return dmp
if self.inputFhandle.closed:
self.inputFhandle = open(self.inputFhandle.name, encoding='utf-8')
if self.inputFhandle:
if self.inputFhandle.closed:
self.inputFhandle = open(self.inputFhandle.name, encoding='utf-8')
# TODO: refactor following try/except statement
# this one is challenging since we need an "unpopulated" file pointer if no file was specified :)
try:
f = FilehandleWithLinecounter(self.inputFhandle, splitChar)
self._readHeader(f)
del f
except:
a = 1
finally:
self.inputFhandle.close()
def _readHeader(self, f):
@@ -923,6 +915,8 @@ class Dataset:
self.defineMode = True
self.inputFhandle = None
# read data if f is not None
if f is not None:
if isinstance(f, (str, pathlib.Path)):
Loading