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 zoneinfo import ZoneInfo
import pytz
import tzlocal
@ -17,7 +17,7 @@ def the_same_time(a: datetime | None = None, b: datetime | None = None) -> bool:
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:
@ -28,8 +28,7 @@ def iso_8601_with_tz(dt: datetime, tz: str | None = None) -> str:
"""
if not tz:
tz = tzlocal.get_localzone().key
timezone = pytz.timezone(tz)
dt_aware = timezone.localize(dt)
dt_aware = dt.replace(tzinfo=ZoneInfo(tz))
return dt_aware.isoformat(timespec="seconds")

View file

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

View file

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

View file

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