ExtractCodeSources - Maple Help

Jupyter

 ExtractCodeSources
 extract code sources from a Jupyter notebook

 Calling Sequence ExtractCodeSources( input, opts )

Parameters

 input - string opts - (optional) options as described below

Options

 • source = one of file or string
 Specifies whether the notebook should be read from a file or a string. The default is file.

Description

 • ExtractCodeSources(input) extracts code sources from a Jupyter notebook given by input to a list of strings.

Examples

 > $\mathrm{with}\left(\mathrm{Jupyter}\right):$
 > $\mathrm{expr}≔2\mathrm{sin}\left(x+y\right)$
 ${\mathrm{expr}}{≔}{2}{}{\mathrm{sin}}{}\left({x}{+}{y}\right)$ (1)
 > $\mathrm{nbstring}≔\mathrm{CreateNotebook}\left(\mathrm{expr},\mathrm{target}=\mathrm{string}\right)$
 ${\mathrm{nbstring}}{≔}{"\left\{ "nbformat_minor": 4, "nbformat": 4, "metadata": \left\{ "language_info": \left\{ "name": "maple", "file_extension": ".mpl", "mimetype": "application/vnd.maple.mpl", "version": "2023" \right\}, "kernelspec": \left\{ "display_name": "Maple 2023", "language": "maple", "name": "maple" \right\} \right\}, "cells": \left[ \left\{ "cell_type": "code", "execution_count": null, "metadata": \left\{ \right\}, "source": \left[ "2*sin\left(x+y\right);" \right], "outputs": \left[ \right] \right\} \right] \right\}"}$ (2)
 > $\mathrm{ExtractCodeSources}\left(\mathrm{nbstring},\mathrm{source}=\mathrm{string}\right)$
 $\left[{"2*sin\left(x+y\right);"}\right]$ (3)

Compatibility

 • The Jupyter[ExtractCodeSources] command was introduced in Maple 2022.