PythonContext¶
-
class
stencila.
PythonContext
(*args, **kwargs)[source]¶ -
-
compile_func
(func=None, file=None, dir=None)[source]¶ Compile a
func
operationParses the source of the function (either a string or a file path) to extract it’s
description
,param
,return
etc 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 func
operation. If a string is supplied then an operation object is created with thesource
property set to the string.Returns: - func (dict) – The compiled
func
operation - messages (list) – A list of messages (e.g errors)
- func (dict) – The compiled
-
spec
= {'client': 'ContextHttpClient', 'name': 'PythonContext'}¶
-