import repository from arizona
[raven.git] / testscripts / scott / pacmanactive / signed / activecomon.5fafdafe7c17389b12d6986903d2839093d86b7d.groups.pacman
1 <?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>
2
3 <SIGNED_FILE SIGNEDHASH="c0a0a84445344c4d9b3d6b3059133d5d4b398a4b81d99f83a2a835f453bd5ae23e797a42d7c060d7bf441daaac98a943257a5b2f11b96f18243c9e91128ee52599655511a8e0e2a1fc93c53882ed3f869946ecd7570e3152f755d3bb136616bc15b77ccf34f238c68689203ea4666800ab8a8b034188aeec76e6b19880df7b74" PUBLICKEY="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBpjOnxEZMgR7Waqc7zKkmKatr2G2rKgWWTOvvzY2tgnHGapItRsaWMf1MQ4xgq36tDmlokSj9z7sgsdCOh5KV4myK0JmRj2KDSroFp2xCW0WlHccJL8Hc0p1/KRvT+fOTF2odg7zpPn55FEuwrKQkiZMLI1TcrOFkzicw20TiqwIDAQAB" SIGNATURE_ALGORITHM="-sha1">
4    <HEADER TIMESTAMP="1247120611" DURATION="0" PREFIX="activecomon" SUFFIX="pacman"/>
5    <FILE ENCODING="escaped">#!/usr/bin/python
6
7 import urllib2
8 import string
9 import sys
10
11 def comon(query):
12         
13         #   Formats the URL   #
14         ii = 0
15         commaNeeded = 0
16
17
18         if(query.find("'") == -1):
19                 #Finds select= and adds a ' after the =
20                 while (commaNeeded != 1 and ii &lt; len(query)-6): 
21                         if (query[ii:ii+7] == 'select='):
22                                 query = query[0:ii+7]+"'"+query[ii+7:] 
23                                 commaNeeded = 1
24                         ii += 1
25
26                 #If there is an option after select= 
27                 while(commaNeeded and ii &lt; len(query)-1):
28                         if (query[ii] == '&amp;' and query[ii+1] != '&amp;' and query[ii-1] != '&amp;'): #If we need to add a comma, look for a single &amp;
29                                 query = query[0:ii+1]+"'"+query[ii+1:0]
30                                 commaNeeded = 0
31                         ii += 1
32
33                 #Adds ' to the end if there are no other options after select=
34                 while(commaNeeded):
35                         query = query+"'"
36                         commaNeeded = 0
37
38                 # Replaces spaces with '%20' #
39                 query = query.replace(" ", "%20")
40
41         
42         ii = 0
43         output = ""
44         url1 = 'http://summer.cs.princeton.edu/status/tabulator.cgi?table=table_nodeviewshort&amp;format=nameonly&amp;'
45         url2 = query
46         url = url1 + url2
47         f = urllib2.urlopen(url)
48         s = f.read()
49         f.close()
50         
51         while ((s[0:11] == "query error") and (s[ii:ii+3] != "&lt;p&gt;")):
52                 output += s[ii]
53                 ii += 1
54         if(ii != 0):
55                 print output
56                 sys.exit(1)
57
58         return s
59
60 args = sys.argv
61
62 lowslices = comon("select='liveslices&lt;10'").split("\n")
63 highslices = comon("select='liveslices&gt;=10'").split("\n")
64
65 if args[2] in lowslices:
66     print "lowslices"
67
68 if args[2] in highslices:
69     print "highslices"
70
71 if (not (args[2] in lowslices)) and (not (args[2] in highslices)):
72     print "unknownslices"
73
74 </FILE>
75
76 </SIGNED_FILE>