pymud 0.19.2.post1__py3-none-any.whl → 0.19.2.post3__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/__main__.py +3 -0
- pymud/objects.py +6 -4
- pymud/session.py +10 -6
- {pymud-0.19.2.post1.dist-info → pymud-0.19.2.post3.dist-info}/METADATA +4 -1
- {pymud-0.19.2.post1.dist-info → pymud-0.19.2.post3.dist-info}/RECORD +9 -9
- {pymud-0.19.2.post1.dist-info → pymud-0.19.2.post3.dist-info}/LICENSE.txt +0 -0
- {pymud-0.19.2.post1.dist-info → pymud-0.19.2.post3.dist-info}/WHEEL +0 -0
- {pymud-0.19.2.post1.dist-info → pymud-0.19.2.post3.dist-info}/entry_points.txt +0 -0
- {pymud-0.19.2.post1.dist-info → pymud-0.19.2.post3.dist-info}/top_level.txt +0 -0
pymud/__main__.py
CHANGED
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/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,18 +451,21 @@ 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
|
"清理已经完成的任务"
|
464
|
-
self._tasks = [t for t in self._tasks if not t.done()]
|
468
|
+
self._tasks = set([t for t in self._tasks if not t.done()])
|
465
469
|
|
466
470
|
# for task in self._tasks:
|
467
471
|
# if isinstance(task, asyncio.Task) and task.done():
|
@@ -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.post3
|
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>
|
@@ -949,3 +949,6 @@ Requires-Dist: prompt-toolkit
|
|
949
949
|
+ 实现调整: 在清除task的列表推导过程中去掉了类型判断以减少任务时间占用
|
950
950
|
+ 其他调整: 从包中删除了拷贝过来作为参考的文件
|
951
951
|
+ 帮助完善: 帮助文档逻辑完善
|
952
|
+
|
953
|
+
### 0.19.2post2 (2024-03-24)
|
954
|
+
+ 实现调整: 改用官方示例的task清除方式,每个任务结束后清除
|
@@ -1,16 +1,16 @@
|
|
1
1
|
pymud/__init__.py,sha256=omHjGEuVQmEqHUG_OrE_hHkNO5bh-mStuhUmUQGa1HE,451
|
2
|
-
pymud/__main__.py,sha256=
|
2
|
+
pymud/__main__.py,sha256=I6jFLnTErSuM0G828WUx5EIAmMNAzqYr2AT1zdtGmp0,4636
|
3
3
|
pymud/dialogs.py,sha256=SRNHOashupNi7128Bg_35J1rrI2TsZEakTbaMW5d9PU,5596
|
4
4
|
pymud/extras.py,sha256=_KhH1beYc3RdlTvN_Yf33KN_MGvD0MCuLYCvwpdvLE0,42062
|
5
|
-
pymud/objects.py,sha256=
|
5
|
+
pymud/objects.py,sha256=gaJrzPq8eAvWLBYoe56JqPndj06HHnmqZbfILr__tO0,29117
|
6
6
|
pymud/pkuxkx.py,sha256=vWXHU6GF0HQ0eWb3LmxFVRP0cKnigffCX7Z-LJvwVtw,11496
|
7
7
|
pymud/protocol.py,sha256=F96Yq-1YO_5GN6QnJ4vMdNjCAzejVmDdsfrJguCjCeE,49120
|
8
8
|
pymud/pymud.py,sha256=VYfz10eYgdnObOqbJPUpVj2tl6S2_7kcMnjCzPAmFds,39526
|
9
|
-
pymud/session.py,sha256=
|
9
|
+
pymud/session.py,sha256=3BuXdqFVbjR3FFN4nd3esXbmcrNGDqh590Kdocni2A8,89528
|
10
10
|
pymud/settings.py,sha256=yPrXme-EzJru3A_MXs_NsGml6F5Yzl4Y0jnipq3Fo78,7092
|
11
|
-
pymud-0.19.2.
|
12
|
-
pymud-0.19.2.
|
13
|
-
pymud-0.19.2.
|
14
|
-
pymud-0.19.2.
|
15
|
-
pymud-0.19.2.
|
16
|
-
pymud-0.19.2.
|
11
|
+
pymud-0.19.2.post3.dist-info/LICENSE.txt,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
|
12
|
+
pymud-0.19.2.post3.dist-info/METADATA,sha256=7ZqNUx5hwUXlHQCz5gxXrDgm60-LrL23L8f5TIDz0zQ,66591
|
13
|
+
pymud-0.19.2.post3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
14
|
+
pymud-0.19.2.post3.dist-info/entry_points.txt,sha256=diPUOtTkhgC1hVny7Cdg4aRhaHSynMQoraE7ZhJxUcw,37
|
15
|
+
pymud-0.19.2.post3.dist-info/top_level.txt,sha256=8Gp1eXjxixXjqhhti6tLCspV_8s9sNV3z5Em2_KRhD4,6
|
16
|
+
pymud-0.19.2.post3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|