Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MoSIS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Attention: Maintenance on monday 19.04.2021 from 07:00 - 13:00 (Gitlab and Mattermost are offline!)
Open sidebar
Theresa Pollinger
MoSIS
Commits
0d1d0d49
Commit
0d1d0d49
authored
Apr 30, 2018
by
Theresa Pollinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for installation connection problem
parent
f9a2dcbe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
12 deletions
+27
-12
interview_kernel/install.py
interview_kernel/install.py
+1
-1
interview_kernel/interview_kernel.py
interview_kernel/interview_kernel.py
+14
-8
interview_kernel/pde_state_machine.py
interview_kernel/pde_state_machine.py
+12
-3
No files found.
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
Markdown
is supported
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