refactor: Follow the PEP 585 Typing standard (#439)

* Follow the PEP 585 Typing standard

* Update list.py
This commit is contained in:
Yudong Jin
2023-03-23 18:51:56 +08:00
committed by GitHub
parent f4e01ea32e
commit 8918ec9079
43 changed files with 256 additions and 342 deletions

View File

@ -4,15 +4,11 @@ Created Time: 2022-11-29
Author: Peng Chen (pengchzn@gmail.com)
"""
import sys, os.path as osp
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
from modules import *
class ArrayStack:
""" 基于数组实现的栈 """
def __init__(self) -> None:
""" 构造方法 """
self.__stack: List[int] = []
self.__stack: list[int] = []
def size(self) -> int:
""" 获取栈的长度 """
@ -36,7 +32,7 @@ class ArrayStack:
assert not self.is_empty(), "栈为空"
return self.__stack[-1]
def to_list(self) -> List[int]:
def to_list(self) -> list[int]:
""" 返回列表用于打印 """
return self.__stack