

def _build_comments(self, soup):
    '\n        For the story, builds and returns a list of Comment objects.\n        '
    comments = []
    current_page = 1
    while True:
        if (current_page == 1):
            table = soup.findChildren('table')[3]
        elif (current_page > 1):
            table = soup.findChildren('table')[2]
        rows = table.findChildren(['tr'])
        rows = rows[:(len(rows) - 2)]
        rows = [self for (i, row) in enumerate(rows) if ((i % 2) == 0)]
        if (len(rows) > 1):
            for row in rows:
                if (not row.findChildren('td')):
                    continue
                level = (int(row.findChildren('td')[1].find('img').get('width')) // 40)
                spans = row.findChildren('td')[3].findAll('span')
                if (str(spans[0]) != '<span class="comhead"></span>'):
                    user = spans[0].contents[0].string
                    time_ago = spans[0].contents[1].string.strip().rstrip(' |')
                    try:
                        comment_id = int(re.match('item\\?id=(.*)', spans[0].contents[2].get('href')).groups()[0])
                    except AttributeError:
                        comment_id = int(re.match(('%s/item\\?id=(.*)' % BASE_URL), spans[0].contents[2].get('href')).groups()[0])
                    body = spans[1].text
                    if (body[(- 2):] == '--'):
                        body = body[:(- 5)]
                    try:
                        pat = re.compile('<span class="comment"><font color=".*">(.*)</font></span>')
                        body_html = re.match(pat, str(spans[1]).replace('\n', '')).groups()[0]
                    except AttributeError:
                        pat = re.compile('<span class="comment"><font color=".*">(.*)</font></p><p><font size="1">')
                        body_html = re.match(pat, str(spans[1]).replace('\n', '')).groups()[0]
                else:
                    user = ''
                    time_ago = ''
                    comment_id = (- 1)
                    body = '[deleted]'
                    body_html = '[deleted]'
                comment = Comment(comment_id, level, user, time_ago, body, body_html)
                comments.append(comment)
        next_page_url = self._get_next_page(soup, current_page)
        if (not next_page_url):
            break
        soup = get_soup(page=next_page_url)
        current_page += 1
    previous_comment = None
    return comments

dataset/ETHPy150Open karan/HackerNewsAPI/hn/hn.py Story._build_comments/VarMisuse@101/150 `row`->`self`