Commit 6c49d377 authored by Romain Casati's avatar Romain Casati
Browse files

Support for qrcode package (we fix six to prevent I/O error).

parent 60e7a86d
......@@ -16,6 +16,7 @@ download = __kernel__.download
_hack_builtins.hack_input()
_hack_builtins.hack_help()
_hack_builtins.hack_six()
# avoid poluting __dict__
......
......@@ -3,6 +3,7 @@ import builtins
import sys
from js import window
from . import packages
from pathlib import Path
__author__ = "Romain Casati"
......@@ -10,7 +11,7 @@ __license__ = "GNU GPL v3"
__email__ = "romain.casati@basthon.fr"
__all__ = ['hack_input', 'hack_help']
__all__ = ['hack_input', 'hack_help', 'hack_six']
def hack_input():
......@@ -56,3 +57,17 @@ def hack_help():
return res
pydoc.help = _hacked_help
def hack_six():
"""
In pyodide 0.16.1, six is installed under
/lib/python3.8/site-packages/six.py
when importing qrcode from PyPi (using micropip), it tries to install
six (from PyPi too) under the same path which results in I/O error.
To fix this, we move six.py under /lib/python3.8/
"""
path = Path('/lib/python3.8/site-packages/six.py')
assert path.exists(), "If you see this, hack_six should be useless."
path.rename('/lib/python3.8/six.py')
from . import kernel
from js import document
import io
__author__ = "Romain Casati"
__license__ = "GNU GPL v3"
......@@ -212,6 +212,79 @@ def hack_scipy():
scipy.integrate.odeint.__doc__ = scipy.integrate._odeint.__doc__
def hack_qrcode():
"""
* Adding `_repr_svg_` and `show` to qrcode svg images.
* Fix issue in `qrcode.image.svg.SvgPathImage._write`
* Add shortcut format to `qrcode.make`
* Add `download` function to `qrcode.image.base.BaseImage`
"""
import qrcode
import qrcode.image.base as baseimage
import qrcode.image.svg as svg
import qrcode.image.pil as pil
# display svg images
def _repr_svg_(self):
res = io.BytesIO()
self.save(res)
return res.getvalue().decode('utf8')
svg.SvgFragmentImage._repr_svg_ = _repr_svg_
def show(self):
"""
Display this image.
"""
kernel.display(self)
svg.SvgFragmentImage.show = show
# fix qrcode.image.svg.SvgPathImage._write
def _write(self, stream):
flag = '_path_appended'
if not hasattr(self, flag):
self._img.append(self.make_path())
setattr(self, flag, True)
super(svg.SvgPathImage, self)._write(stream)
svg.SvgPathImage._write = _write
# shortcut format in qrcode.make
qrcode._original_make = qrcode.make
def make(*args, **kwargs):
if 'format' in kwargs:
format = kwargs.pop('format')
factories = {'png': pil.PilImage,
'svg': svg.SvgPathImage}
if isinstance(format, str):
format = format.lower()
if format not in factories:
raise ValueError(
f"{format} is not supported "
f"(should be one of {', '.join(factories.keys())}).")
kwargs['image_factory'] = factories[format]
return qrcode._original_make(*args, **kwargs)
qrcode.make = make
# download
def meta_download(ext=''):
def download(self, filename=f'qrcode{ext}'):
""" Download image as file. """
f = io.BytesIO()
self.save(f)
f.seek(0)
# f will be closed by download
return kernel.download(filename, f)
return download
baseimage.BaseImage.download = meta_download()
pil.PilImage.download = meta_download('.png')
svg.SvgFragmentImage.download = meta_download('.svg')
def hack(modules):
""" Hack a list of modules. """
if isinstance(modules, str):
......
......@@ -66,6 +66,10 @@ _internal_pkgs_dict = {
"scipy": { # this force scipy to load _ivp first
"deps": ["_ivp"],
},
"qrcode": {
"path": "qrcode", # loaded from PyPi
"deps": ["PIL"], # to force hacking
},
}
# checking that 'path' is in dict allows to add dependencies to pyodide packages
......
["Bio", "IPython", "PIL", "__future__", "__main__", "_abc", "_ast", "_bootlocale", "_codecs", "_collections", "_collections_abc", "_compat_pickle", "_compression", "_contextvars", "_dummy_thread", "_frozen_importlib", "_frozen_importlib_external", "_functools", "_heapq", "_imp", "_io", "_ivp", "_locale", "_markupbase", "_operator", "_posixsubprocess", "_py_abc", "_pydecimal", "_pyio", "_signal", "_sitebuiltins", "_socket", "_sre", "_stat", "_string", "_strptime", "_sysconfigdata__emscripten_", "_testcapi", "_thread", "_threading_local", "_warnings", "_weakref", "_weakrefset", "abc", "aifc", "antigravity", "argparse", "asciitree", "ast", "astropy", "asynchat", "asyncio", "asyncore", "atexit", "atomicwrites", "attr", "autograd", "bar", "base64", "basthon", "bdb", "binhex", "bisect", "bleach", "bs4", "builtins", "bz2", "cProfile", "calendar", "cgi", "cgitb", "chunk", "cloudpickle", "cmd", "code", "codecs", "codeop", "collections", "colorsys", "compileall", "concurrent", "configparser", "contextlib", "contextvars", "copy", "copyreg", "crypt", "cssselect", "csv", "cycler", "cytoolz", "dataclasses", "datetime", "dateutil", "decimal", "decorator", "difflib", "dis", "distlib", "distutils", "doctest", "docutils", "dummy_threading", "easy_install", "email", "encodings", "enum", "errno", "filecmp", "fileinput", "fnmatch", "folium", "foo", "formatter", "fractions", "freesasa", "ftplib", "functools", "future", "genericpath", "getopt", "getpass", "gettext", "glob", "graphviz", "gzip", "hashlib", "heapq", "hmac", "html", "html5lib", "http", "imageio", "imaplib", "imghdr", "imp", "importlib", "inspect", "io", "ipaddress", "itertools", "jedi", "jinja2", "joblib", "js", "json", "keyword", "kiwisolver", "linecache", "locale", "logging", "lxml", "lzma", "mailbox", "mailcap", "markupsafe", "marshal", "math", "matplotlib", "micropip", "mimetypes", "mne", "modulefinder", "more_itertools", "mpl_toolkits", "mpmath", "msgpack", "multiprocessing", "netrc", "networkx", "nltk", "nntplib", "nose", "ntpath", "nturl2path", "numbers", "numcodecs", "numpy", "opcode", "operator", "optparse", "os", "p5", "packaging", "pandas", "parso", "pathlib", "patsy", "pdb", "pickle", "pickletools", "pipes", "pkg_resources", "pkgutil", "platform", "plistlib", "pluggy", "poplib", "posix", "posixpath", "pprint", "profile", "proj4py", "pstats", "pty", "py", "py_compile", "pyclbr", "pydoc", "pydoc_data", "pygments", "pyodide", "pyodide_interrupts", "pyparsing", "pysat", "pystone", "pytest", "pytz", "pywt", "queue", "quopri", "random", "re", "regex", "reprlib", "requests", "rlcompleter", "runpy", "sched", "scipy", "secrets", "select", "selectors", "setuptools", "shelve", "shlex", "shutil", "signal", "site", "sitecustomize", "six", "skimage", "sklearn", "smtpd", "smtplib", "sndhdr", "socket", "socketserver", "soupsieve", "sqlite3", "sre_compile", "sre_constants", "sre_parse", "ssl", "stat", "statistics", "statsmodels", "string", "stringprep", "struct", "subprocess", "sunau", "symbol", "sympy", "symtable", "sys", "sysconfig", "tabnanny", "tarfile", "telnetlib", "tempfile", "textwrap", "this", "threading", "time", "timeit", "token", "tokenize", "toolz", "trace", "traceback", "tracemalloc", "traits", "tty", "turtle", "tutor", "types", "typing", "uncertainties", "unittest", "urllib", "uu", "uuid", "warnings", "wave", "weakref", "webbrowser", "webencodings", "wsgiref", "xdrlib", "xlrd", "xml", "xmlrpc", "yt", "zarr", "zipapp", "zipfile", "zipimport"]
\ No newline at end of file
["Bio", "IPython", "PIL", "__future__", "__main__", "_abc", "_ast", "_bootlocale", "_codecs", "_collections", "_collections_abc", "_compat_pickle", "_compression", "_contextvars", "_dummy_thread", "_frozen_importlib", "_frozen_importlib_external", "_functools", "_heapq", "_imp", "_io", "_ivp", "_locale", "_markupbase", "_operator", "_posixsubprocess", "_py_abc", "_pydecimal", "_pyio", "_signal", "_sitebuiltins", "_socket", "_sre", "_stat", "_string", "_strptime", "_sysconfigdata__emscripten_", "_testcapi", "_thread", "_threading_local", "_warnings", "_weakref", "_weakrefset", "abc", "aifc", "antigravity", "argparse", "asciitree", "ast", "astropy", "asynchat", "asyncio", "asyncore", "atexit", "atomicwrites", "attr", "autograd", "bar", "base64", "basthon", "bdb", "binhex", "bisect", "bleach", "bs4", "builtins", "bz2", "cProfile", "calendar", "cgi", "cgitb", "chunk", "cloudpickle", "cmd", "code", "codecs", "codeop", "collections", "colorsys", "compileall", "concurrent", "configparser", "contextlib", "contextvars", "copy", "copyreg", "crypt", "cssselect", "csv", "cycler", "cytoolz", "dataclasses", "datetime", "dateutil", "decimal", "decorator", "difflib", "dis", "distlib", "distutils", "doctest", "docutils", "dummy_threading", "easy_install", "email", "encodings", "enum", "errno", "filecmp", "fileinput", "fnmatch", "folium", "foo", "formatter", "fractions", "freesasa", "ftplib", "functools", "future", "genericpath", "getopt", "getpass", "gettext", "glob", "graphviz", "gzip", "hashlib", "heapq", "hmac", "html", "html5lib", "http", "imageio", "imaplib", "imghdr", "imp", "importlib", "inspect", "io", "ipaddress", "itertools", "jedi", "jinja2", "joblib", "js", "json", "keyword", "kiwisolver", "linecache", "locale", "logging", "lxml", "lzma", "mailbox", "mailcap", "markupsafe", "marshal", "math", "matplotlib", "micropip", "mimetypes", "mne", "modulefinder", "more_itertools", "mpl_toolkits", "mpmath", "msgpack", "multiprocessing", "netrc", "networkx", "nltk", "nntplib", "nose", "ntpath", "nturl2path", "numbers", "numcodecs", "numpy", "opcode", "operator", "optparse", "os", "p5", "packaging", "pandas", "parso", "pathlib", "patsy", "pdb", "pickle", "pickletools", "pipes", "pkg_resources", "pkgutil", "platform", "plistlib", "pluggy", "poplib", "posix", "posixpath", "pprint", "profile", "proj4py", "pstats", "pty", "py", "py_compile", "pyclbr", "pydoc", "pydoc_data", "pygments", "pyodide", "pyodide_interrupts", "pyparsing", "pysat", "pystone", "pytest", "pytz", "pywt", "qrcode", "queue", "quopri", "random", "re", "regex", "reprlib", "requests", "rlcompleter", "runpy", "sched", "scipy", "secrets", "select", "selectors", "setuptools", "shelve", "shlex", "shutil", "signal", "site", "sitecustomize", "six", "skimage", "sklearn", "smtpd", "smtplib", "sndhdr", "socket", "socketserver", "soupsieve", "sqlite3", "sre_compile", "sre_constants", "sre_parse", "ssl", "stat", "statistics", "statsmodels", "string", "stringprep", "struct", "subprocess", "sunau", "symbol", "sympy", "symtable", "sys", "sysconfig", "tabnanny", "tarfile", "telnetlib", "tempfile", "textwrap", "this", "threading", "time", "timeit", "token", "tokenize", "toolz", "trace", "traceback", "tracemalloc", "traits", "tty", "turtle", "tutor", "types", "typing", "uncertainties", "unittest", "urllib", "uu", "uuid", "warnings", "wave", "weakref", "webbrowser", "webencodings", "wsgiref", "xdrlib", "xlrd", "xml", "xmlrpc", "yt", "zarr", "zipapp", "zipfile", "zipimport"]
\ No newline at end of file
Please wait a moment while I gather a list of all available modules...
Bio binascii js rlcompleter
IPython binhex json runpy
PIL bisect keyword sched
__future__ bleach kiwisolver scipy
_abc bs4 linecache secrets
_ast builtins locale select
_bisect bz2 logging selectors
_blake2 cProfile lxml setuptools
_bootlocale calendar lzma shelve
_bz2 cgi mailbox shlex
_codecs cgitb mailcap shutil
_codecs_cn chunk markupsafe signal
_codecs_hk cloudpickle marshal site
_codecs_iso2022 cmath math sitecustomize
_codecs_jp cmd matplotlib six
_codecs_kr code micropip skimage
_codecs_tw codecs mimetypes sklearn
_collections codeop mmap smtpd
_collections_abc collections mne smtplib
_compat_pickle colorsys modulefinder sndhdr
_compression compileall more_itertools socket
_contextvars concurrent mpl_toolkits socketserver
_crypt configparser mpmath soupsieve
_csv contextlib msgpack sqlite3
_datetime contextvars multiprocessing sre_compile
_decimal copy netrc sre_constants
_dummy_thread copyreg networkx sre_parse
_functools crypt nltk ssl
_heapq cssselect nntplib stat
_imp csv nose statistics
_io cycler ntpath statsmodels
_ivp cytoolz nturl2path string
_json dataclasses numbers stringprep
_locale datetime numcodecs struct
_lsprof dateutil numpy subprocess
_markupbase decimal opcode sunau
_md5 decorator operator symbol
_multibytecodec difflib optparse sympy
_operator dis os symtable
_pickle distlib p5 sys
_posixsubprocess distutils packaging sysconfig
_py_abc doctest pandas tabnanny
_pydecimal docutils parser tarfile
_pyio dummy_threading parso telnetlib
_queue easy_install pathlib tempfile
_random email patsy textwrap
_sha1 encodings pdb this
_sha256 enum pickle threading
_sha3 errno pickletools time
_sha512 faulthandler pipes timeit
_signal filecmp pkg_resources token
_sitebuiltins fileinput pkgutil tokenize
_socket fnmatch platform toolz
_sqlite3 folium plistlib trace
_sre formatter pluggy traceback
_stat fractions poplib tracemalloc
_string freesasa posix traits
_strptime ftplib posixpath tty
_struct functools pprint turtle
_symtable future profile tutor
_sysconfigdata__emscripten_ gc proj4py types
_testcapi genericpath pstats typing
_thread getopt pty uncertainties
_threading_local getpass pwd unicodedata
_tracemalloc gettext py unittest
_warnings glob py_compile urllib
_weakref graphviz pyclbr uu
_weakrefset gzip pydoc uuid
abc hashlib pydoc_data warnings
aifc heapq pyexpat wave
antigravity hmac pygments weakref
argparse html pyodide webbrowser
array html5lib pyodide_interrupts webencodings
asciitree http pyparsing wsgiref
ast imageio pysat xdrlib
astropy imaplib pystone xlrd
asynchat imghdr pytest xml
asyncio imp pytz xmlrpc
asyncore importlib pywt xxsubtype
atexit inspect queue yt
atomicwrites io quopri zarr
attr ipaddress random zipapp
autograd itertools re zipfile
base64 jedi regex zipimport
basthon jinja2 reprlib zlib
bdb joblib requests
Bio binascii js requests
IPython binhex json rlcompleter
PIL bisect keyword runpy
__future__ bleach kiwisolver sched
_abc bs4 linecache scipy
_ast builtins locale secrets
_bisect bz2 logging select
_blake2 cProfile lxml selectors
_bootlocale calendar lzma setuptools
_bz2 cgi mailbox shelve
_codecs cgitb mailcap shlex
_codecs_cn chunk markupsafe shutil
_codecs_hk cloudpickle marshal signal
_codecs_iso2022 cmath math site
_codecs_jp cmd matplotlib sitecustomize
_codecs_kr code micropip six
_codecs_tw codecs mimetypes skimage
_collections codeop mmap sklearn
_collections_abc collections mne smtpd
_compat_pickle colorsys modulefinder smtplib
_compression compileall more_itertools sndhdr
_contextvars concurrent mpl_toolkits socket
_crypt configparser mpmath socketserver
_csv contextlib msgpack soupsieve
_datetime contextvars multiprocessing sqlite3
_decimal copy netrc sre_compile
_dummy_thread copyreg networkx sre_constants
_functools crypt nltk sre_parse
_heapq cssselect nntplib ssl
_imp csv nose stat
_io cycler ntpath statistics
_ivp cytoolz nturl2path statsmodels
_json dataclasses numbers string
_locale datetime numcodecs stringprep
_lsprof dateutil numpy struct
_markupbase decimal opcode subprocess
_md5 decorator operator sunau
_multibytecodec difflib optparse symbol
_operator dis os sympy
_pickle distlib p5 symtable
_posixsubprocess distutils packaging sys
_py_abc doctest pandas sysconfig
_pydecimal docutils parser tabnanny
_pyio dummy_threading parso tarfile
_queue easy_install pathlib telnetlib
_random email patsy tempfile
_sha1 encodings pdb textwrap
_sha256 enum pickle this
_sha3 errno pickletools threading
_sha512 faulthandler pipes time
_signal filecmp pkg_resources timeit
_sitebuiltins fileinput pkgutil token
_socket fnmatch platform tokenize
_sqlite3 folium plistlib toolz
_sre formatter pluggy trace
_stat fractions poplib traceback
_string freesasa posix tracemalloc
_strptime ftplib posixpath traits
_struct functools pprint tty
_symtable future profile turtle
_sysconfigdata__emscripten_ gc proj4py tutor
_testcapi genericpath pstats types
_thread getopt pty typing
_threading_local getpass pwd uncertainties
_tracemalloc gettext py unicodedata
_warnings glob py_compile unittest
_weakref graphviz pyclbr urllib
_weakrefset gzip pydoc uu
abc hashlib pydoc_data uuid
aifc heapq pyexpat warnings
antigravity hmac pygments wave
argparse html pyodide weakref
array html5lib pyodide_interrupts webbrowser
asciitree http pyparsing webencodings
ast imageio pysat wsgiref
astropy imaplib pystone xdrlib
asynchat imghdr pytest xlrd
asyncio imp pytz xml
asyncore importlib pywt xmlrpc
atexit inspect qrcode xxsubtype
atomicwrites io queue yt
attr ipaddress quopri zarr
autograd itertools random zipapp
base64 jedi re zipfile
basthon jinja2 regex zipimport
bdb joblib reprlib zlib
Enter any module name to get more help. Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".
......
<?xml version='1.0' encoding='UTF-8'?>
<svg width="33mm" height="33mm" version="1.1" viewBox="0 0 33 33" xmlns="http://www.w3.org/2000/svg"><path style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" d="M 9 22 L 9 23 L 10 23 L 10 22 z M 7 22 L 7 23 L 8 23 L 8 22 z M 5 22 L 5 23 L 6 23 L 6 22 z M 4 6 L 4 7 L 5 7 L 5 6 z M 4 23 L 4 24 L 5 24 L 5 23 z M 28 7 L 28 8 L 29 8 L 29 7 z M 26 7 L 26 8 L 27 8 L 27 7 z M 28 24 L 28 25 L 29 25 L 29 24 z M 17 21 L 17 22 L 18 22 L 18 21 z M 25 8 L 25 9 L 26 9 L 26 8 z M 27 25 L 27 26 L 28 26 L 28 25 z M 20 12 L 20 13 L 21 13 L 21 12 z M 9 4 L 9 5 L 10 5 L 10 4 z M 7 4 L 7 5 L 8 5 L 8 4 z M 4 5 L 4 6 L 5 6 L 5 5 z M 8 22 L 8 23 L 9 23 L 9 22 z M 6 22 L 6 23 L 7 23 L 7 22 z M 4 22 L 4 23 L 5 23 L 5 22 z M 28 6 L 28 7 L 29 7 L 29 6 z M 21 20 L 21 21 L 22 21 L 22 20 z M 25 7 L 25 8 L 26 8 L 26 7 z M 17 8 L 17 9 L 18 9 L 18 8 z M 22 28 L 22 29 L 23 29 L 23 28 z M 16 16 L 16 17 L 17 17 L 17 16 z M 11 20 L 11 21 L 12 21 L 12 20 z M 10 4 L 10 5 L 11 5 L 11 4 z M 9 20 L 9 21 L 10 21 L 10 20 z M 8 4 L 8 5 L 9 5 L 9 4 z M 6 4 L 6 5 L 7 5 L 7 4 z M 7 8 L 7 9 L 8 9 L 8 8 z M 27 23 L 27 24 L 28 24 L 28 23 z M 28 10 L 28 11 L 29 11 L 29 10 z M 17 7 L 17 8 L 18 8 L 18 7 z M 26 10 L 26 11 L 27 11 L 27 10 z M 24 10 L 24 11 L 25 11 L 25 10 z M 19 24 L 19 25 L 20 25 L 20 24 z M 17 24 L 17 25 L 18 25 L 18 24 z M 26 27 L 26 28 L 27 28 L 27 27 z M 28 27 L 28 28 L 29 28 L 29 27 z M 24 27 L 24 28 L 25 28 L 25 27 z M 16 15 L 16 16 L 17 16 L 17 15 z M 15 19 L 15 20 L 16 20 L 16 19 z M 10 20 L 10 21 L 11 21 L 11 20 z M 8 20 L 8 21 L 9 21 L 9 20 z M 7 7 L 7 8 L 8 8 L 8 7 z M 7 24 L 7 25 L 8 25 L 8 24 z M 6 8 L 6 9 L 7 9 L 7 8 z M 4 8 L 4 9 L 5 9 L 5 8 z M 4 25 L 4 26 L 5 26 L 5 25 z M 28 9 L 28 10 L 29 10 L 29 9 z M 19 23 L 19 24 L 20 24 L 20 23 z M 28 26 L 28 27 L 29 27 L 29 26 z M 27 10 L 27 11 L 28 11 L 28 10 z M 26 26 L 26 27 L 27 27 L 27 26 z M 25 10 L 25 11 L 26 11 L 26 10 z M 23 10 L 23 11 L 24 11 L 24 10 z M 27 27 L 27 28 L 28 28 L 28 27 z M 23 27 L 23 28 L 24 28 L 24 27 z M 22 14 L 22 15 L 23 15 L 23 14 z M 15 18 L 15 19 L 16 19 L 16 18 z M 12 19 L 12 20 L 13 20 L 13 19 z M 7 6 L 7 7 L 8 7 L 8 6 z M 8 7 L 8 8 L 9 8 L 9 7 z M 6 7 L 6 8 L 7 8 L 7 7 z M 4 7 L 4 8 L 5 8 L 5 7 z M 8 24 L 8 25 L 9 25 L 9 24 z M 6 24 L 6 25 L 7 25 L 7 24 z M 4 24 L 4 25 L 5 25 L 5 24 z M 28 25 L 28 26 L 29 26 L 29 25 z M 27 26 L 27 27 L 28 27 L 28 26 z M 25 26 L 25 27 L 26 27 L 26 26 z M 26 13 L 26 14 L 27 14 L 27 13 z M 24 13 L 24 14 L 25 14 L 25 13 z M 16 18 L 16 19 L 17 19 L 17 18 z M 14 18 L 14 19 L 15 19 L 15 18 z M 13 5 L 13 6 L 14 6 L 14 5 z M 13 22 L 13 23 L 14 23 L 14 22 z M 10 6 L 10 7 L 11 7 L 11 6 z M 8 6 L 8 7 L 9 7 L 9 6 z M 6 6 L 6 7 L 7 7 L 7 6 z M 10 23 L 10 24 L 11 24 L 11 23 z M 7 10 L 7 11 L 8 11 L 8 10 z M 5 10 L 5 11 L 6 11 L 6 10 z M 28 12 L 28 13 L 29 13 L 29 12 z M 17 9 L 17 10 L 18 10 L 18 9 z M 26 12 L 26 13 L 27 13 L 27 12 z M 24 12 L 24 13 L 25 13 L 25 12 z M 19 26 L 19 27 L 20 27 L 20 26 z M 25 13 L 25 14 L 26 14 L 26 13 z M 23 13 L 23 14 L 24 14 L 24 13 z M 20 17 L 20 18 L 21 18 L 21 17 z M 18 17 L 18 18 L 19 18 L 19 17 z M 15 4 L 15 5 L 16 5 L 16 4 z M 13 4 L 13 5 L 14 5 L 14 4 z M 15 21 L 15 22 L 16 22 L 16 21 z M 14 5 L 14 6 L 15 6 L 15 5 z M 12 5 L 12 6 L 13 6 L 13 5 z M 10 5 L 10 6 L 11 6 L 11 5 z M 12 22 L 12 23 L 13 23 L 13 22 z M 10 22 L 10 23 L 11 23 L 11 22 z M 7 26 L 7 27 L 8 27 L 8 26 z M 6 10 L 6 11 L 7 11 L 7 10 z M 4 10 L 4 11 L 5 11 L 5 10 z M 4 27 L 4 28 L 5 28 L 5 27 z M 21 25 L 21 26 L 22 26 L 22 25 z M 28 28 L 28 29 L 29 29 L 29 28 z M 27 12 L 27 13 L 28 13 L 28 12 z M 22 16 L 22 17 L 23 17 L 23 16 z M 20 16 L 20 17 L 21 17 L 21 16 z M 16 4 L 16 5 L 17 5 L 17 4 z M 14 4 L 14 5 L 15 5 L 15 4 z M 12 4 L 12 5 L 13 5 L 13 4 z M 16 21 L 16 22 L 17 22 L 17 21 z M 14 21 L 14 22 L 15 22 L 15 21 z M 12 21 L 12 22 L 13 22 L 13 21 z M 7 25 L 7 26 L 8 26 L 8 25 z M 4 9 L 4 10 L 5 10 L 5 9 z M 8 26 L 8 27 L 9 27 L 9 26 z M 6 26 L 6 27 L 7 27 L 7 26 z M 4 26 L 4 27 L 5 27 L 5 26 z M 5 13 L 5 14 L 6 14 L 6 13 z M 21 24 L 21 25 L 22 25 L 22 24 z M 25 28 L 25 29 L 26 29 L 26 28 z M 17 12 L 17 13 L 18 13 L 18 12 z M 26 15 L 26 16 L 27 16 L 27 15 z M 22 15 L 22 16 L 23 16 L 23 15 z M 23 16 L 23 17 L 24 17 L 24 16 z M 18 20 L 18 21 L 19 21 L 19 20 z M 14 20 L 14 21 L 15 21 L 15 20 z M 15 7 L 15 8 L 16 8 L 16 7 z M 13 7 L 13 8 L 14 8 L 14 7 z M 13 24 L 13 25 L 14 25 L 14 24 z M 10 8 L 10 9 L 11 9 L 11 8 z M 8 8 L 8 9 L 9 9 L 9 8 z M 10 25 L 10 26 L 11 26 L 11 25 z M 8 25 L 8 26 L 9 26 L 9 25 z M 6 25 L 6 26 L 7 26 L 7 25 z M 7 12 L 7 13 L 8 13 L 8 12 z M 4 13 L 4 14 L 5 14 L 5 13 z M 19 11 L 19 12 L 20 12 L 20 11 z M 28 14 L 28 15 L 29 15 L 29 14 z M 17 11 L 17 12 L 18 12 L 18 11 z M 17 28 L 17 29 L 18 29 L 18 28 z M 25 15 L 25 16 L 26 16 L 26 15 z M 13 6 L 13 7 L 14 7 L 14 6 z M 10 7 L 10 8 L 11 8 L 11 7 z M 14 24 L 14 25 L 15 25 L 15 24 z M 12 24 L 12 25 L 13 25 L 13 24 z M 10 24 L 10 25 L 11 25 L 11 24 z M 9 28 L 9 29 L 10 29 L 10 28 z M 7 28 L 7 29 L 8 29 L 8 28 z M 5 28 L 5 29 L 6 29 L 6 28 z M 4 12 L 4 13 L 5 13 L 5 12 z M 25 14 L 25 15 L 26 15 L 26 14 z M 24 18 L 24 19 L 25 19 L 25 18 z M 22 18 L 22 19 L 23 19 L 23 18 z M 16 6 L 16 7 L 17 7 L 17 6 z M 15 22 L 15 23 L 16 23 L 16 22 z M 12 6 L 12 7 L 13 7 L 13 6 z M 16 23 L 16 24 L 17 24 L 17 23 z M 12 23 L 12 24 L 13 24 L 13 23 z M 9 10 L 9 11 L 10 11 L 10 10 z M 8 28 L 8 29 L 9 29 L 9 28 z M 6 28 L 6 29 L 7 29 L 7 28 z M 4 28 L 4 29 L 5 29 L 5 28 z M 27 13 L 27 14 L 28 14 L 28 13 z M 17 14 L 17 15 L 18 15 L 18 14 z M 24 17 L 24 18 L 25 18 L 25 17 z M 18 5 L 18 6 L 19 6 L 19 5 z M 14 22 L 14 23 L 15 23 L 15 22 z M 13 26 L 13 27 L 14 27 L 14 26 z M 12 10 L 12 11 L 13 11 L 13 10 z M 10 10 L 10 11 L 11 11 L 11 10 z M 8 10 L 8 11 L 9 11 L 9 10 z M 10 27 L 10 28 L 11 28 L 11 27 z M 4 15 L 4 16 L 5 16 L 5 15 z M 19 13 L 19 14 L 20 14 L 20 13 z M 28 16 L 28 17 L 29 17 L 29 16 z M 17 13 L 17 14 L 18 14 L 18 13 z M 22 4 L 22 5 L 23 5 L 23 4 z M 20 21 L 20 22 L 21 22 L 21 21 z M 18 21 L 18 22 L 19 22 L 19 21 z M 15 8 L 15 9 L 16 9 L 16 8 z M 14 9 L 14 10 L 15 10 L 15 9 z M 10 9 L 10 10 L 11 10 L 11 9 z M 10 26 L 10 27 L 11 27 L 11 26 z M 9 13 L 9 14 L 10 14 L 10 13 z M 7 13 L 7 14 L 8 14 L 8 13 z M 6 14 L 6 15 L 7 15 L 7 14 z M 21 12 L 21 13 L 22 13 L 22 12 z M 28 15 L 28 16 L 29 16 L 29 15 z M 24 20 L 24 21 L 25 21 L 25 20 z M 22 20 L 22 21 L 23 21 L 23 20 z M 20 20 L 20 21 L 21 21 L 21 20 z M 12 8 L 12 9 L 13 9 L 13 8 z M 14 25 L 14 26 L 15 26 L 15 25 z M 12 25 L 12 26 L 13 26 L 13 25 z M 11 12 L 11 13 L 12 13 L 12 12 z M 9 12 L 9 13 L 10 13 L 10 12 z M 8 13 L 8 14 L 9 14 L 9 13 z M 6 13 L 6 14 L 7 14 L 7 13 z M 21 28 L 21 29 L 22 29 L 22 28 z M 27 15 L 27 16 L 28 16 L 28 15 z M 17 16 L 17 17 L 18 17 L 18 16 z M 26 19 L 26 20 L 27 20 L 27 19 z M 23 20 L 23 21 L 24 21 L 24 20 z M 18 7 L 18 8 L 19 8 L 19 7 z M 18 24 L 18 25 L 19 25 L 19 24 z M 16 24 L 16 25 L 17 25 L 17 24 z M 15 11 L 15 12 L 16 12 L 16 11 z M 12 12 L 12 13 L 13 13 L 13 12 z M 10 12 L 10 13 L 11 13 L 11 12 z M 8 12 L 8 13 L 9 13 L 9 12 z M 7 16 L 7 17 L 8 17 L 8 16 z M 5 16 L 5 17 L 6 17 L 6 16 z M 4 17 L 4 18 L 5 18 L 5 17 z M 19 15 L 19 16 L 20 16 L 20 15 z M 28 18 L 28 19 L 29 19 L 29 18 z M 17 15 L 17 16 L 18 16 L 18 15 z M 26 18 L 26 19 L 27 19 L 27 18 z M 25 19 L 25 20 L 26 20 L 26 19 z M 23 19 L 23 20 L 24 20 L 24 19 z M 22 6 L 22 7 L 23 7 L 23 6 z M 20 23 L 20 24 L 21 24 L 21 23 z M 18 23 L 18 24 L 19 24 L 19 23 z M 14 11 L 14 12 L 15 12 L 15 11 z M 14 28 L 14 29 L 15 29 L 15 28 z M 12 28 L 12 29 L 13 29 L 13 28 z M 10 28 L 10 29 L 11 29 L 11 28 z M 9 15 L 9 16 L 10 16 L 10 15 z M 21 14 L 21 15 L 22 15 L 22 14 z M 19 14 L 19 15 L 20 15 L 20 14 z M 27 18 L 27 19 L 28 19 L 28 18 z M 25 18 L 25 19 L 26 19 L 26 18 z M 22 5 L 22 6 L 23 6 L 23 5 z M 24 22 L 24 23 L 25 23 L 25 22 z M 22 22 L 22 23 L 23 23 L 23 22 z M 20 22 L 20 23 L 21 23 L 21 22 z M 16 10 L 16 11 L 17 11 L 17 10 z M 14 10 L 14 11 L 15 11 L 15 10 z M 14 27 L 14 28 L 15 28 L 15 27 z M 13 14 L 13 15 L 14 15 L 14 14 z M 11 14 L 11 15 L 12 15 L 12 14 z M 9 14 L 9 15 L 10 15 L 10 14 z M 8 15 L 8 16 L 9 16 L 9 15 z M 27 17 L 27 18 L 28 18 L 28 17 z M 26 4 L 26 5 L 27 5 L 27 4 z M 24 4 L 24 5 L 25 5 L 25 4 z M 19 18 L 19 19 L 20 19 L 20 18 z M 17 18 L 17 19 L 18 19 L 18 18 z M 26 21 L 26 22 L 27 22 L 27 21 z M 24 21 L 24 22 L 25 22 L 25 21 z M 20 9 L 20 10 L 21 10 L 21 9 z M 18 9 L 18 10 L 19 10 L 19 9 z M 16 9 L 16 10 L 17 10 L 17 9 z M 18 26 L 18 27 L 19 27 L 19 26 z M 16 26 L 16 27 L 17 27 L 17 26 z M 15 13 L 15 14 L 16 14 L 16 13 z M 13 13 L 13 14 L 14 14 L 14 13 z M 12 14 L 12 15 L 13 15 L 13 14 z M 10 14 L 10 15 L 11 15 L 11 14 z M 8 14 L 8 15 L 9 15 L 9 14 z M 5 18 L 5 19 L 6 19 L 6 18 z M 4 19 L 4 20 L 5 20 L 5 19 z M 21 17 L 21 18 L 22 18 L 22 17 z M 19 17 L 19 18 L 20 18 L 20 17 z M 17 17 L 17 18 L 18 18 L 18 17 z M 26 20 L 26 21 L 27 21 L 27 20 z M 25 4 L 25 5 L 26 5 L 26 4 z M 23 4 L 23 5 L 24 5 L 24 4 z M 22 8 L 22 9 L 23 9 L 23 8 z M 20 8 L 20 9 L 21 9 L 21 8 z M 18 8 L 18 9 L 19 9 L 19 8 z M 22 25 L 22 26 L 23 26 L 23 25 z M 20 25 L 20 26 L 21 26 L 21 25 z M 18 25 L 18 26 L 19 26 L 19 25 z M 11 17 L 11 18 L 12 18 L 12 17 z M 9 17 L 9 18 L 10 18 L 10 17 z M 7 17 L 7 18 L 8 18 L 8 17 z M 4 18 L 4 19 L 5 19 L 5 18 z M 28 19 L 28 20 L 29 20 L 29 19 z M 27 20 L 27 21 L 28 21 L 28 20 z M 17 4 L 17 5 L 18 5 L 18 4 z M 24 7 L 24 8 L 25 8 L 25 7 z M 22 7 L 22 8 L 23 8 L 23 7 z M 20 7 L 20 8 L 21 8 L 21 7 z M 24 24 L 24 25 L 25 25 L 25 24 z M 22 24 L 22 25 L 23 25 L 23 24 z M 20 24 L 20 25 L 21 25 L 21 24 z M 16 12 L 16 13 L 17 13 L 17 12 z M 14 12 L 14 13 L 15 13 L 15 12 z M 9 16 L 9 17 L 10 17 L 10 16 z M 8 17 L 8 18 L 9 18 L 9 17 z M 6 17 L 6 18 L 7 18 L 7 17 z M 5 4 L 5 5 L 6 5 L 6 4 z M 26 6 L 26 7 L 27 7 L 27 6 z M 24 6 L 24 7 L 25 7 L 25 6 z M 24 23 L 24 24 L 25 24 L 25 23 z M 23 24 L 23 25 L 24 25 L 24 24 z M 20 11 L 20 12 L 21 12 L 21 11 z M 20 28 L 20 29 L 21 29 L 21 28 z M 18 28 L 18 29 L 19 29 L 19 28 z M 11 15 L 11 16 L 12 16 L 12 15 z M 12 16 L 12 17 L 13 17 L 13 16 z M 10 16 L 10 17 L 11 17 L 11 16 z M 4 4 L 4 5 L 5 5 L 5 4 z M 28 5 L 28 6 L 29 6 L 29 5 z M 21 19 L 21 20 L 22 20 L 22 19 z M 19 19 L 19 20 L 20 20 L 20 19 z M 28 22 L 28 23 L 29 23 L 29 22 z M 25 6 L 25 7 L 26 7 L 26 6 z M 22 10 L 22 11 L 23 11 L 23 10 z M 20 10 L 20 11 L 21 11 L 21 10 z M 18 10 L 18 11 L 19 11 L 19 10 z M 22 27 L 22 28 L 23 28 L 23 27 z M 18 27 L 18 28 L 19 28 L 19 27 z M 15 14 L 15 15 L 16 15 L 16 14 z M 12 15 L 12 16 L 13 16 L 13 15 z M 6 20 L 6 21 L 7 21 L 7 20 z M 4 20 L 4 21 L 5 21 L 5 20 z M 28 4 L 28 5 L 29 5 L 29 4 z M 17 6 L 17 7 L 18 7 L 18 6 z M 22 9 L 22 10 L 23 10 L 23 9 z M 24 26 L 24 27 L 25 27 L 25 26 z M 20 26 L 20 27 L 21 27 L 21 26 z M 16 14 L 16 15 L 17 15 L 17 14 z M 14 14 L 14 15 L 15 15 L 15 14 z M 13 18 L 13 19 L 14 19 L 14 18 z M 11 18 L 11 19 L 12 19 L 12 18 z M 9 18 L 9 19 L 10 19 L 10 18 z M 8 19 L 8 20 L 9 20 L 9 19 z M 27 4 L 27 5 L 28 5 L 28 4 z M 27 21 L 27 22 L 28 22 L 28 21 z M 28 8 L 28 9 L 29 9 L 29 8 z M 26 8 L 26 9 L 27 9 L 27 8 z M 24 8 L 24 9 L 25 9 L 25 8 z M 20 13 L 20 14 L 21 14 L 21 13 z M 18 13 L 18 14 L 19 14 L 19 13 z M 16 13 L 16 14 L 17 14 L 17 13 z M 13 17 L 13 18 L 14 18 L 14 17 z M 10 18 L 10 19 L 11 19 L 11 18 z M 8 18 L 8 19 L 9 19 L 9 18 z" id="qr-path" /></svg>
\ No newline at end of file
......@@ -155,3 +155,8 @@ tutor()""")
def test__ivp(selenium):
# this is tested in test_hacked_modules.test_scipy via odeint
pass
def test_qrcode(selenium):
# already tested in test_hacked_modules
assert True
......@@ -23,3 +23,12 @@ def test_hack_modules(selenium):
f.write(data['stdout'])
with open(Path(__file__).parent / 'data' / 'modules.txt') as f:
assert data['stdout'] == f.read()
def test_hack_six(selenium):
data = selenium.run_basthon("""
from pathlib import Path
Path('/lib/python3.8/six.py').exists() and not Path('/lib/python3.8/site-packages/six.py').exists()""")
assert data['stderr'] == ""
assert data['result']['result']['text/plain'] == 'True'
......@@ -151,3 +151,16 @@ def test_scipy(selenium):
np.allclose(y[-1, :], y0)""")
assert result['result']['result']['text/plain'] == 'True'
def test_qrcode(selenium):
result = selenium.run_basthon("""
import qrcode
code = qrcode.make("https://basthon.fr/", format='svg')
code.show()
""")
assert result['stderr'] == ""
assert result['display']['display_type'] == 'multiple'
with open(_test_data / "qrcode-basthon.svg") as f:
assert result['display']['content']['image/svg+xml'] == f.read()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment