public

A quick hack to tally OpenStack Member affiliations

  • Download Gist
openstack_foundation_affiliations.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
from pprint import pprint
from urllib2 import urlopen
 
from bs4 import BeautifulSoup
 
 
soup = BeautifulSoup(urlopen("http://www.openstack.org/community/members/").read())
bullets = soup.find_all("li")
affiliations = [x.text.split("(")[1].split(")")[0].lower().strip()
for x in bullets if "(" in x.text]
counts = {}
for aff in affiliations:
if "rackspace" in aff or aff == "rax" or "racksapce" in aff:
aff = u"rackspace"
elif (aff is "none" or aff is "non" or aff is "na" or aff is "n/a"
or aff is "" or aff is "0" or aff is "none."):
aff = u""
elif "canonical" in aff:
aff = u"canonical"
elif "alcatel" in aff and "lucent" in aff:
aff = u"alcatel lucent"
elif "wikimedia" in aff:
aff = u"wikimedia"
elif "inktank" in aff:
aff = u"inktank"
elif "yahoo" in aff:
aff = u"yahoo"
elif "suse" in aff:
aff = u"suse"
elif "tipit" in aff:
aff = u"tipit"
elif "cloudscaling" in aff:
aff = u"cloudscaling"
elif "comcast" in aff:
aff = u"comcast"
elif aff.startswith("aptira"):
aff = u"aptira"
elif aff.startswith("ntt"):
aff = u"ntt"
elif aff.startswith("target"):
aff = u"target"
elif aff.startswith("switfstack"):
aff = u"switftstack"
elif aff.startswith("redhat") or aff.startswith("red hat"):
aff = u"red hat"
elif aff.startswith("piston cloud") or aff.startswith("pistoncloud"):
aff = u"piston cloud"
elif aff.startswith("opscode"):
aff = u"opscode"
elif aff.startswith("citrix"):
aff = u"citrix"
elif aff.startswith("dey storage"):
aff = u"dey storage"
elif aff.startswith("dell"):
aff = u"dell"
elif aff.startswith("zhaw"):
aff = u"zhaw"
elif aff.startswith("nicira"):
aff = u"nicira"
elif aff.startswith("nexenta"):
aff = u"nexenta"
elif aff.startswith("nebula"):
aff = u"nebula"
elif aff.startswith("morphlabs"):
aff = u"morphlabs"
elif aff.startswith("maldivica"):
aff = u"maldivica"
elif aff.startswith("cisco"):
aff = u"cisco"
elif aff.startswith("emc"):
aff = u"emc"
elif (aff.startswith("hp")
or " hp" in aff
or "hewllet" in aff
or "hewlett" in aff):
aff = u"hp"
ign = counts.setdefault(aff.lower(), 0)
counts[aff.lower()] += 1
 
 
# display the count data, number of members per organization
pprint(counts)
# list all the affiliations, sorted by highest representation
pprint(sorted([(v,k) for k, v in counts.items()], reverse=True))
# give the total number of affiliations recorded
print(len(counts))
# display the top 20
pprint(sorted([(v,k) for k, v in counts.items()], reverse=True)[:20])

I've adapted this gist to a new list on site there: https://gist.github.com/3403165
You can update your version from mine.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.