pymud 0.19.2__py3-none-any.whl → 0.19.2.post2__py3-none-any.whl
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.
- pymud/objects.py +6 -4
- pymud/pymud.py +4 -0
- pymud/session.py +11 -7
- {pymud-0.19.2.dist-info → pymud-0.19.2.post2.dist-info}/METADATA +10 -1
- pymud-0.19.2.post2.dist-info/RECORD +16 -0
- pymud/statemachine.py +0 -1525
- pymud-0.19.2.dist-info/RECORD +0 -17
- {pymud-0.19.2.dist-info → pymud-0.19.2.post2.dist-info}/LICENSE.txt +0 -0
- {pymud-0.19.2.dist-info → pymud-0.19.2.post2.dist-info}/WHEEL +0 -0
- {pymud-0.19.2.dist-info → pymud-0.19.2.post2.dist-info}/entry_points.txt +0 -0
- {pymud-0.19.2.dist-info → pymud-0.19.2.post2.dist-info}/top_level.txt +0 -0
pymud/objects.py
CHANGED
@@ -586,17 +586,19 @@ class Command(MatchObject):
|
|
586
586
|
__abbr__ = "cmd"
|
587
587
|
def __init__(self, session, patterns, *args, **kwargs):
|
588
588
|
super().__init__(session, patterns, sync = False, *args, **kwargs)
|
589
|
-
self._tasks =
|
589
|
+
self._tasks = set()
|
590
590
|
|
591
591
|
def create_task(self, coro, *args, name = None):
|
592
592
|
task = self.session.create_task(coro, *args, name)
|
593
|
-
self._tasks.
|
593
|
+
task.add_done_callback(self._tasks.discard)
|
594
|
+
self._tasks.add(task)
|
594
595
|
return task
|
595
596
|
|
596
597
|
def remove_task(self, task: asyncio.Task, msg = None):
|
597
598
|
result = self.session.remove_task(task, msg)
|
598
|
-
|
599
|
-
|
599
|
+
self._tasks.discard(task)
|
600
|
+
# if task in self._tasks:
|
601
|
+
# self._tasks.remove(task)
|
600
602
|
return result
|
601
603
|
|
602
604
|
def reset(self):
|
pymud/pymud.py
CHANGED
pymud/session.py
CHANGED
@@ -166,7 +166,8 @@ class Session:
|
|
166
166
|
|
167
167
|
self._variables = DotDict()
|
168
168
|
|
169
|
-
self._tasks = []
|
169
|
+
#self._tasks = []
|
170
|
+
self._tasks = set()
|
170
171
|
|
171
172
|
self._command_history = []
|
172
173
|
|
@@ -450,23 +451,26 @@ class Session:
|
|
450
451
|
else:
|
451
452
|
task = self.loop.create_task(coro, name = name)
|
452
453
|
#task = asyncio.create_task(coro, name = name)
|
453
|
-
self._tasks.
|
454
|
+
task.add_done_callback(self._tasks.discard)
|
455
|
+
self._tasks.add(task)
|
456
|
+
#self._tasks.append(task)
|
454
457
|
return task
|
455
458
|
|
456
459
|
def remove_task(self, task: asyncio.Task, msg = None):
|
457
460
|
result = task.cancel()
|
458
|
-
|
459
|
-
|
461
|
+
self._tasks.discard(task)
|
462
|
+
# if task in self._tasks:
|
463
|
+
# self._tasks.remove(task)
|
460
464
|
return result
|
461
465
|
|
462
466
|
def clean_finished_tasks(self):
|
463
467
|
"清理已经完成的任务"
|
468
|
+
self._tasks = set([t for t in self._tasks if not t.done()])
|
469
|
+
|
464
470
|
# for task in self._tasks:
|
465
471
|
# if isinstance(task, asyncio.Task) and task.done():
|
466
472
|
# self._tasks.remove(task)
|
467
473
|
|
468
|
-
self._tasks = list((t for t in self._tasks if isinstance(t, asyncio.Task) and not t.done()))
|
469
|
-
|
470
474
|
def write(self, data) -> None:
|
471
475
|
"向服务器写入数据(RAW格式字节数组/字节串)"
|
472
476
|
if self._transport and not self._transport.is_closing():
|
@@ -640,7 +644,7 @@ class Session:
|
|
640
644
|
if notAlias:
|
641
645
|
self.writeline(cmdtext)
|
642
646
|
|
643
|
-
self.clean_finished_tasks()
|
647
|
+
# self.clean_finished_tasks()
|
644
648
|
|
645
649
|
async def exec_text_async(self, cmdtext: str):
|
646
650
|
isNotCmd = True
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pymud
|
3
|
-
Version: 0.19.2
|
3
|
+
Version: 0.19.2.post2
|
4
4
|
Summary: a MUD Client written in Python
|
5
5
|
Author-email: "newstart@pkuxkx" <crapex@crapex.cc>
|
6
6
|
Maintainer-email: "newstart@pkuxkx" <crapex@crapex.cc>
|
@@ -943,3 +943,12 @@ Requires-Dist: prompt-toolkit
|
|
943
943
|
+ 功能调整: 变通解决了菜单栏右边单击 帮助 菜单会响应问题
|
944
944
|
+ 错误修复: 修复了会话关闭时插件卸载的代码错误
|
945
945
|
+ 功能调整: 在会话关闭、程序退出时增加等待,确保收到服务器断开命令之后才关闭和退出
|
946
|
+
|
947
|
+
### 0.19.2post1 (2024-03-23)
|
948
|
+
+ 问题修复: 在退出程序时增加了插件卸载调用
|
949
|
+
+ 实现调整: 在清除task的列表推导过程中去掉了类型判断以减少任务时间占用
|
950
|
+
+ 其他调整: 从包中删除了拷贝过来作为参考的文件
|
951
|
+
+ 帮助完善: 帮助文档逻辑完善
|
952
|
+
|
953
|
+
### 0.19.2post2 (2024-03-24)
|
954
|
+
+ 实现调整: 改用官方示例的task清除方式,每个任务结束后清除
|
@@ -0,0 +1,16 @@
|
|
1
|
+
pymud/__init__.py,sha256=omHjGEuVQmEqHUG_OrE_hHkNO5bh-mStuhUmUQGa1HE,451
|
2
|
+
pymud/__main__.py,sha256=DXmwoh4Y2dzZfOw7sHQSXoPDKgYgORF0rASOCcbSvt4,4588
|
3
|
+
pymud/dialogs.py,sha256=SRNHOashupNi7128Bg_35J1rrI2TsZEakTbaMW5d9PU,5596
|
4
|
+
pymud/extras.py,sha256=_KhH1beYc3RdlTvN_Yf33KN_MGvD0MCuLYCvwpdvLE0,42062
|
5
|
+
pymud/objects.py,sha256=gaJrzPq8eAvWLBYoe56JqPndj06HHnmqZbfILr__tO0,29117
|
6
|
+
pymud/pkuxkx.py,sha256=vWXHU6GF0HQ0eWb3LmxFVRP0cKnigffCX7Z-LJvwVtw,11496
|
7
|
+
pymud/protocol.py,sha256=F96Yq-1YO_5GN6QnJ4vMdNjCAzejVmDdsfrJguCjCeE,49120
|
8
|
+
pymud/pymud.py,sha256=VYfz10eYgdnObOqbJPUpVj2tl6S2_7kcMnjCzPAmFds,39526
|
9
|
+
pymud/session.py,sha256=3BuXdqFVbjR3FFN4nd3esXbmcrNGDqh590Kdocni2A8,89528
|
10
|
+
pymud/settings.py,sha256=yPrXme-EzJru3A_MXs_NsGml6F5Yzl4Y0jnipq3Fo78,7092
|
11
|
+
pymud-0.19.2.post2.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
12
|
+
pymud-0.19.2.post2.dist-info/METADATA,sha256=eMYMbSRub2Ml5ddqFVyzLs1HFepU6kTHDuGb20cUvQ0,66591
|
13
|
+
pymud-0.19.2.post2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
14
|
+
pymud-0.19.2.post2.dist-info/entry_points.txt,sha256=diPUOtTkhgC1hVny7Cdg4aRhaHSynMQoraE7ZhJxUcw,37
|
15
|
+
pymud-0.19.2.post2.dist-info/top_level.txt,sha256=8Gp1eXjxixXjqhhti6tLCspV_8s9sNV3z5Em2_KRhD4,6
|
16
|
+
pymud-0.19.2.post2.dist-info/RECORD,,
|