PythonContext¶
-
class
stencila.PythonContext(*args, **kwargs)[source]¶ -
-
compile_func(func=None, file=None, dir=None)[source]¶ Compile a
funcoperationParses the source of the function (either a string or a file path) to extract it’s
description,param,returnetc properties.>>> context.compile_func({ >>> 'type': 'func', >>> 'source': 'def hello(who): return "Hello Hello %s!" % who' >>> }) { 'type': 'func', 'name': 'hello', 'source': 'def hello(): return "Hello Hello %s!" % who' 'params': [{ 'name': 'who' }], ... }
Parameters: func (dict or string) – A funcoperation. If a string is supplied then an operation object is created with thesourceproperty set to the string.Returns: - func (dict) – The compiled
funcoperation - messages (list) – A list of messages (e.g errors)
- func (dict) – The compiled
-
spec= {'client': 'ContextHttpClient', 'name': 'PythonContext'}¶
-