ipykernel-helper 0.0.3__py3-none-any.whl → 0.0.4__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.

@@ -1,2 +1,2 @@
1
- __version__ = "0.0.3"
1
+ __version__ = "0.0.4"
2
2
  from .core import *
@@ -9,13 +9,19 @@ d = { 'settings': { 'branch': 'main',
9
9
  'ipykernel_helper/core.py'),
10
10
  'ipykernel_helper.core.InteractiveShell.get_vars': ( 'core.html#interactiveshell.get_vars',
11
11
  'ipykernel_helper/core.py'),
12
+ 'ipykernel_helper.core.InteractiveShell.publish': ( 'core.html#interactiveshell.publish',
13
+ 'ipykernel_helper/core.py'),
12
14
  'ipykernel_helper.core.InteractiveShell.ranked_complete': ( 'core.html#interactiveshell.ranked_complete',
13
15
  'ipykernel_helper/core.py'),
14
16
  'ipykernel_helper.core.InteractiveShell.sig_help': ( 'core.html#interactiveshell.sig_help',
15
17
  'ipykernel_helper/core.py'),
16
18
  'ipykernel_helper.core.InteractiveShell.user_items': ( 'core.html#interactiveshell.user_items',
17
19
  'ipykernel_helper/core.py'),
20
+ 'ipykernel_helper.core.InteractiveShell.xpush': ( 'core.html#interactiveshell.xpush',
21
+ 'ipykernel_helper/core.py'),
18
22
  'ipykernel_helper.core._get_schema': ('core.html#_get_schema', 'ipykernel_helper/core.py'),
19
23
  'ipykernel_helper.core._rank': ('core.html#_rank', 'ipykernel_helper/core.py'),
20
24
  'ipykernel_helper.core._signatures': ('core.html#_signatures', 'ipykernel_helper/core.py'),
25
+ 'ipykernel_helper.core.load_ipython_extension': ( 'core.html#load_ipython_extension',
26
+ 'ipykernel_helper/core.py'),
21
27
  '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', 'load_ipython_extension']
7
7
 
8
8
  # %% ../nbs/00_core.ipynb
9
9
  from fastcore.meta import delegates
@@ -12,6 +12,7 @@ import typing,warnings
12
12
  from types import ModuleType, FunctionType, MethodType, BuiltinFunctionType
13
13
  from inspect import signature, currentframe
14
14
  from functools import cmp_to_key,partial
15
+ from collections.abc import Mapping
15
16
  from toolslm.funccall import *
16
17
 
17
18
  from jupyter_client import AsyncKernelClient
@@ -20,6 +21,7 @@ from IPython.core.completer import ProvisionalCompleterWarning
20
21
  from jedi import Interpreter, Script as jscript
21
22
 
22
23
  from IPython.core.display import DisplayObject
24
+ from IPython.display import display,Markdown,HTML
23
25
 
24
26
  # %% ../nbs/00_core.ipynb
25
27
  warnings.filterwarnings('ignore', category=ProvisionalCompleterWarning)
@@ -36,8 +38,8 @@ def safe_repr(obj, max_len=200):
36
38
  @patch
37
39
  def user_items(self:InteractiveShell, max_len=200, xtra_skip=()):
38
40
  "Get user-defined vars & funcs from namespace."
39
- ns = self.user_ns
40
- ignore = {'In', 'Out', 'exit', 'quit', 'open', 'nbmeta', 'receive_nbmeta'}
41
+ ns,nsh = self.user_ns,self.user_ns_hidden
42
+ ignore = {'nbmeta', 'receive_nbmeta'}
41
43
  ignore.add(xtra_skip)
42
44
  rm_types = (
43
45
  type, FunctionType, ModuleType, MethodType, BuiltinFunctionType,
@@ -46,7 +48,7 @@ def user_items(self:InteractiveShell, max_len=200, xtra_skip=()):
46
48
  getattr(typing, '_SpecialForm', ())
47
49
  )
48
50
  user_items = {k:v for k, v in ns.items()
49
- if not k in ignore}
51
+ if not k in ignore and k not in nsh}
50
52
  user_vars = {k:safe_repr(v, max_len=max_len)
51
53
  for k, v in user_items.items() if not k.startswith('_') and not isinstance(v, rm_types)}
52
54
  user_fns = {k:str(signature(v)) for k, v in user_items.items()
@@ -78,7 +80,8 @@ def ranked_complete(self:InteractiveShell, code, line_no=None, col_no=None):
78
80
  res['mod']= getattr(ns.get(a.text, None), '__module__', None)
79
81
  res['rank'] = _rank(res, s=code)
80
82
  return res
81
- return [_c(c) for c in cs if not c.text.startswith('__')]
83
+ # Remove dunder vars, unless the user seems to be looking for them explicitly
84
+ return [_c(c) for c in cs if not c.text.startswith('__') or '__' in code]
82
85
 
83
86
  # %% ../nbs/00_core.ipynb
84
87
  def _signatures(ns, s, line, col):
@@ -113,3 +116,19 @@ def get_schemas(self:InteractiveShell, fs:list):
113
116
  "Get schemas from namespace."
114
117
  ns = self.user_ns
115
118
  return {f:_get_schema(ns,f) for f in fs}
119
+
120
+ # %% ../nbs/00_core.ipynb
121
+ @patch
122
+ def xpush(self:InteractiveShell, interactive=False, **kw):
123
+ "Like `push`, but with kwargs"
124
+ self.push(kw, interactive=interactive)
125
+
126
+ # %% ../nbs/00_core.ipynb
127
+ @patch
128
+ def publish(self:InteractiveShell, data='', subtype='plain', mimetype='text', meta=None, update=False, **kw):
129
+ if isinstance(data, DisplayObject): data,_ = self.display_formatter.format(data)
130
+ elif not isinstance(data, Mapping): data = {f'{mimetype}/{subtype}': data}
131
+ self.display_pub.publish(data, metadata=meta, transient=kw, update=update)
132
+
133
+ # %% ../nbs/00_core.ipynb
134
+ def load_ipython_extension(ip): import ipykernel_helper as __ipykernel_helper
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ipykernel-helper
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: Helpers for ipykernel and friends
5
5
  Home-page: https://github.com/AnswerDotAI/ipykernel-helper
6
6
  Author: Jeremy Howard
@@ -0,0 +1,9 @@
1
+ ipykernel_helper/__init__.py,sha256=aeFr0PgPk9_EeMwvlUatX5uddiE_ZoYCKQ5DBD_vHbQ,42
2
+ ipykernel_helper/_modidx.py,sha256=nv-MIlyO6uBIKYgQvQrmyjr2nuOs1o4lN8rL5DTJu-o,2845
3
+ ipykernel_helper/core.py,sha256=tQSFMU3I6f_W5gjqq2RwPmqyUES_4OuaSmXFr7Uc9Jc,5094
4
+ ipykernel_helper-0.0.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
+ ipykernel_helper-0.0.4.dist-info/METADATA,sha256=VI3V_HHjjLpWxg-sBjWeAAaUtq18OnKVc6Tbva5wycE,2557
6
+ ipykernel_helper-0.0.4.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
7
+ ipykernel_helper-0.0.4.dist-info/entry_points.txt,sha256=HWiK9xz75QtZUaPaYrwpyH5B8MbW0Ea_vi11UmwBImM,54
8
+ ipykernel_helper-0.0.4.dist-info/top_level.txt,sha256=_diD--64d9MauLE0pTxzZ58lkI8DvCrVc1hVAJsyc_Q,17
9
+ ipykernel_helper-0.0.4.dist-info/RECORD,,
@@ -1,9 +0,0 @@
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,,