Namespaces
Methods
(static) doOneTimeInitialization() → {undefined}
Complete any initialization of Python classes which relies on internal dependencies.
This includes making Python classes subclassable and ensuring that the Sk.builtin.object magic methods are wrapped inside Python functions.
Returns:
- Type
- undefined
(static) importBuiltinWithBody(name, dumpJS, body, canSuspend)
Imports internal python files into the __builtin__
module. Used during startup
to compile and import all *.py files from the src/ directory.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | File name to use for messages related to this run |
dumpJS |
boolean | print out the compiled javascript |
body |
string | Python Code |
canSuspend |
boolean | Use Suspensions for async execution |
(static) importMainWithBody(name, dumpJS, body, canSuspend)
Run Python Code in Skulpt
When you want to hand Skulpt a string corresponding to a Python program this is the function.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | File name to use for messages related to this run |
dumpJS |
boolean | print out the compiled javascript |
body |
string | Python Code |
canSuspend |
boolean | Use Suspensions for async execution |
(static) importModule(name, dumpJSopt, canSuspendopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | the module name |
|
dumpJS |
boolean |
<optional> |
print out the js code after compilation for debugging |
canSuspend |
boolean |
<optional> |
can this function suspend and return a Suspension object? |
(static) importModuleInternal_(name, dumpJSopt, modnameopt, suppliedPyBodyopt, relativeToPackageopt, returnUndefinedOnTopLevelNotFoundopt, canSuspendopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | name of module to import |
|
dumpJS |
boolean |
<optional> |
whether to output the generated js code |
modname |
string |
<optional> |
what to call the module after it's imported if it's to be renamed (i.e. main) |
suppliedPyBody |
string |
<optional> |
use as the body of the text for the module rather than Sk.read'ing it. |
relativeToPackage |
Object |
<optional> |
perform import relative to this package |
returnUndefinedOnTopLevelNotFound |
boolean |
<optional> |
return 'undefined' rather than throwing ImportError if the first load failed |
canSuspend |
boolean |
<optional> |
whether we may return a Suspension object |
(static) importSearchPathForName(name, ext, searchPathopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | to look for |
|
ext |
string | extension to use (.py or .js) |
|
searchPath |
Object |
<optional> |
an iterable set of path strings |
(static) importSetUpPath()
currently only pull once from Sk.syspath. User might want to change from js or from py.
(static) str2number(s, base, parser, negater, fname) → {number}
Takes a JavaScript string and returns a number using the parser and negater functions (for int/long right now)
Parameters:
Name | Type | Description |
---|---|---|
s |
string | Javascript string to convert to a number. |
base |
number | The base of the number. |
parser |
function | 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. |
negater |
function | Function which should take a number and return its negation |
fname |
string | The name of the calling function, to be used in error messages |
Returns:
The number equivalent of the string in the given base
- Type
- number