ipykernel-helper 0.0.7__py3-none-any.whl → 0.0.9__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 +4 -1
- ipykernel_helper/core.py +50 -5
- {ipykernel_helper-0.0.7.dist-info → ipykernel_helper-0.0.9.dist-info}/METADATA +2 -2
- ipykernel_helper-0.0.9.dist-info/RECORD +9 -0
- ipykernel_helper-0.0.7.dist-info/RECORD +0 -9
- {ipykernel_helper-0.0.7.dist-info → ipykernel_helper-0.0.9.dist-info}/WHEEL +0 -0
- {ipykernel_helper-0.0.7.dist-info → ipykernel_helper-0.0.9.dist-info}/entry_points.txt +0 -0
- {ipykernel_helper-0.0.7.dist-info → ipykernel_helper-0.0.9.dist-info}/licenses/LICENSE +0 -0
- {ipykernel_helper-0.0.7.dist-info → ipykernel_helper-0.0.9.dist-info}/top_level.txt +0 -0
ipykernel_helper/__init__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "0.0.
|
|
1
|
+
__version__ = "0.0.9"
|
|
2
2
|
from .core import *
|
ipykernel_helper/_modidx.py
CHANGED
|
@@ -5,7 +5,9 @@ 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.
|
|
8
|
+
'syms': { 'ipykernel_helper.core': { 'ipykernel_helper.core.Inspector._get_info': ( 'core.html#inspector._get_info',
|
|
9
|
+
'ipykernel_helper/core.py'),
|
|
10
|
+
'ipykernel_helper.core.InteractiveShell.get_schemas': ( 'core.html#interactiveshell.get_schemas',
|
|
9
11
|
'ipykernel_helper/core.py'),
|
|
10
12
|
'ipykernel_helper.core.InteractiveShell.get_vars': ( 'core.html#interactiveshell.get_vars',
|
|
11
13
|
'ipykernel_helper/core.py'),
|
|
@@ -23,6 +25,7 @@ d = { 'settings': { 'branch': 'main',
|
|
|
23
25
|
'ipykernel_helper.core._rank': ('core.html#_rank', 'ipykernel_helper/core.py'),
|
|
24
26
|
'ipykernel_helper.core._safe_repr': ('core.html#_safe_repr', 'ipykernel_helper/core.py'),
|
|
25
27
|
'ipykernel_helper.core._signatures': ('core.html#_signatures', 'ipykernel_helper/core.py'),
|
|
28
|
+
'ipykernel_helper.core.get_md': ('core.html#get_md', 'ipykernel_helper/core.py'),
|
|
26
29
|
'ipykernel_helper.core.load_ipython_extension': ( 'core.html#load_ipython_extension',
|
|
27
30
|
'ipykernel_helper/core.py'),
|
|
28
31
|
'ipykernel_helper.core.read_url': ('core.html#read_url', 'ipykernel_helper/core.py'),
|
ipykernel_helper/core.py
CHANGED
|
@@ -3,25 +3,27 @@
|
|
|
3
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
|
|
4
4
|
|
|
5
5
|
# %% auto 0
|
|
6
|
-
__all__ = ['transient', 'run_cmd', 'read_url', 'load_ipython_extension']
|
|
6
|
+
__all__ = ['transient', 'run_cmd', 'get_md', 'read_url', 'load_ipython_extension']
|
|
7
7
|
|
|
8
8
|
# %% ../nbs/00_core.ipynb
|
|
9
9
|
from fastcore.meta import delegates
|
|
10
10
|
from fastcore.utils import patch,dict2obj
|
|
11
|
-
import typing,warnings
|
|
12
11
|
from types import ModuleType, FunctionType, MethodType, BuiltinFunctionType
|
|
13
12
|
from inspect import signature, currentframe
|
|
14
13
|
from functools import cmp_to_key,partial
|
|
15
14
|
from collections.abc import Mapping
|
|
15
|
+
from textwrap import dedent
|
|
16
16
|
from toolslm.funccall import *
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
import typing,warnings,re
|
|
19
|
+
|
|
19
20
|
from IPython.core.interactiveshell import InteractiveShell
|
|
20
21
|
from IPython.core.completer import ProvisionalCompleterWarning
|
|
21
22
|
from jedi import Interpreter, Script as jscript
|
|
22
23
|
|
|
23
24
|
from IPython.core.display import DisplayObject
|
|
24
25
|
from IPython.display import display,Markdown,HTML
|
|
26
|
+
from IPython.core.oinspect import Inspector
|
|
25
27
|
|
|
26
28
|
# %% ../nbs/00_core.ipynb
|
|
27
29
|
warnings.filterwarnings('ignore', category=ProvisionalCompleterWarning)
|
|
@@ -139,10 +141,53 @@ def run_cmd(cmd, data='', meta=None, update=False, **kw):
|
|
|
139
141
|
transient(data, meta=meta, update=update, cmd=cmd, **kw)
|
|
140
142
|
|
|
141
143
|
# %% ../nbs/00_core.ipynb
|
|
142
|
-
def
|
|
144
|
+
def get_md(cts):
|
|
145
|
+
from html2text import HTML2Text
|
|
146
|
+
h2t = HTML2Text(bodywidth=5000)
|
|
147
|
+
h2t.ignore_links = False
|
|
148
|
+
h2t.mark_code = True
|
|
149
|
+
h2t.ignore_images = False
|
|
150
|
+
res = h2t.handle(cts)
|
|
151
|
+
def _f(m): return f'```\n{dedent(m.group(1))}\n```'
|
|
152
|
+
return re.sub(r'\[code]\s*\n(.*?)\n\[/code]', _f, res or '', flags=re.DOTALL).strip()
|
|
153
|
+
|
|
154
|
+
# %% ../nbs/00_core.ipynb
|
|
155
|
+
def read_url(
|
|
156
|
+
url:str, # URL to read
|
|
157
|
+
as_md:bool=True, # Convert HTML to Markdown?
|
|
158
|
+
extract_section:bool=True, # If url has an anchor, return only that section
|
|
159
|
+
selector:str=None # Select section(s) using BeautifulSoup.select (overrides extract_section)
|
|
160
|
+
):
|
|
143
161
|
"Read URL and return contents"
|
|
144
162
|
import httpx
|
|
145
|
-
|
|
163
|
+
from urllib.parse import urlparse
|
|
164
|
+
from bs4 import BeautifulSoup
|
|
165
|
+
|
|
166
|
+
res = httpx.get(url, follow_redirects=True).raise_for_status().text
|
|
167
|
+
if selector:
|
|
168
|
+
sections = BeautifulSoup(res).select(selector)
|
|
169
|
+
if sections: res = '\n\n'.join(str(section) for section in sections)
|
|
170
|
+
else: res = ''
|
|
171
|
+
elif extract_section:
|
|
172
|
+
parsed = urlparse(url)
|
|
173
|
+
if parsed.fragment:
|
|
174
|
+
section = BeautifulSoup(res).find(id=parsed.fragment)
|
|
175
|
+
if section: res = str(section)
|
|
176
|
+
if as_md: return get_md(res)
|
|
177
|
+
return res
|
|
178
|
+
|
|
179
|
+
# %% ../nbs/00_core.ipynb
|
|
180
|
+
@patch
|
|
181
|
+
def _get_info(self:Inspector, obj, oname='', formatter=None, info=None, detail_level=0, omit_sections=()):
|
|
182
|
+
"Custom formatter for ?? output"
|
|
183
|
+
orig = self._orig__get_info(obj, oname=oname, formatter=formatter, info=info,
|
|
184
|
+
detail_level=detail_level, omit_sections=omit_sections)
|
|
185
|
+
if detail_level==0: return orig
|
|
186
|
+
info_dict = self.info(obj, oname=oname, info=info, detail_level=detail_level)
|
|
187
|
+
out = []
|
|
188
|
+
if c:=info_dict.get('source'): out.append(f"\n```python\n{dedent(c)}\n```")
|
|
189
|
+
if c:=info_dict.get('file'): out.append(f"**File:** `{c}`")
|
|
190
|
+
return {'text/markdown': '\n\n'.join(out), 'text/html': '', 'text/plain': orig['text/plain']}
|
|
146
191
|
|
|
147
192
|
# %% ../nbs/00_core.ipynb
|
|
148
193
|
def load_ipython_extension(ip):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ipykernel-helper
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: Helpers for ipykernel and friends
|
|
5
5
|
Home-page: https://github.com/AnswerDotAI/ipykernel-helper
|
|
6
6
|
Author: Jeremy Howard
|
|
@@ -20,9 +20,9 @@ Description-Content-Type: text/markdown
|
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Requires-Dist: fastcore
|
|
22
22
|
Requires-Dist: toolslm>=0.2.0
|
|
23
|
-
Requires-Dist: jupyter-client
|
|
24
23
|
Requires-Dist: jedi
|
|
25
24
|
Requires-Dist: ipython
|
|
25
|
+
Requires-Dist: ipykernel
|
|
26
26
|
Provides-Extra: dev
|
|
27
27
|
Dynamic: author
|
|
28
28
|
Dynamic: author-email
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
ipykernel_helper/__init__.py,sha256=8v08jLbD8mgo8kbkFtp9fIlkDQsiovYgy2xWvMrgXWY,42
|
|
2
|
+
ipykernel_helper/_modidx.py,sha256=INE9z1o4nb_NMRepxbiF5fBE5Il5BeKJZFTLmdxUGLw,3577
|
|
3
|
+
ipykernel_helper/core.py,sha256=hf7ml7uXFjzllCvwuiRVfu8NQlq9AQ3Xdfd3trkY0sk,7650
|
|
4
|
+
ipykernel_helper-0.0.9.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
|
+
ipykernel_helper-0.0.9.dist-info/METADATA,sha256=u2k58GJKbgSlpUYLSSGM_b5JCWnxkAAse7e91pAKVSs,2625
|
|
6
|
+
ipykernel_helper-0.0.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
ipykernel_helper-0.0.9.dist-info/entry_points.txt,sha256=HWiK9xz75QtZUaPaYrwpyH5B8MbW0Ea_vi11UmwBImM,54
|
|
8
|
+
ipykernel_helper-0.0.9.dist-info/top_level.txt,sha256=_diD--64d9MauLE0pTxzZ58lkI8DvCrVc1hVAJsyc_Q,17
|
|
9
|
+
ipykernel_helper-0.0.9.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
ipykernel_helper/__init__.py,sha256=cBGyHvib2OPGtNoyRG91A9JaJUiuPOiM2YX9VdZUQ64,42
|
|
2
|
-
ipykernel_helper/_modidx.py,sha256=lQXK2a0JRa5HT5pHMaCEvN2fPlErCyHzg-m_I5vici0,3222
|
|
3
|
-
ipykernel_helper/core.py,sha256=Y1qTzHK1ogdCtXUA_QU44oQ0sRc3-VS0F1ZPYG_aOTk,5780
|
|
4
|
-
ipykernel_helper-0.0.7.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
|
-
ipykernel_helper-0.0.7.dist-info/METADATA,sha256=n5X5ZcorROAEuOFtE7CcY83YNnf-sZRIjtujWkRYTxE,2630
|
|
6
|
-
ipykernel_helper-0.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
ipykernel_helper-0.0.7.dist-info/entry_points.txt,sha256=HWiK9xz75QtZUaPaYrwpyH5B8MbW0Ea_vi11UmwBImM,54
|
|
8
|
-
ipykernel_helper-0.0.7.dist-info/top_level.txt,sha256=_diD--64d9MauLE0pTxzZ58lkI8DvCrVc1hVAJsyc_Q,17
|
|
9
|
-
ipykernel_helper-0.0.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|