<commit_before># -*- coding: utf-8 -*-

from linked_list import LinkedList


class Stack(object):
    def __init__(self, value_list):
        self._linked_list = LinkedList(value_list)
        self.top = self._linked_list.header
        self.size = len(self._linked_list)

    def is_empty(self):
        return bool(self.size())

    def push(self, value):
        self._linked_list.push(value)
        self.top = self._linked_list.header
        self.size += 1

    def pop(self):
        self._linked_list.pop()
        self.top = self._linked_list.header
        self.size -= 1<commit_msg>Fix some bugs.<commit_after># -*- coding: utf-8 -*-

from linked_list import LinkedList


class Stack(object):
    def __init__(self, value_list=None):
        if value_list:
            self._linked_list = LinkedList(value_list)
        else:
            self._linked_list = LinkedList()
        self.top = self._linked_list.header
        self.size = len(self._linked_list)

    def is_empty(self):
        return not bool(self.size)

    def push(self, value):
        self._linked_list.push(value)
        self.top = self._linked_list.header
        self.size += 1

    def pop(self):
        if not self.is_empty():
            value = self._linked_list.pop()
            self.top = self._linked_list.header
            self.size -= 1
            return value
{'fraction_non_alphanumeric': 0.10980103168754606, 'fraction_numerical': 0.004421518054532056, 'mean_word_length': 2.1728971962616823, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3654305', 'n_tokens_mistral': 420, 'n_tokens_neox': 407, 'n_words': 87}