txl_kernel 0.1.17__tar.gz → 0.1.20__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.
- {txl_kernel-0.1.17 → txl_kernel-0.1.20}/PKG-INFO +1 -1
- txl_kernel-0.1.20/txl_kernel/__init__.py +1 -0
- {txl_kernel-0.1.17 → txl_kernel-0.1.20}/txl_kernel/driver.py +6 -18
- {txl_kernel-0.1.17 → txl_kernel-0.1.20}/txl_kernel/message.py +2 -4
- txl_kernel-0.1.17/txl_kernel/__init__.py +0 -1
- {txl_kernel-0.1.17 → txl_kernel-0.1.20}/.gitignore +0 -0
- {txl_kernel-0.1.17 → txl_kernel-0.1.20}/LICENSE.txt +0 -0
- {txl_kernel-0.1.17 → txl_kernel-0.1.20}/README.md +0 -0
- {txl_kernel-0.1.17 → txl_kernel-0.1.20}/pyproject.toml +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.20"
|
|
@@ -28,9 +28,7 @@ class Comm:
|
|
|
28
28
|
buffers=buffers,
|
|
29
29
|
)
|
|
30
30
|
self.msg_cnt += 1
|
|
31
|
-
asyncio.create_task(
|
|
32
|
-
self.send_message(msg, self.shell_channel, change_date_to_str=True)
|
|
33
|
-
)
|
|
31
|
+
asyncio.create_task(self.send_message(msg, self.shell_channel, change_date_to_str=True))
|
|
34
32
|
|
|
35
33
|
|
|
36
34
|
class KernelMixin:
|
|
@@ -61,18 +59,14 @@ class KernelMixin:
|
|
|
61
59
|
"shell": [asyncio.Future()],
|
|
62
60
|
}
|
|
63
61
|
try:
|
|
64
|
-
msg = await asyncio.wait_for(
|
|
65
|
-
self.execute_requests[msg_id]["shell"][0], new_timeout
|
|
66
|
-
)
|
|
62
|
+
msg = await asyncio.wait_for(self.execute_requests[msg_id]["shell"][0], new_timeout)
|
|
67
63
|
except asyncio.TimeoutError:
|
|
68
64
|
del self.execute_requests[msg_id]
|
|
69
65
|
error_message = f"Kernel didn't respond in {timeout} seconds"
|
|
70
66
|
raise RuntimeError(error_message)
|
|
71
67
|
if msg["header"]["msg_type"] == "kernel_info_reply":
|
|
72
68
|
try:
|
|
73
|
-
msg = await asyncio.wait_for(
|
|
74
|
-
self.execute_requests[msg_id]["iopub"][0], 0.2
|
|
75
|
-
)
|
|
69
|
+
msg = await asyncio.wait_for(self.execute_requests[msg_id]["iopub"][0], 0.2)
|
|
76
70
|
except asyncio.TimeoutError:
|
|
77
71
|
pass
|
|
78
72
|
else:
|
|
@@ -88,9 +82,7 @@ class KernelMixin:
|
|
|
88
82
|
if msg_type == "comm_open":
|
|
89
83
|
for comm_handler in self.comm_handlers:
|
|
90
84
|
comm_id = msg["content"]["comm_id"]
|
|
91
|
-
comm = Comm(
|
|
92
|
-
comm_id, self.shell_channel, self.session_id, self.send_message
|
|
93
|
-
)
|
|
85
|
+
comm = Comm(comm_id, self.shell_channel, self.session_id, self.send_message)
|
|
94
86
|
comm_handler.comm_open(msg, comm)
|
|
95
87
|
elif msg_type == "comm_msg":
|
|
96
88
|
for comm_handler in self.comm_handlers:
|
|
@@ -150,9 +142,7 @@ class KernelMixin:
|
|
|
150
142
|
del self.execute_requests[msg_id]
|
|
151
143
|
error_message = f"Kernel didn't respond in {timeout} seconds"
|
|
152
144
|
raise RuntimeError(error_message)
|
|
153
|
-
await self._handle_outputs(
|
|
154
|
-
ydoc, ycell, self.execute_requests[msg_id]["iopub"]
|
|
155
|
-
)
|
|
145
|
+
await self._handle_outputs(ydoc, ycell, self.execute_requests[msg_id]["iopub"])
|
|
156
146
|
try:
|
|
157
147
|
await asyncio.wait_for(
|
|
158
148
|
self.execute_requests[msg_id]["shell"][0],
|
|
@@ -186,9 +176,7 @@ class KernelMixin:
|
|
|
186
176
|
outputs = list(ycell["outputs"])
|
|
187
177
|
if msg_type == "stream":
|
|
188
178
|
if (not outputs) or (outputs[-1]["name"] != content["name"]):
|
|
189
|
-
outputs.append(
|
|
190
|
-
{"name": content["name"], "output_type": msg_type, "text": []}
|
|
191
|
-
)
|
|
179
|
+
outputs.append({"name": content["name"], "output_type": msg_type, "text": []})
|
|
192
180
|
outputs[-1]["text"].append(content["text"])
|
|
193
181
|
elif msg_type in ("display_data", "execute_result"):
|
|
194
182
|
outputs.append(
|
|
@@ -12,7 +12,7 @@ def utcnow() -> datetime:
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def date_to_str(obj: Dict[str, Any]):
|
|
15
|
-
if "date" in obj and
|
|
15
|
+
if "date" in obj and not isinstance(obj["date"], str):
|
|
16
16
|
obj["date"] = obj["date"].isoformat().replace("+00:00", "Z")
|
|
17
17
|
return obj
|
|
18
18
|
|
|
@@ -23,9 +23,7 @@ def str_to_date(obj: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
23
23
|
return obj
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
def create_message_header(
|
|
27
|
-
msg_type: str, session_id: str, msg_id: str
|
|
28
|
-
) -> Dict[str, Any]:
|
|
26
|
+
def create_message_header(msg_type: str, session_id: str, msg_id: str) -> Dict[str, Any]:
|
|
29
27
|
if not session_id:
|
|
30
28
|
session_id = msg_id = uuid4().hex
|
|
31
29
|
else:
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.17"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|