2021-10-09 19:56:29 +02:00
|
|
|
# standard imports
|
|
|
|
import os
|
|
|
|
import json
|
2021-10-09 20:37:54 +02:00
|
|
|
import logging
|
2021-10-09 19:56:29 +02:00
|
|
|
|
|
|
|
# local imports
|
|
|
|
from .base import *
|
|
|
|
|
2021-10-09 20:37:54 +02:00
|
|
|
logg = logging.getLogger(__name__)
|
|
|
|
|
2021-10-09 19:56:29 +02:00
|
|
|
|
|
|
|
class Proof(Data):
|
|
|
|
|
|
|
|
def __init__(self, path='.'):
|
|
|
|
super(Proof, self).__init__()
|
|
|
|
self.namespace = 'ge'
|
|
|
|
self.description = None
|
|
|
|
self.path = path
|
|
|
|
self.proof_path = os.path.join(self.path, 'proof.json')
|
|
|
|
|
|
|
|
|
|
|
|
def load(self):
|
2021-10-09 20:37:54 +02:00
|
|
|
super(Proof, self).load()
|
2021-10-09 19:56:29 +02:00
|
|
|
|
2021-10-09 20:37:54 +02:00
|
|
|
f = open(self.proof_path, 'r')
|
|
|
|
o = json.load(f)
|
2021-10-09 19:56:29 +02:00
|
|
|
f.close()
|
|
|
|
|
2021-10-09 20:37:54 +02:00
|
|
|
self.set_version(o['version'])
|
2021-10-09 19:56:29 +02:00
|
|
|
self.description = o['description']
|
|
|
|
self.namespace = o['namespace']
|
|
|
|
|
|
|
|
self.inited = True
|
|
|
|
|
|
|
|
|
|
|
|
def start(self):
|
|
|
|
super(Proof, self).start()
|
|
|
|
|
|
|
|
proof_template_file_path = os.path.join(data_dir, 'proof_template_v{}.json'.format(self.version()))
|
|
|
|
|
|
|
|
f = open(proof_template_file_path)
|
|
|
|
o = json.load(f)
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
f = open(self.proof_path, 'w')
|
|
|
|
json.dump(o, f)
|
|
|
|
f.close()
|
|
|
|
|
2021-10-09 20:37:54 +02:00
|
|
|
|
2021-10-09 21:04:11 +02:00
|
|
|
|
2021-10-09 20:37:54 +02:00
|
|
|
def __str__(self):
|
|
|
|
return """description: {}
|
|
|
|
""".format(self.description)
|