ATLAS Offline Software
Loading...
Searching...
No Matches
split_histdefs Namespace Reference

Functions

 compare_idline (_l1, _l2)
 ========================================================
 compare_textrange (_t1, _t2, _r1, _r2)
 compare_xyline (_l1, _l2)
 compare_hbuffs (blist)

Variables

 parser
 dest
 type
 required
 help
 args = parser.parse_args()
 infname1 = args.in_xml1.name
 ========================================================= main
 infname2 = args.in_xml2.name
str outfname_common = infname1.split(".")[0]+"_"+infname2.split(".")[0]+".xml"
str outfname_1only = infname1.split(".")[0]+"_only.xml"
str outfname_2only = infname2.split(".")[0]+"_only.xml"
str outfname_1diffrange = infname1.split(".")[0]+"_diffrange.xml"
str outfname_2diffrange = infname2.split(".")[0]+"_diffrange.xml"
str outfname_1difftext = infname1.split(".")[0]+"_difftext.xml"
str outfname_2difftext = infname2.split(".")[0]+"_difftext.xml"
 outf_common = open(outfname_common, 'w')
 outf_1only = open(outfname_1only, 'w')
 outf_2only = open(outfname_2only, 'w')
 outf_1diffrange = open(outfname_1diffrange, 'w')
 outf_2diffrange = open(outfname_2diffrange, 'w')
 outf_1difftext = open(outfname_1difftext, 'w')
 outf_2difftext = open(outfname_2difftext, 'w')
dict buff_comp_dict
list buff1 = []
list buff2 = []
 line = weed(line)
 handle all definitions in 1st file:
 id = get_val("id",line)
list buffs = [buff1,buff2]
 compvals = compare_hbuffs(buffs)

Function Documentation

◆ compare_hbuffs()

split_histdefs.compare_hbuffs ( blist)


Definition at line 62 of file split_histdefs.py.

62def compare_hbuffs(blist):
63 # strip definitions of comments
64 _buff1=(get_comm_def(blist[0])[1])
65 _buff2=(get_comm_def(blist[1])[1])
66
67 textdiff=False
68 rangediff=False
69
70 if not _buff1:
71 return [-1,2]
72 elif not _buff2:
73 return [1,-1]
74
75 test=compare_idline(_buff1[0],_buff2[0])
76 if ("error"==test):
77 return [-1,-1]
78 elif ("textdiff"==test):
79 textdiff=True
80
81 get_val("type",_buff1[0])
82 get_val("type",_buff2[0])
83
84 testx=compare_xyline(_buff1[1],_buff2[1])
85 testy=compare_xyline(_buff1[2],_buff2[2])
86 if ("error"==testx or "error"==testy):
87 return [-1,-1]
88 elif ("textdiff"==testx or "textdiff"==testy):
89 textdiff=True
90 elif ("rangediff"==testx or "rangediff"==testy):
91 rangediff=True
92 if rangediff:
93 return [3,4]
94 elif textdiff:
95 return [5,6]
96 else:
97 return [0,-1]

◆ compare_idline()

split_histdefs.compare_idline ( _l1,
_l2 )

========================================================

helpers

Definition at line 33 of file split_histdefs.py.

33def compare_idline(_l1,_l2):
34 _t1=[ get_val("id",_l1), get_val("type",_l1)]
35 _t2=[ get_val("id",_l2), get_val("type",_l2)]
36 check=compare_textrange(_t1,_t2,[],[])
37 if ("common"!=check):
38 return "error"
39 return compare_textrange(_t1,_t2,[],[])

◆ compare_textrange()

split_histdefs.compare_textrange ( _t1,
_t2,
_r1,
_r2 )


Definition at line 43 of file split_histdefs.py.

43def compare_textrange(_t1,_t2,_r1,_r2):
44 if (_r1!=_r2):
45 return "rangediff"
46 elif (_t1!=_t2):
47 return "textdiff"
48 else:
49 return "common"

◆ compare_xyline()

split_histdefs.compare_xyline ( _l1,
_l2 )


Definition at line 53 of file split_histdefs.py.

53def compare_xyline(_l1,_l2):
54 _t1=[get_val("title",_l1)]
55 _t2=[get_val("title",_l2)]
56 _r1=[get_val("lo",_l1),get_val("hi",_l1),get_val("n",_l1)]
57 _r2=[get_val("lo",_l2),get_val("hi",_l2),get_val("n",_l2)]
58 return compare_textrange(_t1,_t2,_r1,_r2)

Variable Documentation

◆ args

split_histdefs.args = parser.parse_args()

Definition at line 28 of file split_histdefs.py.

◆ buff1

list split_histdefs.buff1 = []



handle all definitions only in 2nd file:

Definition at line 140 of file split_histdefs.py.

◆ buff2

list split_histdefs.buff2 = []

Definition at line 141 of file split_histdefs.py.

◆ buff_comp_dict

dict split_histdefs.buff_comp_dict
Initial value:
1= {0:outf_common,
2 1:outf_1only,2:outf_2only,
3 3:outf_1diffrange,4:outf_2diffrange,
4 5:outf_1difftext,6:outf_2difftext}

helper dictionary for writing out results to the right files

Definition at line 134 of file split_histdefs.py.

◆ buffs

list split_histdefs.buffs = [buff1,buff2]

Definition at line 150 of file split_histdefs.py.

◆ compvals

split_histdefs.compvals = compare_hbuffs(buffs)

Definition at line 151 of file split_histdefs.py.

◆ dest

split_histdefs.dest

Definition at line 17 of file split_histdefs.py.

◆ help

split_histdefs.help

Definition at line 20 of file split_histdefs.py.

◆ id

split_histdefs.id = get_val("id",line)

Definition at line 146 of file split_histdefs.py.

◆ infname1

split_histdefs.infname1 = args.in_xml1.name

========================================================= main


Definition at line 102 of file split_histdefs.py.

◆ infname2

split_histdefs.infname2 = args.in_xml2.name

Definition at line 103 of file split_histdefs.py.

◆ line

split_histdefs.line = weed(line)

handle all definitions in 1st file:

Definition at line 145 of file split_histdefs.py.

◆ outf_1diffrange

split_histdefs.outf_1diffrange = open(outfname_1diffrange, 'w')

Definition at line 127 of file split_histdefs.py.

◆ outf_1difftext

split_histdefs.outf_1difftext = open(outfname_1difftext, 'w')

Definition at line 129 of file split_histdefs.py.

◆ outf_1only

split_histdefs.outf_1only = open(outfname_1only, 'w')

Definition at line 125 of file split_histdefs.py.

◆ outf_2diffrange

split_histdefs.outf_2diffrange = open(outfname_2diffrange, 'w')

Definition at line 128 of file split_histdefs.py.

◆ outf_2difftext

split_histdefs.outf_2difftext = open(outfname_2difftext, 'w')

Definition at line 130 of file split_histdefs.py.

◆ outf_2only

split_histdefs.outf_2only = open(outfname_2only, 'w')

Definition at line 126 of file split_histdefs.py.

◆ outf_common

split_histdefs.outf_common = open(outfname_common, 'w')

Definition at line 124 of file split_histdefs.py.

◆ outfname_1diffrange

str split_histdefs.outfname_1diffrange = infname1.split(".")[0]+"_diffrange.xml"

Definition at line 108 of file split_histdefs.py.

◆ outfname_1difftext

str split_histdefs.outfname_1difftext = infname1.split(".")[0]+"_difftext.xml"

Definition at line 110 of file split_histdefs.py.

◆ outfname_1only

str split_histdefs.outfname_1only = infname1.split(".")[0]+"_only.xml"

Definition at line 106 of file split_histdefs.py.

◆ outfname_2diffrange

str split_histdefs.outfname_2diffrange = infname2.split(".")[0]+"_diffrange.xml"

Definition at line 109 of file split_histdefs.py.

◆ outfname_2difftext

str split_histdefs.outfname_2difftext = infname2.split(".")[0]+"_difftext.xml"

Definition at line 111 of file split_histdefs.py.

◆ outfname_2only

str split_histdefs.outfname_2only = infname2.split(".")[0]+"_only.xml"

Definition at line 107 of file split_histdefs.py.

◆ outfname_common

str split_histdefs.outfname_common = infname1.split(".")[0]+"_"+infname2.split(".")[0]+".xml"

Definition at line 105 of file split_histdefs.py.

◆ parser

split_histdefs.parser
Initial value:
1= argparse.ArgumentParser(
2 description=
3)

Definition at line 9 of file split_histdefs.py.

◆ required

split_histdefs.required

Definition at line 19 of file split_histdefs.py.

◆ type

split_histdefs.type

Definition at line 18 of file split_histdefs.py.