Use the new API

master
Salvo 'LtWorf' Tomaselli 2020-08-13 11:03:28 +07:00
parent be9fdd2e84
commit 87ec732d24
No known key found for this signature in database
GPG Key ID: B3A7CF0C801886CF
2 changed files with 8 additions and 5 deletions

@ -57,7 +57,7 @@ def load_relations():
print ("Loading relation %s with name %s..." % (i, relname))
rels[relname] = relation.Relation('%s%s' % (examples_path, i))
rels[relname] = relation.Relation.load('%s%s' % (examples_path, i))
print('done')
@ -163,7 +163,8 @@ def run_py_test(testname):
'''Runs a python test, which evaluates expressions directly rather than queries'''
print ("Running expression python test: " +
colorize(testname, COLOR_MAGENTA))
exp_result = None
result = None
try:
expr = readfile('%s%s.python' % (tests_path, testname))
@ -238,7 +239,7 @@ def run_test(testname):
o_result = None
try:
result_rel = relation.Relation('%s%s.result' % (tests_path, testname))
result_rel = relation.Relation.load('%s%s.result' % (tests_path, testname))
query = readfile('%s%s.query' % (tests_path, testname)).strip()
o_query = optimizer.optimize_all(query, rels)

@ -91,7 +91,7 @@ class UserInterface:
def load(self, filename: str, name: str) -> None:
'''Loads a relation from file, and gives it a name to
be used in subsequent queries.'''
rel = Relation(filename)
rel = Relation.load(filename)
self.set_relation(name, rel)
def unload(self, name: str) -> None:
@ -204,7 +204,7 @@ class UserInterface:
[varname =] query
to assign the result to a new relation
'''
r = Relation()
r = None
queries = query.split('\n')
for query in queries:
if query.strip() == '':
@ -219,4 +219,6 @@ class UserInterface:
query,
str(e)
))
if r is None:
raise Exception('No query executed')
return r