Forked from YorikSar/openstack_foundation_affiliations.py
Created
October 2, 2012 18:01
-
-
Save openfly/3821777 to your computer and use it in GitHub Desktop.
A quick hack to tally OpenStack Member affiliations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pprint import pprint | |
from urllib2 import urlopen | |
from bs4 import BeautifulSoup | |
counts = {} | |
for letter in [chr(a) for a in xrange(ord('A'), ord('Z') + 1)] + ['intl']: | |
url = "http://www.openstack.org/community/members/?letter=%s" % (letter,) | |
soup = BeautifulSoup(urlopen(url).read()) | |
bullets = soup.find_all("li") | |
affiliations = [(x.text.split("(")[1].split(")")[0].lower().strip(), x.text) | |
for x in bullets if "(" in x.text] | |
for aff, name 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" | |
elif "mirantis" in aff: | |
aff = u"mirantis" | |
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]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment