PythonMonkey v1.1.1 (dev)
|
Functions | |
Union[Dict[str, int], bool] | statSync_inner (str filename) |
str | readFileSync (filename, charset) |
bool | existsSync (str filename) |
Dict | load (str filename) |
createRequire (filename, Union[List[str], Literal[False]] extraPaths=False, isMain=False) | |
runProgramModule (filename, argv, extraPaths=[]) | |
require (str moduleIdentifier) | |
Variables | |
node_modules | |
dict | evalOpts = {'filename': __file__, 'fromPythonFrame': True} |
encoding | |
globalThis = pm.eval("globalThis;", evalOpts) | |
pmEval | |
dir | |
isCompilableUnit | |
nodeModules | |
write | |
read | |
eval | |
exec | |
getenv | |
paths | |
exit | |
bootstrap = pm.eval(, evalOpts) | |
statSync_inner | |
readFileSync | |
existsSync | |
initCtxModule = pm.eval( + ctxModuleSource.read() + , {'filename': node_modules + "/ctx-module/ctx-module.js", 'lineno': 0}) | |
load | |
createRequireInner = pm.eval(, evalOpts) | |
requireFromDisk | |
inspect | |
pythonmonkey.require.createRequire | ( | filename, | |
Union[List[str], Literal[False]] | extraPaths = False , |
||
isMain = False |
|||
) |
returns a require function that resolves modules relative to the filename argument. Conceptually the same as node:module.createRequire(). example: from pythonmonkey import createRequire require = createRequire(__file__) require('./my-javascript-module')
bool pythonmonkey.require.existsSync | ( | str | filename | ) |
Dict pythonmonkey.require.load | ( | str | filename | ) |
Loads a python module using the importlib machinery sourcefileloader, prefills it with an exports object and returns the module. If the module is already loaded, returns it. Args: filename (str): The filename of the python module to load. Returns: : The loaded python module
str pythonmonkey.require.readFileSync | ( | filename, | |
charset | |||
) |
Utility function for reading files. Returns: str: The contents of the file
pythonmonkey.require.require | ( | str | moduleIdentifier | ) |
pythonmonkey.require.runProgramModule | ( | filename, | |
argv, | |||
extraPaths = [] |
|||
) |
Run the program module. This loads the code from disk, sets up the execution environment, and then invokes the program module (aka main module). The program module is different from other modules in that 1. it cannot return (must throw) 2. the outermost block scope is the global scope, effectively making its scope a super-global to other modules
Union[Dict[str, int], bool] pythonmonkey.require.statSync_inner | ( | str | filename | ) |
Inner function for statSync. Returns: Union[Dict[str, int], False]: The mode of the file or False if the file doesn't exist.
pythonmonkey.require.bootstrap = pm.eval(, evalOpts) |
pythonmonkey.require.createRequireInner = pm.eval(, evalOpts) |
pythonmonkey.require.dir |
pythonmonkey.require.encoding |
pythonmonkey.require.eval |
dict pythonmonkey.require.evalOpts = {'filename': __file__, 'fromPythonFrame': True} |
pythonmonkey.require.exec |
pythonmonkey.require.existsSync |
pythonmonkey.require.exit |
pythonmonkey.require.getenv |
pythonmonkey.require.globalThis = pm.eval("globalThis;", evalOpts) |
pythonmonkey.require.initCtxModule = pm.eval( + ctxModuleSource.read() + , {'filename': node_modules + "/ctx-module/ctx-module.js", 'lineno': 0}) |
pythonmonkey.require.inspect |
pythonmonkey.require.isCompilableUnit |
pythonmonkey.require.load |
pythonmonkey.require.node_modules |
pythonmonkey.require.nodeModules |
pythonmonkey.require.paths |
pythonmonkey.require.pmEval |
pythonmonkey.require.print |
pythonmonkey.require.read |
pythonmonkey.require.readFileSync |
pythonmonkey.require.requireFromDisk |
pythonmonkey.require.statSync_inner |
pythonmonkey.require.write |