Skip to content

strip .list comments before counting fields #308

Description

@yakra

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:
continue

This 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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions