Commit 49f5aa9c authored by Theresa Pollinger's avatar Theresa Pollinger
Browse files

get interval bounds

parent 77ef2b2f
...@@ -344,9 +344,9 @@ class Interview(cmd.Cmd): ...@@ -344,9 +344,9 @@ class Interview(cmd.Cmd):
if mmttype.inferred_type_to_string() != "type": if mmttype.inferred_type_to_string() != "type":
raise InterviewError("This seems to not be a type. It should be!") raise InterviewError("This seems to not be a type. It should be!")
result = self.mmtinterface.query_for(subdict["theoryname"]) # if not self.cheating else result = self.mmtinterface.query_for(subdict["theoryname"]) # if not self.cheating else
print(result.tostring()) #print(result.tostring())
subdict["name"] = domain_name subdict["name"] = domain_name
(fro, to) = mmtreply.getIntervalBoundaries(result, domain_name) if not self.cheating else (0.0, 1.0) # todo make work again (fro, to) = mmtreply.getIntervalBoundaries(result, domain_name) #if not self.cheating else (0.0, 1.0) # todo make work again
subdict["axes"]["x_1"] = "[" + str(fro) + ";" + str(to) + "]" subdict["axes"]["x_1"] = "[" + str(fro) + ";" + str(to) + "]"
(subdict["from"], subdict["to"]) = (fro, to) (subdict["from"], subdict["to"]) = (fro, to)
...@@ -892,7 +892,7 @@ class Interview(cmd.Cmd): ...@@ -892,7 +892,7 @@ class Interview(cmd.Cmd):
raise raise
def please_prompt(self, query, if_yes, if_no=None): def please_prompt(self, query, if_yes, if_no=None):
self.poutput(str(query) + " [Y/n]? ") self.poutput(str(query) + " [y/n]? ")
self.prompted = True self.prompted = True
self.if_yes = if_yes self.if_yes = if_yes
self.if_no = if_no self.if_no = if_no
...@@ -911,7 +911,6 @@ class Interview(cmd.Cmd): ...@@ -911,7 +911,6 @@ class Interview(cmd.Cmd):
# or use as input to callback an input processing fcn..? # or use as input to callback an input processing fcn..?
self.poutput("Please answer with Y/n") self.poutput("Please answer with Y/n")
return True return True
self.poutput(ret)
self.prompted = False self.prompted = False
if ret: if ret:
self.if_yes() self.if_yes()
......
...@@ -13,9 +13,9 @@ import _thread ...@@ -13,9 +13,9 @@ import _thread
# http://docs.python-requests.org/en/master/user/quickstart/ # http://docs.python-requests.org/en/master/user/quickstart/
import requests import requests
from requests.utils import quote from requests.utils import quote
from urllib.parse import urlencode # is what we actually want to use #from urllib.parse import urlencode # is what we actually want to use
from lxml import etree from lxml import etree
from openmath import openmath #from openmath import openmath
def run_mmt_server(): def run_mmt_server():
...@@ -113,12 +113,12 @@ class MMTReply: ...@@ -113,12 +113,12 @@ class MMTReply:
def getIntervalBoundaries(self, mmtreply, intervalname): def getIntervalBoundaries(self, mmtreply, intervalname):
child = mmtreply.getDefinition(intervalname) child = mmtreply.getDefinition(intervalname)
for oms in child.iter("{*}OMS"): for oms in child.iter("{*}OMS"):
# print("OMS: %s - %s - %s" % (oms, oms.text, oms.keys())) #print("OMS: %s - %s - %s" % (oms, oms.text, oms.keys()))
if (oms.get('name') == 'ccInterval'): if (oms.get('name') == 'interval'):
a = oms.getnext() a = oms.getnext()
b = a.getnext() b = a.getnext()
# print("a: %s - %s - %s" % (a, a.text, a.get('value'))) #print("a: %s - %s - %s" % (a, a.text, a.get('value')))
# print("b: %s - %s - %s" % (b, b.text, b.get('value'))) #print("b: %s - %s - %s" % (b, b.text, b.get('value')))
return (a.get('value'), b.get('value')) return (a.get('value'), b.get('value'))
def tostring(self): def tostring(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment