projects
/
iramuteq
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
...+++...
[iramuteq]
/
functions.py
diff --git
a/functions.py
b/functions.py
index
8a10f67
..
90b380e
100644
(file)
--- a/
functions.py
+++ b/
functions.py
@@
-45,14
+45,17
@@
class History :
def read(self) :
d = shelve.open(self.filein)
self.history = d.get('history', [])
def read(self) :
d = shelve.open(self.filein)
self.history = d.get('history', [])
+ self.matrix = d.get('matrix', [])
self.ordercorpus = dict([[corpus['uuid'], i] for i, corpus in enumerate(self.history)])
self.ordercorpus = dict([[corpus['uuid'], i] for i, corpus in enumerate(self.history)])
- self.corpus = dict([[corpus['uuid'], corpus] for
i, corpus in enumerate(self.history)
])
+ self.corpus = dict([[corpus['uuid'], corpus] for
corpus in self.history
])
self.analyses = dict([[analyse['uuid'], analyse] for corpus in self.history for analyse in corpus.get('analyses', [])])
self.analyses = dict([[analyse['uuid'], analyse] for corpus in self.history for analyse in corpus.get('analyses', [])])
+ self.matrixanalyse = dict([[mat['uuid'], mat] for mat in self.matrix])
d.close()
def write(self) :
d = shelve.open(self.filein)
d['history'] = self.history
d.close()
def write(self) :
d = shelve.open(self.filein)
d['history'] = self.history
+ d['matrix'] = self.matrix
d.close()
def add(self, analyse) :
d.close()
def add(self, analyse) :
@@
-77,6
+80,13
@@
class History :
self.write()
self.read()
self.write()
self.read()
+ def addMatrix(self, analyse) :
+ tosave = {'uuid' : analyse['uuid'], 'ira': analyse['ira'], 'type' : analyse['type']}
+ tosave['name'] = analyse['name']
+ self.matrix.append(tosave)
+ self.write()
+ self.read()
+
def addmultiple(self, analyses) :
for analyse in analyses :
tosave = {'uuid' : analyse['uuid'], 'ira': analyse['ira'], 'type' : analyse['type']}
def addmultiple(self, analyses) :
for analyse in analyses :
tosave = {'uuid' : analyse['uuid'], 'ira': analyse['ira'], 'type' : analyse['type']}
@@
-96,9
+106,11
@@
class History :
self.history.pop(self.ordercorpus[analyse['uuid']])
if analyse['uuid'] in self.openedcorpus :
del self.openedcorpus[analyse['uuid']]
self.history.pop(self.ordercorpus[analyse['uuid']])
if analyse['uuid'] in self.openedcorpus :
del self.openedcorpus[analyse['uuid']]
- el
se
:
+ el
if analyse['uuid'] in self.analyses
:
todel = [i for i, ana in enumerate(self.corpus[analyse['corpus']]['analyses']) if ana['uuid'] == analyse['uuid']][0]
self.history[self.ordercorpus[analyse['corpus']]]['analyses'].pop(todel)
todel = [i for i, ana in enumerate(self.corpus[analyse['corpus']]['analyses']) if ana['uuid'] == analyse['uuid']][0]
self.history[self.ordercorpus[analyse['corpus']]]['analyses'].pop(todel)
+ elif analyse['uuid'] in self.matrixanalyse :
+ self.matrix = [mat for mat in self.matrix if mat['uuid'] != analyse['uuid']]
self.write()
self.read()
self.write()
self.read()
@@
-323,7
+335,10
@@
def GetTxtProfile(dictprofile, cluster_size) :
def formatExceptionInfo(maxTBlevel=5):
cla, exc, trbk = sys.exc_info()
def formatExceptionInfo(maxTBlevel=5):
cla, exc, trbk = sys.exc_info()
- excName = cla.__name__
+ try :
+ excName = cla.__name__
+ except :
+ excName = 'None'
try:
excArgs = exc.args[0]
except :
try:
excArgs = exc.args[0]
except :
@@
-527,25
+542,24
@@
def check_Rresult(parent, pid) :
if isinstance(pid, Popen) :
if pid.returncode != 0 :
error = pid.communicate()
if isinstance(pid, Popen) :
if pid.returncode != 0 :
error = pid.communicate()
- print error
error = [str(error[0]), error[1]]
if error[1] is None :
error[1] = 'None'
parent.Rerror = '\n'.join([str(pid.returncode), '\n'.join(error)])
error = [str(error[0]), error[1]]
if error[1] is None :
error[1] = 'None'
parent.Rerror = '\n'.join([str(pid.returncode), '\n'.join(error)])
- #try :
- raise Exception('\n'.join([u'Erreur R', '\n'.join(error[1:])]))
+ try :
+ raise Exception('\n'.join([u'Erreur R', '\n'.join(error[1:])]))
+ except :
+ BugReport(parent)
return False
return False
- #except :
- # BugReport(parent)
else :
return True
else :
if pid != 0 :
else :
return True
else :
if pid != 0 :
- #try :
- raise Exception(u'Erreur R')
+ try :
+ raise Exception(u'Erreur R')
+ except :
+ BugReport(parent)
return False
return False
- #except :
- # BugReport(parent)
else :
return True
else :
return True