Skip to content
Create a gist now

Instantly share code, notes, and snippets.

A quick hack to tally OpenStack Member affiliations
from pprint import pprint
from urllib2 import urlopen
from bs4 import BeautifulSoup
soup = BeautifulSoup(urlopen("").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
# 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
# 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:
You can update your version from mine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.