mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
fix(ci): Update pre-commit hooks and apply new black (#4359)
* fix(ci): Update pre-commit hooks and apply new black * remove empty docstring
This commit is contained in:
@ -22,28 +22,28 @@ class Stack:
|
||||
return str(self.stack)
|
||||
|
||||
def push(self, data):
|
||||
""" Push an element to the top of the stack."""
|
||||
"""Push an element to the top of the stack."""
|
||||
if len(self.stack) >= self.limit:
|
||||
raise StackOverflowError
|
||||
self.stack.append(data)
|
||||
|
||||
def pop(self):
|
||||
""" Pop an element off of the top of the stack."""
|
||||
"""Pop an element off of the top of the stack."""
|
||||
return self.stack.pop()
|
||||
|
||||
def peek(self):
|
||||
""" Peek at the top-most element of the stack."""
|
||||
"""Peek at the top-most element of the stack."""
|
||||
return self.stack[-1]
|
||||
|
||||
def is_empty(self) -> bool:
|
||||
""" Check if a stack is empty."""
|
||||
"""Check if a stack is empty."""
|
||||
return not bool(self.stack)
|
||||
|
||||
def is_full(self) -> bool:
|
||||
return self.size() == self.limit
|
||||
|
||||
def size(self) -> int:
|
||||
""" Return the size of the stack."""
|
||||
"""Return the size of the stack."""
|
||||
return len(self.stack)
|
||||
|
||||
def __contains__(self, item) -> bool:
|
||||
|
Reference in New Issue
Block a user