This commit is contained in:
Vitor Santos Costa
2018-03-17 10:38:56 +00:00
parent c33a0d72db
commit cc6eca6903
30 changed files with 435 additions and 345 deletions

View File

@@ -2664,9 +2664,22 @@ class InteractiveShell(SingletonConfigurable):
print("go")
result = None
try:
result = self._yrun_cell(
raw_cell, store_history, silent, shell_futures)
import trace
tracer = trace.Trace(
#ignoredirs=[sys.prefix, sys.exec_prefix],
trace=1,
count=0)
# run the new command using the given tracer
#
result =tracer.runfunc(self._yrun_cell,
raw_cell, store_history,
silent, shell_futures)
# result = self._yrun_cell(
# raw_cell, store_history, silent, shell_futures)
finally:
print("ugh", self.events)
self.events.trigger('post_execute')
if not silent:
self.events.trigger('post_run_cell', result)

View File

@@ -62,9 +62,11 @@ blankc('\t').
streams(false) :-
% close( user_input),
close( user_error ),
close( user_output ).
flush_output,
forall(
stream_property( S, mode(_) ),
close(S)
).
streams(true) :-
% open('/python/input', read, _Input, [alias(user_input),bom(false)]),
open('/python/sys.stdout', append, _Output, [alias(user_output)]),

View File

@@ -39,6 +39,7 @@ completions = namedtuple('completions', 'txt self' )
errors = namedtuple('errors', 'self text' )
streams = namedtuple('streams', ' text' )
global engine
class YAPInputSplitter(InputSplitter):
"""An input splitter that recognizes all of iyap's special syntax."""
@@ -106,11 +107,10 @@ class YAPInputSplitter(InputSplitter):
def validQuery(self, text, engine, shell, line=None):
"""Return whether a legal query
"""
if text == shell.os:
if shell and text == shell.os:
return True
if not line:
line = text.rstrip()
(line, _, _, _)=self.shell.clean_end(line)
self.errors = []
engine.mgoal(errors(self, line),"user")
return self.errors != []
@@ -181,7 +181,7 @@ class YAPInputSplitter(InputSplitter):
if self.transformer_accumulating:
return True
else:
return self.validQuery(self.source, self.yapeng, self)
return self.validQuery(self.source, engine, self.shell)
def transform_cell(self, cell):
"""Process and translate a cell of input.
@@ -509,6 +509,8 @@ class YAPRun:
def __init__(self, shell):
self.shell = shell
self.yapeng = Engine()
global engine
engine = self.yapeng
self.yapeng.goal(use_module(library("jupyter")))
self.query = None
self.os = None
@@ -542,6 +544,7 @@ class YAPRun:
pg = jupyter_query( self, program, query)
self.query = self.yapeng.query( pg)
self.query.port = "call"
self.query.answer = {}
else:
self.query.port = "retry"
self.os = s