-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathturtle_kernel.py
More file actions
44 lines (36 loc) · 1.27 KB
/
turtle_kernel.py
File metadata and controls
44 lines (36 loc) · 1.27 KB
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
from __future__ import print_function
from metakernel import MetaKernel
import sys
class TurtleKernel(MetaKernel):
implementation = 'MetaKernel Echo'
implementation_version = '1.0'
language = 'turtle'
language_version = '0.1'
banner = "MetaKernel Echo Turtle - as useful as a parrot speaking turtle"
language_info = {
'mimetype': 'text/turtle',
'name': 'turtle',
'codemirror_mode': {
'name': 'turtle'
},
'pygments_lexer': 'turtle',
'version' : "2007.02",
'file_extension': '.ttl',
}
kernel_json = {
'argv': [
sys.executable, '-m', 'turtle_kernel', '-f', '{connection_file}'],
'display_name': 'MetaKernel Turtle',
'language': 'turtle',
'name': 'turtle_kernel'
}
def get_usage(self):
return "This is the turtle echo kernel."
def do_execute_direct(self, code):
self.Print("@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.")
self.Print("@prefix exterms: <http://www.example.org/terms/>.")
self.Print("<http://www.example.org/index.html> exterms:creation-date \"August 16, 1999\".")
def repr(self, data):
return repr(data)
if __name__ == '__main__':
TurtleKernel.run_as_main()