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

Functions

 main ()

Variables

 parser = argparse.ArgumentParser(description="%prog [options]", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
 dest
 action
 default
 False
 help
 None
 args = parser.parse_args()
 IFileIn = args.IFile
 OFileIn = args.OFile
 ITxt = open(IFileIn).readlines()
 OTxt = open(OFileIn).readlines()
list Inewtokens = []
list Onewtokens = []

Function Documentation

◆ main()

CompareStatusIO.main ( )

Definition at line 20 of file CompareStatusIO.py.

20def main():
21 isPermanent=False
22 isHT=False
23 isStatus=False
24
25 if not (args.doStatus or args.doPermanent or args.doHT):
26 print "please specify doStatus, doPermanent, and/or doHT"
27 return
28
29 # figure out type we are comparing
30 for line in OTxt:
31 if "permanent Status" in line:
32 isPermanent=True
33 if "HT Status" in line:
34 isHT=True
35 if "Status" in line and not ("permanent" in line or "HT" in line):
36 isStatus=True
37 if (args.doPermanent and not isPermanent) or (args.doHT and not isHT) or (args.doStatus and not isStatus):
38 print "check your inputs, they don't have the requested Status type"
39 return
40
41 # loop through input
42 # FIXME: assuming the input only has one conditions type (HT or Permanent but not both)
43 for line in ITxt:
44 line=line.replace(" "," ")
45 line=line[0].replace(" ","")+line[1:] # remove leading spaces
46 line=line[:-1]+line[-1].replace(" ","") # remove trailing spaces
47 tokens=line.split(" ")
48 if len(tokens)<6:
49 if not "Status:" in tokens:
50 print "length not satisfied: ",tokens
51 continue
52 Inewtokens.append(line.split("\n")[0])
53
54 # loop through output to match input formatting
55 seenStart=False
56 seenEnd=False
57 for line in OTxt:
58 line=line.replace(" "," ")
59 line=line[0].replace(" ","")+line[1:] # remove leading spaces
60 if isPermanent or isStatus:
61 line=line.replace("257","1") # different formatting of "bad" straws
62 line=line[:-1]+line[-1].replace(" ","") # remove trailing spaces
63 if (isHT or isStatus) and "2" in line.split(" ")[-1].split("\n")[0]:
64 # ignore lines that end in 2 because they're Xe in StatusHT and alive in Status
65 continue
66 tokens=line.split(" ")
67 if args.doPermanent:
68 if (not seenEnd) and "permanent" in tokens:
69 seenStart=True
70 elif seenStart and "Status:" in tokens:
71 seenEnd=True
72 elif args.doHT:
73 if (not seenEnd) and "HT" in tokens:
74 seenStart=True
75 elif seenStart and "Status:" in tokens:
76 seenEnd=True
77 elif args.doStatus:
78 if (not seenEnd) and "Status:" in tokens and not ("HT" in tokens or "permanent" in tokens):
79 seenStart=True
80 elif seenStart and ("HT" in tokens or "permanent" in tokens):
81 seenEnd=True
82 if seenStart and not seenEnd:
83 if len(tokens)<6 :
84 if not "Status:" in tokens:
85 print "length not satisfied: ",tokens
86 continue
87 Onewtokens.append(tokens[0]+" " \
88 +tokens[2]+" " \
89 +tokens[4]+" " \
90 +tokens[3]+" " \
91 +tokens[1]+" " \
92 +tokens[5].split("\n")[0] \
93 )
94
95 print set(Inewtokens) ^ set(Onewtokens) # checking symmetric difference
96
STL class.
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:310
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177
int main()
Definition hello.cxx:18

Variable Documentation

◆ action

CompareStatusIO.action

Definition at line 4 of file CompareStatusIO.py.

◆ args

CompareStatusIO.args = parser.parse_args()

Definition at line 9 of file CompareStatusIO.py.

◆ default

CompareStatusIO.default

Definition at line 4 of file CompareStatusIO.py.

◆ dest

CompareStatusIO.dest

Definition at line 4 of file CompareStatusIO.py.

◆ False

CompareStatusIO.False

Definition at line 4 of file CompareStatusIO.py.

◆ help

CompareStatusIO.help

Definition at line 4 of file CompareStatusIO.py.

◆ IFileIn

CompareStatusIO.IFileIn = args.IFile

Definition at line 11 of file CompareStatusIO.py.

◆ Inewtokens

list CompareStatusIO.Inewtokens = []

Definition at line 17 of file CompareStatusIO.py.

◆ ITxt

CompareStatusIO.ITxt = open(IFileIn).readlines()

Definition at line 14 of file CompareStatusIO.py.

◆ None

CompareStatusIO.None

Definition at line 7 of file CompareStatusIO.py.

◆ OFileIn

CompareStatusIO.OFileIn = args.OFile

Definition at line 12 of file CompareStatusIO.py.

◆ Onewtokens

list CompareStatusIO.Onewtokens = []

Definition at line 18 of file CompareStatusIO.py.

◆ OTxt

CompareStatusIO.OTxt = open(OFileIn).readlines()

Definition at line 15 of file CompareStatusIO.py.

◆ parser

CompareStatusIO.parser = argparse.ArgumentParser(description="%prog [options]", formatter_class=argparse.ArgumentDefaultsHelpFormatter)

Definition at line 3 of file CompareStatusIO.py.