info.py (1165:234f3cdd541a) info.py (1269:419b73347a1e)
1from __future__ import division
2import operator, re, types
3
4source = None
5display_run = 0
6
7def issequence(t):
8 return isinstance(t, types.TupleType) or isinstance(t, types.ListType)

--- 33 unchanged lines hidden (view full) ---

42 if isinstance(lv, str):
43 return lv
44
45 if isinstance(rv, str):
46 return rv
47
48 return op(lv, rv)
49
1from __future__ import division
2import operator, re, types
3
4source = None
5display_run = 0
6
7def issequence(t):
8 return isinstance(t, types.TupleType) or isinstance(t, types.ListType)

--- 33 unchanged lines hidden (view full) ---

42 if isinstance(lv, str):
43 return lv
44
45 if isinstance(rv, str):
46 return rv
47
48 return op(lv, rv)
49
50def same(lv, rv):
51 for lrun,rrun in zip(lv.keys(),rv.keys()):
52 if lrun != rrun:
53 print 'lrun != rrun'
54 print lrun, rrun
55 print lv.keys()
56 print rv.keys()
50def same(lrun, rrun):
51 for lx,rx in zip(lrun.keys(),rrun.keys()):
52 if lx != rx:
53 print 'lx != rx'
54 print lx, rx
55 print lrun.keys()
56 print rrun.keys()
57 return False
57 return False
58 for lx,rx in zip(lv[lrun].keys(),rv[rrun].keys()):
59 if lx != rx:
60 print 'lx != rx'
61 print lx, rx
62 print lv[lrun].keys()
63 print rv[rrun].keys()
58 for ly,ry in zip(lrun[lx].keys(),rrun[rx].keys()):
59 if ly != ry:
60 print 'ly != ry'
61 print ly, ry
62 print lrun[lx].keys()
63 print rrun[rx].keys()
64 return False
64 return False
65 for ly,ry in zip(lv[lrun][lx].keys(),rv[rrun][rx].keys()):
66 if ly != ry:
67 print 'ly != ry'
68 print ly, ry
69 print lv[lrun][lx].keys()
70 print rv[rrun][rx].keys()
71 return False
72 return True
73
74
75def binaryop(op, lf, rf):
76 result = {}
77
78 if isinstance(lf, FormulaStat) and isinstance(rf, FormulaStat):
79 lv = lf.value
80 rv = rf.value
81
65 return True
66
67
68def binaryop(op, lf, rf):
69 result = {}
70
71 if isinstance(lf, FormulaStat) and isinstance(rf, FormulaStat):
72 lv = lf.value
73 rv = rf.value
74
82 if not same(lv, rv):
83 raise AttributeError, "run,x,y not identical"
75 theruns = []
76 for r in lv.keys():
77 if rv.has_key(r):
78 if same(lv[r], rv[r]):
79 theruns.append(r)
80 else:
81 raise AttributeError
84
82
85 for run in lv.keys():
83 for run in theruns:
86 result[run] = {}
87 for x in lv[run].keys():
88 result[run][x] = {}
89 for y in lv[run][x].keys():
90 result[run][x][y] = wrapop(op, lv[run][x][y],
91 rv[run][x][y])
92 elif isinstance(lf, FormulaStat):
93 lv = lf.value

--- 630 unchanged lines hidden ---
84 result[run] = {}
85 for x in lv[run].keys():
86 result[run][x] = {}
87 for y in lv[run][x].keys():
88 result[run][x][y] = wrapop(op, lv[run][x][y],
89 rv[run][x][y])
90 elif isinstance(lf, FormulaStat):
91 lv = lf.value

--- 630 unchanged lines hidden ---