Removing .list line comments before checking the number of fields will make life easier for implementing #58:
line=line.strip().rstrip('\x00')
# ignore empty or "comment" linesiflen(line) ==0orline.startswith("#"):
continue->
# ignore comments, leading/trailing whitespace, trailing null zerosline=line.split('#')[0].strip()
# ignore empty linesiflen(line) ==0:
continueThis stays the same:
fields = re.split('[ \t]+',line)
The payoff is when we get here:
iflen(fields) !=4:
# OK if 5th field exists and starts with #iflen(fields) <5ornotfields[4].startswith("#"):
self.log_entries.append("Incorrect format line: "+line)
continue->
iflen(fields) ==4:
# Do what we're already doingeliflen(fields) ==6:
# https://github.com/TravelMapping/DataProcessing/issues/58else:
self.log_entries.append("Incorrect format line: "+line)
continue...rather than something a lot more complex.
Removing .list line comments before checking the number of fields will make life easier for implementing #58:
->
This stays the same:
fields = re.split('[ \t]+',line)The payoff is when we get here:
->
...rather than something a lot more complex.