<commit_before>"""This module contains the deque data structure."""

from dbl_linked_list import DblLinkedList


class Deque(object):
    """This is the Deque data structure."""

    def __init__(self, maybe_an_iterable=None):
        """Initialize a deque data structure."""
        try:
            self._container = DblLinkedList(maybe_an_iterable)
        except TypeError:
            self._container = DblLinkedList(maybe_an_iterable)

    def append(self, val):
        """Append a node with given value to the tail."""
        self._container.append(val)

    def appendleft(self, val):
        """Append a node with given value to the head."""
        self._container.push(val)

    def pop(self):
        """Remove the node from the tail and return the value."""
        try:
            return self._container.shift()<commit_msg>Expanded Deque class docstring to include methods.<commit_after>"""This module contains the deque data structure."""

from dbl_linked_list import DblLinkedList


class Deque(object):
    """This is the Deque data structure.

    Methods:

        append():       Append a Node with given value to the tail.
        appendleft():   Push a Node with given value to the head.
        pop():          Remove the node from the head, return the value.
        popleft():      Remove the node from the tail, return the value.
        peek():         Return the value from the tail node.
        peekleft():     Return the value from the head node.

    """

    def __init__(self, maybe_an_iterable=None):
        """Initialize a deque data structure."""
        try:
            self._container = DblLinkedList(maybe_an_iterable)
        except TypeError:
            self._container = DblLinkedList(maybe_an_iterable)

    def append(self, val):
        """Append a node with given value to the tail."""
        self._container.append(val)

    def appendleft(self, val):
        """Append a node with given value to the head."""
        self._container.push(val)

    def pop(self):
        """Remove the node from the tail and return the value."""
        try:
            return self._container.shift()
{'fraction_non_alphanumeric': 0.09439252336448598, 'fraction_numerical': 0.0, 'mean_word_length': 2.48130081300813, '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': '7338529', 'n_tokens_mistral': 577, 'n_tokens_neox': 558, 'n_words': 212}