fastcore 2.2.2__tar.gz → 2.2.3__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.
- {fastcore-2.2.2/fastcore.egg-info → fastcore-2.2.3}/PKG-INFO +1 -1
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/__init__.py +1 -1
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/xml.py +3 -4
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/xtras.py +2 -7
- {fastcore-2.2.2 → fastcore-2.2.3/fastcore.egg-info}/PKG-INFO +1 -1
- {fastcore-2.2.2 → fastcore-2.2.3}/CONTRIBUTING.md +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/LICENSE +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/MANIFEST.in +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/README.md +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/_modidx.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/aio.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/all.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/ansi.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/apisurface.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/basics.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/dispatch.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/docments.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/docscrape.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/editskill.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/foundation.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/funccall.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/imghdr.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/imports.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/meta.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/nb_imports.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/nbio.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/net.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/parallel.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/py2pyi.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/script.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/shutil.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/style.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/test.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/tools.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/transform.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/utils.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore/xdg.py +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore.egg-info/SOURCES.txt +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore.egg-info/dependency_links.txt +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore.egg-info/entry_points.txt +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore.egg-info/requires.txt +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/fastcore.egg-info/top_level.txt +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/pyproject.toml +0 -0
- {fastcore-2.2.2 → fastcore-2.2.3}/setup.cfg +0 -0
|
@@ -182,7 +182,7 @@ def _to_xml(elm, lvl=0, indent=True, do_escape=True):
|
|
|
182
182
|
esc_fn = _escape if do_escape else _noescape
|
|
183
183
|
if elm is None: return ''
|
|
184
184
|
if hasattr(elm, '__ft__'): elm = elm.__ft__()
|
|
185
|
-
if isinstance(elm, tuple): return ''.join(_to_xml(o, lvl=lvl, indent=indent, do_escape=do_escape) for o in elm)
|
|
185
|
+
if isinstance(elm, (tuple, L)): return ''.join(_to_xml(o, lvl=lvl, indent=indent, do_escape=do_escape) for o in elm)
|
|
186
186
|
if isinstance(elm, bytes): return elm.decode('utf-8')
|
|
187
187
|
if not isinstance(elm, FT): return f'{esc_fn(elm)}'
|
|
188
188
|
|
|
@@ -204,7 +204,7 @@ def _to_xml(elm, lvl=0, indent=True, do_escape=True):
|
|
|
204
204
|
if not cs:
|
|
205
205
|
if is_void: return f'{sp}{stag_}{nl_end}'
|
|
206
206
|
else: return f'{sp}{stag_}{cltag}{nl_end}'
|
|
207
|
-
if len(cs) == 1 and not isinstance(cs[0], (list, tuple, FT)) and not hasattr(cs[0], '__ft__'):
|
|
207
|
+
if len(cs) == 1 and not isinstance(cs[0], (list, tuple, L, FT)) and not hasattr(cs[0], '__ft__'):
|
|
208
208
|
content = esc_fn(cs[0])
|
|
209
209
|
return f'{sp}{stag_}{content}{cltag}{nl_end}'
|
|
210
210
|
|
|
@@ -217,13 +217,12 @@ def _to_xml(elm, lvl=0, indent=True, do_escape=True):
|
|
|
217
217
|
def to_xml(*elms, lvl=0, indent=True, do_escape=True):
|
|
218
218
|
"Convert `ft` element tree into an XML string"
|
|
219
219
|
def _f(elm):
|
|
220
|
-
if isinstance(elm, (list,tuple,FT)) or hasattr(elm, '__ft__'):
|
|
220
|
+
if isinstance(elm, (list,tuple,L,FT)) or hasattr(elm, '__ft__'):
|
|
221
221
|
return _to_xml(elm, lvl, indent, do_escape=do_escape)
|
|
222
222
|
if isinstance(elm, bytes): return elm.decode('utf-8')
|
|
223
223
|
return elm or ''
|
|
224
224
|
return Safe('\n'.join(map(_f, elms)))
|
|
225
225
|
|
|
226
|
-
|
|
227
226
|
# %% ../nbs/09_xml.ipynb #dd054392
|
|
228
227
|
@patch
|
|
229
228
|
def __html__(self:FT): return to_xml(self, indent=False)
|
|
@@ -43,7 +43,7 @@ from .ansi import strip_ansi
|
|
|
43
43
|
|
|
44
44
|
from importlib import import_module
|
|
45
45
|
from functools import wraps
|
|
46
|
-
import string,time,dataclasses,difflib
|
|
46
|
+
import string,time,dataclasses,difflib,json
|
|
47
47
|
from enum import Enum
|
|
48
48
|
from contextlib import contextmanager,ExitStack
|
|
49
49
|
from configparser import ConfigParser
|
|
@@ -250,8 +250,6 @@ def bunzip(fn):
|
|
|
250
250
|
def loads(s, **kw):
|
|
251
251
|
"Same as `json.loads`, but handles `None`"
|
|
252
252
|
if not s: return {}
|
|
253
|
-
try: import ujson as json
|
|
254
|
-
except ModuleNotFoundError: import json
|
|
255
253
|
return json.loads(s, **kw)
|
|
256
254
|
|
|
257
255
|
# %% ../nbs/03_xtras.ipynb #131170f7
|
|
@@ -268,10 +266,7 @@ def loads_multi(s:str):
|
|
|
268
266
|
|
|
269
267
|
# %% ../nbs/03_xtras.ipynb #ed688ac4
|
|
270
268
|
def dumps(obj, **kw):
|
|
271
|
-
"Same as `json.dumps
|
|
272
|
-
try: import ujson as json
|
|
273
|
-
except ModuleNotFoundError: import json
|
|
274
|
-
else: kw['escape_forward_slashes']=False
|
|
269
|
+
"Same as `json.dumps`"
|
|
275
270
|
return json.dumps(obj, **kw)
|
|
276
271
|
|
|
277
272
|
# %% ../nbs/03_xtras.ipynb #ac84300c
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|