feat: 完善类型注释,增加 mypy 类型检测

This commit is contained in:
Nanmi
2023-07-16 17:57:18 +08:00
parent e5bdc63323
commit 745e59c875
18 changed files with 116 additions and 90 deletions

View File

@@ -4,6 +4,7 @@
# thanks to aneasystone for his great work
import numpy as np
import math
from typing import List, Tuple
# https://github.com/gdsmith/jquery.easing/blob/master/jquery.easing.js
@@ -52,7 +53,7 @@ def ease_out_elastic(x):
return pow(2, -10 * x) * math.sin((x * 10 - 0.75) * c4) + 1
def get_tracks(distance, seconds, ease_func):
def get_tracks(distance, seconds, ease_func) -> Tuple[List[int], List[int]]:
tracks = [0]
offsets = [0]
for t in np.arange(0.0, seconds, 0.1):