ipykernel-helper 0.0.2__py3-none-any.whl → 0.0.3__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.
Potentially problematic release.
This version of ipykernel-helper might be problematic. Click here for more details.
- ipykernel_helper/__init__.py +1 -1
- ipykernel_helper/_modidx.py +11 -8
- ipykernel_helper/core.py +21 -23
- {ipykernel_helper-0.0.2.dist-info → ipykernel_helper-0.0.3.dist-info}/METADATA +1 -1
- ipykernel_helper-0.0.3.dist-info/RECORD +9 -0
- ipykernel_helper-0.0.2.dist-info/RECORD +0 -9
- {ipykernel_helper-0.0.2.dist-info → ipykernel_helper-0.0.3.dist-info}/WHEEL +0 -0
- {ipykernel_helper-0.0.2.dist-info → ipykernel_helper-0.0.3.dist-info}/entry_points.txt +0 -0
- {ipykernel_helper-0.0.2.dist-info → ipykernel_helper-0.0.3.dist-info}/licenses/LICENSE +0 -0
- {ipykernel_helper-0.0.2.dist-info → ipykernel_helper-0.0.3.dist-info}/top_level.txt +0 -0
ipykernel_helper/__init__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "0.0.
|
|
1
|
+
__version__ = "0.0.3"
|
|
2
2
|
from .core import *
|
ipykernel_helper/_modidx.py
CHANGED
|
@@ -5,14 +5,17 @@ d = { 'settings': { 'branch': 'main',
|
|
|
5
5
|
'doc_host': 'https://AnswerDotAI.github.io',
|
|
6
6
|
'git_url': 'https://github.com/AnswerDotAI/ipykernel-helper',
|
|
7
7
|
'lib_path': 'ipykernel_helper'},
|
|
8
|
-
'syms': { 'ipykernel_helper.core': { 'ipykernel_helper.core.
|
|
9
|
-
|
|
8
|
+
'syms': { 'ipykernel_helper.core': { 'ipykernel_helper.core.InteractiveShell.get_schemas': ( 'core.html#interactiveshell.get_schemas',
|
|
9
|
+
'ipykernel_helper/core.py'),
|
|
10
|
+
'ipykernel_helper.core.InteractiveShell.get_vars': ( 'core.html#interactiveshell.get_vars',
|
|
11
|
+
'ipykernel_helper/core.py'),
|
|
12
|
+
'ipykernel_helper.core.InteractiveShell.ranked_complete': ( 'core.html#interactiveshell.ranked_complete',
|
|
13
|
+
'ipykernel_helper/core.py'),
|
|
14
|
+
'ipykernel_helper.core.InteractiveShell.sig_help': ( 'core.html#interactiveshell.sig_help',
|
|
15
|
+
'ipykernel_helper/core.py'),
|
|
16
|
+
'ipykernel_helper.core.InteractiveShell.user_items': ( 'core.html#interactiveshell.user_items',
|
|
17
|
+
'ipykernel_helper/core.py'),
|
|
10
18
|
'ipykernel_helper.core._get_schema': ('core.html#_get_schema', 'ipykernel_helper/core.py'),
|
|
11
19
|
'ipykernel_helper.core._rank': ('core.html#_rank', 'ipykernel_helper/core.py'),
|
|
12
20
|
'ipykernel_helper.core._signatures': ('core.html#_signatures', 'ipykernel_helper/core.py'),
|
|
13
|
-
'ipykernel_helper.core.
|
|
14
|
-
'ipykernel_helper.core.get_vars': ('core.html#get_vars', 'ipykernel_helper/core.py'),
|
|
15
|
-
'ipykernel_helper.core.ranked_complete': ('core.html#ranked_complete', 'ipykernel_helper/core.py'),
|
|
16
|
-
'ipykernel_helper.core.safe_repr': ('core.html#safe_repr', 'ipykernel_helper/core.py'),
|
|
17
|
-
'ipykernel_helper.core.sig_help': ('core.html#sig_help', 'ipykernel_helper/core.py'),
|
|
18
|
-
'ipykernel_helper.core.user_items': ('core.html#user_items', 'ipykernel_helper/core.py')}}}
|
|
21
|
+
'ipykernel_helper.core.safe_repr': ('core.html#safe_repr', 'ipykernel_helper/core.py')}}}
|
ipykernel_helper/core.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
|
|
4
4
|
|
|
5
5
|
# %% auto 0
|
|
6
|
-
__all__ = ['safe_repr'
|
|
6
|
+
__all__ = ['safe_repr']
|
|
7
7
|
|
|
8
8
|
# %% ../nbs/00_core.ipynb
|
|
9
9
|
from fastcore.meta import delegates
|
|
@@ -15,9 +15,12 @@ from functools import cmp_to_key,partial
|
|
|
15
15
|
from toolslm.funccall import *
|
|
16
16
|
|
|
17
17
|
from jupyter_client import AsyncKernelClient
|
|
18
|
+
from IPython.core.interactiveshell import InteractiveShell
|
|
18
19
|
from IPython.core.completer import ProvisionalCompleterWarning
|
|
19
20
|
from jedi import Interpreter, Script as jscript
|
|
20
21
|
|
|
22
|
+
from IPython.core.display import DisplayObject
|
|
23
|
+
|
|
21
24
|
# %% ../nbs/00_core.ipynb
|
|
22
25
|
warnings.filterwarnings('ignore', category=ProvisionalCompleterWarning)
|
|
23
26
|
|
|
@@ -30,9 +33,10 @@ def safe_repr(obj, max_len=200):
|
|
|
30
33
|
except Exception as e: return f"<repr error: {str(e)}>"
|
|
31
34
|
|
|
32
35
|
# %% ../nbs/00_core.ipynb
|
|
33
|
-
|
|
36
|
+
@patch
|
|
37
|
+
def user_items(self:InteractiveShell, max_len=200, xtra_skip=()):
|
|
34
38
|
"Get user-defined vars & funcs from namespace."
|
|
35
|
-
|
|
39
|
+
ns = self.user_ns
|
|
36
40
|
ignore = {'In', 'Out', 'exit', 'quit', 'open', 'nbmeta', 'receive_nbmeta'}
|
|
37
41
|
ignore.add(xtra_skip)
|
|
38
42
|
rm_types = (
|
|
@@ -49,16 +53,6 @@ def user_items(ns=None, max_len=200, xtra_skip=()):
|
|
|
49
53
|
if isinstance(v, FunctionType) and v.__module__ == '__main__' and not k.startswith('__')}
|
|
50
54
|
return user_vars,user_fns
|
|
51
55
|
|
|
52
|
-
# %% ../nbs/00_core.ipynb
|
|
53
|
-
@patch
|
|
54
|
-
@delegates(AsyncKernelClient.execute_interactive)
|
|
55
|
-
async def interactive(self:AsyncKernelClient, code:str, **kwargs):
|
|
56
|
-
"Like AsyncKernelClient.execute_interactive, but also returns outputs"
|
|
57
|
-
outputs = []
|
|
58
|
-
def _h(msg: dict): outputs.append(msg)
|
|
59
|
-
res = await self.execute_interactive(code, output_hook=_h, **kwargs)
|
|
60
|
-
return res,outputs
|
|
61
|
-
|
|
62
56
|
# %% ../nbs/00_core.ipynb
|
|
63
57
|
def _rank(c, s):
|
|
64
58
|
"Rank a completion `c` for text `s` with namespace `ns`."
|
|
@@ -72,15 +66,16 @@ def _rank(c, s):
|
|
|
72
66
|
return r if is_public else r+0.1
|
|
73
67
|
|
|
74
68
|
# %% ../nbs/00_core.ipynb
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
@patch
|
|
70
|
+
def ranked_complete(self:InteractiveShell, code, line_no=None, col_no=None):
|
|
71
|
+
ns = self.user_ns
|
|
77
72
|
lines = code.splitlines(True)
|
|
78
73
|
if line_no: offset = sum(len(lines[i]) for i in range(line_no-1)) + col_no -1
|
|
79
74
|
else: offset = len(code)
|
|
80
|
-
cs =
|
|
75
|
+
cs = self.Completer.completions(code, offset)
|
|
81
76
|
def _c(a):
|
|
82
77
|
res = dict2obj({attr: getattr(a, attr) for attr in dir(a) if attr[0]!='_'})
|
|
83
|
-
res['mod']= getattr(
|
|
78
|
+
res['mod']= getattr(ns.get(a.text, None), '__module__', None)
|
|
84
79
|
res['rank'] = _rank(res, s=code)
|
|
85
80
|
return res
|
|
86
81
|
return [_c(c) for c in cs if not c.text.startswith('__')]
|
|
@@ -91,17 +86,19 @@ def _signatures(ns, s, line, col):
|
|
|
91
86
|
if not ctx: ctx = jscript(s).get_signatures(line, col)
|
|
92
87
|
return ctx
|
|
93
88
|
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
@patch
|
|
90
|
+
def sig_help(self:InteractiveShell, code, line_no=None, col_no=None):
|
|
91
|
+
ns = self.user_ns
|
|
96
92
|
ctx = _signatures(ns, code, line=line_no, col=col_no)
|
|
97
93
|
def _s(s): return {'label':s.description,'typ':s.type, 'mod':s.module_name, 'doc':s.docstring(),
|
|
98
94
|
'idx':s.index, 'params':[{'name':p.name} for p in s.params]}
|
|
99
95
|
return [_s(opt) for opt in ctx]
|
|
100
96
|
|
|
101
97
|
# %% ../nbs/00_core.ipynb
|
|
102
|
-
|
|
98
|
+
@patch
|
|
99
|
+
def get_vars(self:InteractiveShell, vs:list):
|
|
103
100
|
"Get variables from namespace."
|
|
104
|
-
ns =
|
|
101
|
+
ns = self.user_ns
|
|
105
102
|
return {v:ns[v] for v in vs if v in ns}
|
|
106
103
|
|
|
107
104
|
# %% ../nbs/00_core.ipynb
|
|
@@ -111,7 +108,8 @@ def _get_schema(ns: dict, t):
|
|
|
111
108
|
try: return get_schema(ns[t])
|
|
112
109
|
except Exception as e: return f"`{t}`: {e}."
|
|
113
110
|
|
|
114
|
-
|
|
111
|
+
@patch
|
|
112
|
+
def get_schemas(self:InteractiveShell, fs:list):
|
|
115
113
|
"Get schemas from namespace."
|
|
116
|
-
ns =
|
|
114
|
+
ns = self.user_ns
|
|
117
115
|
return {f:_get_schema(ns,f) for f in fs}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
ipykernel_helper/__init__.py,sha256=DyjzzgRJvp3QnEDlrwpSgOvDRy9Thxh14LVq-rV7GgI,42
|
|
2
|
+
ipykernel_helper/_modidx.py,sha256=x8v8AZ9zPUIOCC8aofbBJM-Tjl8saEL7Y6xJbWC5pFs,2110
|
|
3
|
+
ipykernel_helper/core.py,sha256=AyIXAXTGzj-JkPFZ2lQ9GB2AFX6w1UjzaUyQKxyk3ps,4217
|
|
4
|
+
ipykernel_helper-0.0.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
|
+
ipykernel_helper-0.0.3.dist-info/METADATA,sha256=4jZ3HFje70l4Bc3wrDrM2Nzpqh8IjjaF01So7wVa-Ts,2557
|
|
6
|
+
ipykernel_helper-0.0.3.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
|
7
|
+
ipykernel_helper-0.0.3.dist-info/entry_points.txt,sha256=HWiK9xz75QtZUaPaYrwpyH5B8MbW0Ea_vi11UmwBImM,54
|
|
8
|
+
ipykernel_helper-0.0.3.dist-info/top_level.txt,sha256=_diD--64d9MauLE0pTxzZ58lkI8DvCrVc1hVAJsyc_Q,17
|
|
9
|
+
ipykernel_helper-0.0.3.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
ipykernel_helper/__init__.py,sha256=oDLMnoGVIAzRy6kwJGpxSDGyOG-aI7DiiERW6jGauWk,42
|
|
2
|
-
ipykernel_helper/_modidx.py,sha256=juRUbLKiU68mB88Ehn5cMLD2REiCSWOQd9BTdeDQz4Y,1727
|
|
3
|
-
ipykernel_helper/core.py,sha256=UpePoI_QbKQM2BjJ3sQ-_54tdFaHHDfLHmSPmu4i7V4,4494
|
|
4
|
-
ipykernel_helper-0.0.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
|
-
ipykernel_helper-0.0.2.dist-info/METADATA,sha256=xuDKpEG0317k8OoE-_16n2gkthww1fotP4mPVVmZnLI,2557
|
|
6
|
-
ipykernel_helper-0.0.2.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
|
7
|
-
ipykernel_helper-0.0.2.dist-info/entry_points.txt,sha256=HWiK9xz75QtZUaPaYrwpyH5B8MbW0Ea_vi11UmwBImM,54
|
|
8
|
-
ipykernel_helper-0.0.2.dist-info/top_level.txt,sha256=_diD--64d9MauLE0pTxzZ58lkI8DvCrVc1hVAJsyc_Q,17
|
|
9
|
-
ipykernel_helper-0.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|