sku-pg
Version:
Skulpt is a Javascript implementation of Python 2.x. Python that runs in your browser!
1,500 lines (396 loc) • 20.2 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Namespace: Sk</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Namespace: Sk</h1>
<section>
<header>
<h2>
Sk
</h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="import.js.html">import.js</a>, <a href="import.js.html#line1">line 1</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Namespaces</h3>
<dl>
<dt><a href="Sk.abstr.html">abstr</a></dt>
<dd></dd>
<dt><a href="Sk.builtin.html">builtin</a></dt>
<dd></dd>
<dt><a href="Sk.builtin.html">builtin</a></dt>
<dd></dd>
<dt><a href="Sk.builtin.html">builtin</a></dt>
<dd></dd>
<dt><a href="Sk.ffi.html">ffi</a></dt>
<dd></dd>
<dt><a href="Sk.misceval.html">misceval</a></dt>
<dd></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".doOneTimeInitialization"><span class="type-signature">(static) </span>doOneTimeInitialization<span class="signature">()</span><span class="type-signature"> → {undefined}</span></h4>
<div class="description">
<p>Complete any initialization of Python classes which relies on internal
dependencies.</p>
<p>This includes making Python classes subclassable and ensuring that the
<a href="Sk.builtin.object.html">Sk.builtin.object</a> magic methods are wrapped inside Python functions.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="import.js.html">import.js</a>, <a href="import.js.html#line187">line 187</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">undefined</span>
</dd>
</dl>
<h4 class="name" id=".importMainWithBody"><span class="type-signature">(static) </span>importMainWithBody<span class="signature">(name, dumpJS, body, canSuspend)</span><span class="type-signature"></span></h4>
<div class="description">
<p><strong>Run Python Code in Skulpt</strong></p>
<p>When you want to hand Skulpt a string corresponding to a Python program this is the function.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>File name to use for messages related to this run</p></td>
</tr>
<tr>
<td class="name"><code>dumpJS</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>print out the compiled javascript</p></td>
</tr>
<tr>
<td class="name"><code>body</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Python Code</p></td>
</tr>
<tr>
<td class="name"><code>canSuspend</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Use Suspensions for async execution</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="import.js.html">import.js</a>, <a href="import.js.html#line512">line 512</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".importModule"><span class="type-signature">(static) </span>importModule<span class="signature">(name, dumpJS<span class="signature-attributes">opt</span>, canSuspend<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>the module name</p></td>
</tr>
<tr>
<td class="name"><code>dumpJS</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>print out the js code after compilation for debugging</p></td>
</tr>
<tr>
<td class="name"><code>canSuspend</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>can this function suspend and return a Suspension object?</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="import.js.html">import.js</a>, <a href="import.js.html#line485">line 485</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".importModuleInternal_"><span class="type-signature">(static) </span>importModuleInternal_<span class="signature">(name, dumpJS<span class="signature-attributes">opt</span>, modname<span class="signature-attributes">opt</span>, suppliedPyBody<span class="signature-attributes">opt</span>, canSuspend<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>name of module to import</p></td>
</tr>
<tr>
<td class="name"><code>dumpJS</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>whether to output the generated js code</p></td>
</tr>
<tr>
<td class="name"><code>modname</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>what to call the module after it's imported if
it's to be renamed (i.e. <strong>main</strong>)</p></td>
</tr>
<tr>
<td class="name"><code>suppliedPyBody</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>use as the body of the text for the module
rather than Sk.read'ing it.</p></td>
</tr>
<tr>
<td class="name"><code>canSuspend</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>whether we may return a Suspension object</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="import.js.html">import.js</a>, <a href="import.js.html#line274">line 274</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".importSearchPathForName"><span class="type-signature">(static) </span>importSearchPathForName<span class="signature">(name, ext, failok<span class="signature-attributes">opt</span>, canSuspend<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>to look for</p></td>
</tr>
<tr>
<td class="name"><code>ext</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>extension to use (.py or .js)</p></td>
</tr>
<tr>
<td class="name"><code>failok</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>will throw if not true</p></td>
</tr>
<tr>
<td class="name"><code>canSuspend</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>can we suspend?</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="import.js.html">import.js</a>, <a href="import.js.html#line117">line 117</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".importSetUpPath"><span class="type-signature">(static) </span>importSetUpPath<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>currently only pull once from Sk.syspath. User might want to change
from js or from py.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="import.js.html">import.js</a>, <a href="import.js.html#line240">line 240</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".str2number"><span class="type-signature">(static) </span>str2number<span class="signature">(s, base, parser, negater, fname)</span><span class="type-signature"> → {number}</span></h4>
<div class="description">
<p>Takes a JavaScript string and returns a number using the parser and negater
functions (for int/long right now)</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Javascript string to convert to a number.</p></td>
</tr>
<tr>
<td class="name"><code>base</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The base of the number.</p></td>
</tr>
<tr>
<td class="name"><code>parser</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>Function which should take
a string that is a postive number which only contains characters that are
valid in the given base and a base and return a number.</p></td>
</tr>
<tr>
<td class="name"><code>negater</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>Function which should take a
number and return its negation</p></td>
</tr>
<tr>
<td class="name"><code>fname</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The name of the calling function, to be used in error messages</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="int.js.html">int.js</a>, <a href="int.js.html#line1030">line 1030</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The number equivalent of the string in the given base</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Sk.abstr.iter-seqIter.html">seqIter</a></li><li><a href="Sk.builtin.bool.html">bool</a></li><li><a href="Sk.builtin.float_.html">float_</a></li><li><a href="Sk.builtin.func.html">func</a></li><li><a href="Sk.builtin.int_.html">int_</a></li><li><a href="Sk.builtin.none.html">none</a></li><li><a href="Sk.builtin.NotImplemented.html">NotImplemented</a></li><li><a href="Sk.builtin.numtype.html">numtype</a></li><li><a href="Sk.builtin.object.html">object</a></li><li><a href="Sk.builtin.seqtype.html">seqtype</a></li><li><a href="Sk.misceval.Suspension.html">Suspension</a></li></ul><h3>Namespaces</h3><ul><li><a href="Sk.html">Sk</a></li><li><a href="Sk.abstr.html">abstr</a></li><li><a href="Sk.builtin.html">builtin</a></li><li><a href="Sk.ffi.html">ffi</a></li><li><a href="Sk.misceval.html">misceval</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0</a> on Thu Aug 13 2015 08:14:27 GMT-0500 (CDT)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>