Compare commits

...

2 commits

Author SHA1 Message Date
bd3f622a65 从代码中移除pytz
All checks were successful
ci/woodpecker/push/check_format Pipeline was successful
2025-06-28 19:59:20 +08:00
7dba11029b 依赖升级 2025-06-28 19:43:36 +08:00
4 changed files with 22 additions and 20 deletions

View file

@ -1,6 +1,6 @@
from datetime import datetime from datetime import datetime
from zoneinfo import ZoneInfo
import pytz
import tzlocal import tzlocal
@ -17,7 +17,7 @@ def the_same_time(a: datetime | None = None, b: datetime | None = None) -> bool:
def get_server_weekday(): def get_server_weekday():
return datetime.now(pytz.timezone("Asia/Dubai")).weekday() return datetime.now(ZoneInfo("Asia/Dubai")).weekday()
def iso_8601_with_tz(dt: datetime, tz: str | None = None) -> str: def iso_8601_with_tz(dt: datetime, tz: str | None = None) -> str:
@ -28,8 +28,7 @@ def iso_8601_with_tz(dt: datetime, tz: str | None = None) -> str:
""" """
if not tz: if not tz:
tz = tzlocal.get_localzone().key tz = tzlocal.get_localzone().key
timezone = pytz.timezone(tz) dt_aware = dt.replace(tzinfo=ZoneInfo(tz))
dt_aware = timezone.localize(dt)
return dt_aware.isoformat(timespec="seconds") return dt_aware.isoformat(timespec="seconds")

View file

@ -53,7 +53,6 @@ jsonpickle==4.0.5
# 时区 # 时区
tzlocal==5.3.1 tzlocal==5.3.1
pytz==2025.2
# 网络请求 # 网络请求
requests==2.32.3 requests==2.32.3
@ -80,5 +79,8 @@ PyAutoGUI==0.9.54
# 2.8.2 会报 WinError 10055 # 2.8.2 会报 WinError 10055
adbutils==2.8.0 adbutils==2.8.0
# 模仿人类滑动轨迹
pytweening==1.2.0
# scrcpy截图 # scrcpy截图
av==14.3.0 av==14.3.0

View file

@ -20,7 +20,7 @@ blinker==1.9.0
# via flask # via flask
brotli==1.1.0 brotli==1.1.0
# via flask-compress # via flask-compress
certifi==2025.4.26 certifi==2025.6.15
# via requests # via requests
cffi==1.17.1 cffi==1.17.1
# via cryptography # via cryptography
@ -62,7 +62,7 @@ flask-cors==5.0.1
# via -r requirements.in # via -r requirements.in
flatbuffers==25.2.10 flatbuffers==25.2.10
# via onnxruntime # via onnxruntime
greenlet==3.2.2 greenlet==3.2.3
# via sqlalchemy # via sqlalchemy
h11==0.16.0 h11==0.16.0
# via wsproto # via wsproto
@ -80,7 +80,7 @@ jinja2==3.1.6
# via # via
# -r requirements.in # -r requirements.in
# flask # flask
joblib==1.5.0 joblib==1.5.1
# via scikit-learn # via scikit-learn
jsonpickle==4.0.5 jsonpickle==4.0.5
# via -r requirements.in # via -r requirements.in
@ -113,7 +113,7 @@ numpy==2.2.5
# scipy # scipy
# shapely # shapely
# tifffile # tifffile
onnxruntime==1.21.1 onnxruntime==1.22.0
# via rapidocr-onnxruntime # via rapidocr-onnxruntime
opencv-python==4.11.0.86 opencv-python==4.11.0.86
# via # via
@ -135,7 +135,7 @@ pillow==11.2.1
# imageio # imageio
# rapidocr-onnxruntime # rapidocr-onnxruntime
# scikit-image # scikit-image
protobuf==6.30.2 protobuf==6.31.1
# via onnxruntime # via onnxruntime
psutil==7.0.0 psutil==7.0.0
# via -r requirements.in # via -r requirements.in
@ -172,11 +172,11 @@ pyscreeze==1.0.1
python-dateutil==2.9.0.post0 python-dateutil==2.9.0.post0
# via pandas # via pandas
pytweening==1.2.0 pytweening==1.2.0
# via pyautogui
pytz==2025.2
# via # via
# -r requirements.in # -r requirements.in
# pandas # pyautogui
pytz==2025.2
# via pandas
pywavelets==1.8.0 pywavelets==1.8.0
# via imagehash # via imagehash
pyyaml==6.0.2 pyyaml==6.0.2
@ -206,7 +206,7 @@ scipy==1.15.2
# imagehash # imagehash
# scikit-image # scikit-image
# scikit-learn # scikit-learn
shapely==2.1.0 shapely==2.1.1
# via rapidocr-onnxruntime # via rapidocr-onnxruntime
simple-websocket==1.1.0 simple-websocket==1.1.0
# via -r requirements.in # via -r requirements.in
@ -224,17 +224,17 @@ sympy==1.14.0
# via onnxruntime # via onnxruntime
threadpoolctl==3.6.0 threadpoolctl==3.6.0
# via scikit-learn # via scikit-learn
tifffile==2025.3.30 tifffile==2025.6.11
# via scikit-image # via scikit-image
tqdm==4.67.1 tqdm==4.67.1
# via rapidocr-onnxruntime # via rapidocr-onnxruntime
typing-extensions==4.13.2 typing-extensions==4.14.0
# via # via
# pydantic # pydantic
# pydantic-core # pydantic-core
# sqlalchemy # sqlalchemy
# typing-inspection # typing-inspection
typing-inspection==0.4.0 typing-inspection==0.4.1
# via pydantic # via pydantic
tzdata==2025.2 tzdata==2025.2
# via # via
@ -242,7 +242,7 @@ tzdata==2025.2
# tzlocal # tzlocal
tzlocal==5.3.1 tzlocal==5.3.1
# via -r requirements.in # via -r requirements.in
urllib3==2.4.0 urllib3==2.5.0
# via requests # via requests
werkzeug==3.1.3 werkzeug==3.1.3
# via # via

View file

@ -746,7 +746,8 @@ def get_scheduler_tasks():
@post_require_token @post_require_token
def get_count(): def get_count():
if request.method == "POST": if request.method == "POST":
import pytz from zoneinfo import ZoneInfo
from tzlocal import get_localzone from tzlocal import get_localzone
from mower.data import agent_list from mower.data import agent_list
@ -763,7 +764,7 @@ def get_count():
if task: if task:
utc_time = datetime.strptime(task["time"], "%Y-%m-%dT%H:%M:%S.%f%z") utc_time = datetime.strptime(task["time"], "%Y-%m-%dT%H:%M:%S.%f%z")
task_time = ( task_time = (
utc_time.replace(tzinfo=pytz.utc) utc_time.replace(tzinfo=ZoneInfo("UTC"))
.astimezone(get_localzone()) .astimezone(get_localzone())
.replace(tzinfo=None) .replace(tzinfo=None)
) )