dialoghelper 0.0.14__py3-none-any.whl → 0.0.15__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.
- dialoghelper/__init__.py +1 -1
- dialoghelper/core.py +15 -7
- {dialoghelper-0.0.14.dist-info → dialoghelper-0.0.15.dist-info}/METADATA +1 -1
- dialoghelper-0.0.15.dist-info/RECORD +10 -0
- dialoghelper-0.0.14.dist-info/RECORD +0 -10
- {dialoghelper-0.0.14.dist-info → dialoghelper-0.0.15.dist-info}/WHEEL +0 -0
- {dialoghelper-0.0.14.dist-info → dialoghelper-0.0.15.dist-info}/entry_points.txt +0 -0
- {dialoghelper-0.0.14.dist-info → dialoghelper-0.0.15.dist-info}/licenses/LICENSE +0 -0
- {dialoghelper-0.0.14.dist-info → dialoghelper-0.0.15.dist-info}/top_level.txt +0 -0
dialoghelper/__init__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "0.0.
|
|
1
|
+
__version__ = "0.0.15"
|
|
2
2
|
from .core import *
|
dialoghelper/core.py
CHANGED
|
@@ -107,6 +107,8 @@ def del_msg(
|
|
|
107
107
|
|
|
108
108
|
# %% ../nbs/00_core.ipynb
|
|
109
109
|
def _msg(
|
|
110
|
+
msg_type: str='note', # Message type, can be 'code', 'note', or 'prompt'
|
|
111
|
+
output:str='', # For prompts/code, initial output
|
|
110
112
|
time_run: str | None = '', # When was message executed
|
|
111
113
|
is_exported: int | None = 0, # Export message to a module?
|
|
112
114
|
skipped: int | None = 0, # Hide message from prompt?
|
|
@@ -122,17 +124,23 @@ Placements = str_enum('Placements', 'add_after', 'add_before', 'update', 'at_sta
|
|
|
122
124
|
@delegates(_msg)
|
|
123
125
|
def add_msg(
|
|
124
126
|
content:str, # Content of the message (i.e the message prompt, code, or note text)
|
|
125
|
-
msg_type: str='note', # Message type, can be 'code', 'note', or 'prompt'
|
|
126
|
-
output:str='', # For prompts/code, initial output
|
|
127
127
|
placement:str='add_after', # Can be 'add_after', 'add_before', 'update', 'at_start', 'at_end'
|
|
128
128
|
sid:str=None, # sid (stable id -- pk) of message that placement is relative to (if None, uses current message)
|
|
129
129
|
**kwargs
|
|
130
130
|
):
|
|
131
|
-
"Add/update a message to the queue to show after code execution completes.
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
"""Add/update a message to the queue to show after code execution completes.
|
|
132
|
+
Be sure to pass a `sid` (stable id) not a `mid` (which is used only for sorting, and can change).
|
|
133
|
+
Sets msg_type to 'note' by default if not update placement."""
|
|
134
|
+
if 'msg_type' not in kwargs and placement!='update': kwargs['msg_type']='note'
|
|
135
|
+
mt = kwargs.get('msg_type',None)
|
|
136
|
+
ot = kwargs.get('output',None)
|
|
137
|
+
if mt and mt not in ('note', 'code', 'prompt'): return "msg_type must be 'code', 'note', or 'prompt'."
|
|
138
|
+
if mt=='note' and ot: return "note messages cannot have an output."
|
|
139
|
+
if mt=='code':
|
|
140
|
+
try: json.loads(ot or '[]')
|
|
141
|
+
except: return "Code output must be valid json"
|
|
134
142
|
if not sid: sid = find_msg_id()
|
|
135
|
-
data = dict(content=content,
|
|
143
|
+
data = dict(content=content, placement=placement, sid=sid, **kwargs)
|
|
136
144
|
return xpost('http://localhost:5001/add_relative_', data=data).text
|
|
137
145
|
|
|
138
146
|
# %% ../nbs/00_core.ipynb
|
|
@@ -174,7 +182,7 @@ def update_msg(
|
|
|
174
182
|
sid = kw.pop('sid', sid)
|
|
175
183
|
if not sid: raise TypeError("update_msg needs either a dict message or `sid=...`")
|
|
176
184
|
kw.pop('did', None)
|
|
177
|
-
add_msg(content, placement='update', sid=sid, **kw)
|
|
185
|
+
return add_msg(content, placement='update', sid=sid, **kw)
|
|
178
186
|
|
|
179
187
|
# %% ../nbs/00_core.ipynb
|
|
180
188
|
def load_gist(gist_id:str):
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
dialoghelper/__init__.py,sha256=dXuF6Y3XUXblN4PkEpkmXrD8vDPhYo7XLaXILawxjwQ,43
|
|
2
|
+
dialoghelper/_modidx.py,sha256=BmhVoIv53snN6JQm_EzJp-bu793QuY7EZg2hKaq5_7E,3013
|
|
3
|
+
dialoghelper/core.py,sha256=8DlmNRQT4PeMWychhQETXAJKgJ72Z8CjEW09Zh_VgJk,12562
|
|
4
|
+
dialoghelper/db_dc.py,sha256=ieSie_K1HHXACEJVZ0rMkD_uo42GgmMqqKDYrodjhtM,2297
|
|
5
|
+
dialoghelper-0.0.15.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
6
|
+
dialoghelper-0.0.15.dist-info/METADATA,sha256=G4p7L6QivWW736VWNazRXXmNW3nvVSast69RUKesQrM,2558
|
|
7
|
+
dialoghelper-0.0.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
+
dialoghelper-0.0.15.dist-info/entry_points.txt,sha256=wvDeX-XTS_XVjWiiPQe6yVfmyNwy9eCr36ewp9baFIg,46
|
|
9
|
+
dialoghelper-0.0.15.dist-info/top_level.txt,sha256=VXLlkgltFs_q-XB9imt2G64I_-MPm1RnxlpvUWPuLKM,13
|
|
10
|
+
dialoghelper-0.0.15.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
dialoghelper/__init__.py,sha256=z-0Rh9e-quhc6YCgBCQPxO9WBChy0UBbaCcAmIPEqfE,43
|
|
2
|
-
dialoghelper/_modidx.py,sha256=BmhVoIv53snN6JQm_EzJp-bu793QuY7EZg2hKaq5_7E,3013
|
|
3
|
-
dialoghelper/core.py,sha256=suW06DOaGDxVH5cgxbue1Yj9HOJjj1m_fA0zSSR-Ecg,12260
|
|
4
|
-
dialoghelper/db_dc.py,sha256=ieSie_K1HHXACEJVZ0rMkD_uo42GgmMqqKDYrodjhtM,2297
|
|
5
|
-
dialoghelper-0.0.14.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
6
|
-
dialoghelper-0.0.14.dist-info/METADATA,sha256=EMdtA7E4bTfJiNRxabpas8Z1RX0GkyGhJw5fMyaT9tA,2558
|
|
7
|
-
dialoghelper-0.0.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
-
dialoghelper-0.0.14.dist-info/entry_points.txt,sha256=wvDeX-XTS_XVjWiiPQe6yVfmyNwy9eCr36ewp9baFIg,46
|
|
9
|
-
dialoghelper-0.0.14.dist-info/top_level.txt,sha256=VXLlkgltFs_q-XB9imt2G64I_-MPm1RnxlpvUWPuLKM,13
|
|
10
|
-
dialoghelper-0.0.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|