nonebot-plugin-cnrail 0.2.1__tar.gz → 0.2.2.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nonebot_plugin_cnrail-0.2.1 → nonebot_plugin_cnrail-0.2.2.dev1}/PKG-INFO +1 -1
- {nonebot_plugin_cnrail-0.2.1 → nonebot_plugin_cnrail-0.2.2.dev1}/nonebot_plugin_cnrail/__init__.py +1 -1
- {nonebot_plugin_cnrail-0.2.1 → nonebot_plugin_cnrail-0.2.2.dev1}/nonebot_plugin_cnrail/models.py +18 -21
- {nonebot_plugin_cnrail-0.2.1 → nonebot_plugin_cnrail-0.2.2.dev1}/pyproject.toml +1 -1
- {nonebot_plugin_cnrail-0.2.1 → nonebot_plugin_cnrail-0.2.2.dev1}/LICENSE +0 -0
- {nonebot_plugin_cnrail-0.2.1 → nonebot_plugin_cnrail-0.2.2.dev1}/README.md +0 -0
- {nonebot_plugin_cnrail-0.2.1 → nonebot_plugin_cnrail-0.2.2.dev1}/nonebot_plugin_cnrail/__main__.py +0 -0
- {nonebot_plugin_cnrail-0.2.1 → nonebot_plugin_cnrail-0.2.2.dev1}/nonebot_plugin_cnrail/config.py +0 -0
- {nonebot_plugin_cnrail-0.2.1 → nonebot_plugin_cnrail-0.2.2.dev1}/nonebot_plugin_cnrail/data_source.py +0 -0
- {nonebot_plugin_cnrail-0.2.1 → nonebot_plugin_cnrail-0.2.2.dev1}/nonebot_plugin_cnrail/templates/train_table.html.jinja +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nonebot-plugin-cnrail
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2.dev1
|
|
4
4
|
Summary: NoneBot2 plugin for query the train time table
|
|
5
5
|
Home-page: https://github.com/lgc-NB2Dev/nonebot-plugin-cnrail
|
|
6
6
|
Author-Email: student_2333 <lgc2333@126.com>, XieXiLin <support@xiexilin.com>
|
{nonebot_plugin_cnrail-0.2.1 → nonebot_plugin_cnrail-0.2.2.dev1}/nonebot_plugin_cnrail/__init__.py
RENAMED
|
@@ -6,7 +6,7 @@ require("nonebot_plugin_htmlrender")
|
|
|
6
6
|
from . import __main__ as __main__ # noqa: E402
|
|
7
7
|
from .config import ConfigModel # noqa: E402
|
|
8
8
|
|
|
9
|
-
__version__ = "0.2.
|
|
9
|
+
__version__ = "0.2.2.dev1"
|
|
10
10
|
__plugin_meta__ = PluginMetadata(
|
|
11
11
|
name="CNRail",
|
|
12
12
|
description="查询 12306 列车时刻表",
|
{nonebot_plugin_cnrail-0.2.1 → nonebot_plugin_cnrail-0.2.2.dev1}/nonebot_plugin_cnrail/models.py
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from datetime import datetime, timedelta
|
|
2
2
|
from typing import List, Optional, Union
|
|
3
|
-
|
|
3
|
+
from nonebot.log import logger
|
|
4
4
|
import pytz
|
|
5
5
|
from pydantic import BaseModel, Field
|
|
6
6
|
|
|
@@ -90,26 +90,23 @@ class TrainDetailData(BaseModel):
|
|
|
90
90
|
routing: TrainDetailRouing
|
|
91
91
|
|
|
92
92
|
def arrived(self, station_index: int, train_date: str) -> bool: # 有待修改
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
# )
|
|
111
|
-
# return datetime.now(TZ_SHANGHAI) >= arrive_datetime
|
|
112
|
-
return False
|
|
93
|
+
logger.debug(f"index: {station_index}, date: {train_date}")
|
|
94
|
+
station = self.via_stations[station_index]
|
|
95
|
+
arrive_time_str = (
|
|
96
|
+
station.arrival_time
|
|
97
|
+
if station.arrival_time is not None
|
|
98
|
+
else station.departure_time
|
|
99
|
+
)
|
|
100
|
+
arrive_datetime = (
|
|
101
|
+
datetime.fromisoformat(
|
|
102
|
+
f"{train_date}T{arrive_time_str}",
|
|
103
|
+
)
|
|
104
|
+
+ timedelta(days=station.day_index)
|
|
105
|
+
).replace(tzinfo=TZ_SHANGHAI)
|
|
106
|
+
logger.debug(
|
|
107
|
+
f"arrive: {arrive_time_str}, arrive_datetime: {arrive_datetime}, now: {datetime.now(TZ_SHANGHAI)}, bool: {datetime.now(TZ_SHANGHAI) >= arrive_datetime}",
|
|
108
|
+
)
|
|
109
|
+
return datetime.now(TZ_SHANGHAI) >= arrive_datetime
|
|
113
110
|
|
|
114
111
|
|
|
115
112
|
class TrainSNData(BaseModel):
|
|
File without changes
|
|
File without changes
|
{nonebot_plugin_cnrail-0.2.1 → nonebot_plugin_cnrail-0.2.2.dev1}/nonebot_plugin_cnrail/__main__.py
RENAMED
|
File without changes
|
{nonebot_plugin_cnrail-0.2.1 → nonebot_plugin_cnrail-0.2.2.dev1}/nonebot_plugin_cnrail/config.py
RENAMED
|
File without changes
|
|
File without changes
|