File: metakernel_echo.py

package info (click to toggle)
metakernel 0.27.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,280 kB
  • sloc: python: 5,018; makefile: 207; sh: 27
file content (45 lines) | stat: -rw-r--r-- 1,172 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from __future__ import print_function

from metakernel import MetaKernel
import sys


class MetaKernelEcho(MetaKernel):
    implementation = 'MetaKernel Echo'
    implementation_version = '1.0'
    language = 'text'
    language_version = '0.1'
    banner = "MetaKernel Echo - as useful as a parrot"
    language_info = {
        'mimetype': 'text/plain',
        'name': 'text',
        # ------ If different from 'language':
        # 'codemirror_mode': {
        #    "version": 2,
        #    "name": "ipython"
        # }
        # 'pygments_lexer': 'language',
        # 'version'       : "x.y.z",
        'file_extension': '.txt',
        'help_links': MetaKernel.help_links,
    }
    kernel_json = {
        'argv': [
            sys.executable, '-m', 'metakernel_echo', '-f', '{connection_file}'],
        'display_name': 'MetaKernel Echo',
        'language': 'echo',
        'name': 'metakernel_echo'
    }

    def get_usage(self):
        return "This is the echo kernel."

    def do_execute_direct(self, code):
        return code.rstrip()

    def repr(self, data):
        return repr(data)


if __name__ == '__main__':
    MetaKernelEcho.run_as_main()