Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Theresa Pollinger
MoSIS
Commits
0d1d0d49
Commit
0d1d0d49
authored
Apr 30, 2018
by
Theresa Pollinger
Browse files
fix for installation connection problem
parent
f9a2dcbe
Changes
3
Hide whitespace changes
Inline
Side-by-side
interview_kernel/install.py
View file @
0d1d0d49
...
...
@@ -18,7 +18,7 @@ def install_my_kernel_spec(user=True, prefix=None):
with
open
(
os
.
path
.
join
(
td
,
'kernel.json'
),
'w'
)
as
f
:
json
.
dump
(
kernel_json
,
f
,
sort_keys
=
True
)
try
:
interview
=
Interview
()
interview
=
Interview
(
True
)
with
open
(
os
.
path
.
join
(
td
,
'kernel.js'
),
'w'
)
as
f
:
# javascript code that sets an initial markdown cell in every new notebook
js
=
"""define(['base/js/namespace'], function(Jupyter)
...
...
interview_kernel/interview_kernel.py
View file @
0d1d0d49
...
...
@@ -58,9 +58,7 @@ Otherwise, you can always answer with \LaTeX-type input.
"""
#You can inspect the currently loaded MMT theories under http://localhost:43397 #TODO
def
__init__
(
self
,
**
kwargs
):
self
.
state_machine
=
pde_state_machine
.
PDE_States
(
self
.
poutput
,
self
.
update_prompt
,
self
.
please_prompt
,
self
.
display_html
)
def
__init__
(
self
,
install_run
=
False
,
**
kwargs
):
# call superclass constructor
super
(
Interview
,
self
).
__init__
(
**
kwargs
)
...
...
@@ -70,18 +68,26 @@ Otherwise, you can always answer with \LaTeX-type input.
# from metakernel import register_ipython_magics
# register_ipython_magics()
self
.
update_prompt
()
self
.
poutstring
=
""
# to collect string output to send
self
.
outstream_name
=
'stdout'
# already send some input to state machine, to capture initial output and have it displayed via kernel.js
self
.
state_machine
.
handle_state_dependent_input
(
"anything"
)
# TODO compatibility with not-notebook?
self
.
my_markdown_greeting
=
Interview
.
banner
+
self
.
poutstring
self
.
poutstring
=
""
self
.
state_machine
,
self
.
my_markdown_greeting
=
self
.
set_initial_message
(
install_run
)
self
.
update_prompt
()
# bokeh notebook setup
output_notebook
()
def
set_initial_message
(
self
,
install_run
=
False
):
# set it up -- without server communication capabilities if we are just installing
self
.
state_machine
=
pde_state_machine
.
PDE_States
(
self
.
poutput
,
self
.
update_prompt
,
self
.
please_prompt
,
self
.
display_html
,
install_run
)
# already send some input to state machine, to capture initial output and have it displayed via kernel.js
# / not displayed in the real thing
self
.
state_machine
.
handle_state_dependent_input
(
"anything"
)
# TODO compatibility with not-notebook?
my_markdown_greeting
=
Interview
.
banner
+
self
.
poutstring
self
.
poutstring
=
""
return
self
.
state_machine
,
my_markdown_greeting
def
poutput
(
self
,
text
,
outstream_name
=
'stdout'
):
"""Accumulate the output here"""
self
.
poutstring
+=
str
(
text
)
+
"
\n
"
...
...
interview_kernel/pde_state_machine.py
View file @
0d1d0d49
...
...
@@ -67,7 +67,8 @@ class CriticalSubdict():
class
PDE_States
:
"""Just a state machine using pytranisitions that walks our theory graph and creates ephemeral theories and views"""
def
__init__
(
self
,
output_function
,
after_state_change_function
,
prompt_function
,
display_html_function
=
None
):
def
__init__
(
self
,
output_function
,
after_state_change_function
,
prompt_function
,
display_html_function
=
None
,
install_run
=
False
):
# just act like we were getting the right replies from MMT
self
.
cheating
=
True
...
...
@@ -180,7 +181,13 @@ class PDE_States:
self
.
exaout
=
None
self
.
mmtinterface
=
MMTInterface
()
self
.
install_run
=
install_run
if
self
.
install_run
:
self
.
mmtinterface
=
None
else
:
self
.
mmtinterface
=
MMTInterface
()
#with MMTInterface() as self.mmtinterface:
"""Variables to signal callbacks depending on yes/no prompts"""
self
.
prompted
=
False
...
...
@@ -277,7 +284,9 @@ class PDE_States:
def
domain_mmt_preamble
(
self
):
# set the current MMT theoryname for parsing the input TODO use right dimension
self
.
simdata
[
self
.
state
][
"theoryname"
]
=
"ephdomain"
self
.
new_theory
(
self
.
simdata
[
self
.
state
][
"theoryname"
])
if
not
self
.
install_run
:
self
.
new_theory
(
self
.
simdata
[
self
.
state
][
"theoryname"
])
# (ok, root) = self.mmtinterface.query_for(self.simdata[self.state]["theoryname"])
def
domain_mmt_postamble
(
self
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment