Skip to content

Commit

Permalink
Documentation changed A LOTgit status
Browse files Browse the repository at this point in the history
  • Loading branch information
Ad115 committed Sep 3, 2018
1 parent 2ba46ab commit ec4683d
Show file tree
Hide file tree
Showing 19 changed files with 441 additions and 1,092 deletions.
22 changes: 13 additions & 9 deletions ICGC_data_parser/ssm_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def push(self, line):

def __iter__(self):
return self
# ---

def __next__(self):
if self.buffer:
Expand Down Expand Up @@ -61,18 +62,21 @@ def __init__(self, *args, **kwargs):
# ---

def push_line(self, line):
"""Rebuffers line so that it is parsed next."""
self.reader.push(line)
# ---

def iter_lines(self):
return self.reader
# ---

def next_line(self):
"""Fetch the next raw line from the file."""
return next(self.reader)
# ---

def next_array(self):
def next_array(self, strict_whitespace=False):
"""Fetch the next line splitted into fields.
If ``strict_whitespace`` is True, then split on tabs rather than
whitespace. This allows for fields with spaces in them.
"""
return next(self.reader).split('\t')
# ---

Expand Down Expand Up @@ -123,9 +127,9 @@ def parse(record):
return parse
# ---

def parse_lines(self, filters=None):
"""Iterate through the file, filtering out the
lines not matching the regular expressions given.
def iter_lines(self, filters=None):
"""Iterate through the file's raw lines, filtering out the ones not
matching the regular expressions given.
"""
if filters is None:
filters = []
Expand Down Expand Up @@ -159,7 +163,7 @@ def parse(self, filters=None):
...
"""
for line in self.parse_lines(filters=filters):
for line in self.iter_lines(filters=filters):
# The parser reads the record from
# self.reader, so, we must rebuffer
# the line to parse it.
Expand Down

0 comments on commit ec4683d

Please sign in to comment.