mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
422 B
26 lines
422 B
# -*- coding: utf-8 -*-
|
|
#
|
|
|
|
|
|
class Stack(list):
|
|
def is_empty(self):
|
|
return len(self) == 0
|
|
|
|
@property
|
|
def top(self):
|
|
if self.is_empty():
|
|
return None
|
|
return self[-1]
|
|
|
|
@property
|
|
def bottom(self):
|
|
if self.is_empty():
|
|
return None
|
|
return self[0]
|
|
|
|
def size(self):
|
|
return len(self)
|
|
|
|
def push(self, item):
|
|
self.append(item)
|