2013-03-15 18:00:28 +01:00
|
|
|
#!/usr/bin/env hy
|
2013-04-28 16:31:31 +02:00
|
|
|
;; Copyright (c) Paul R. Tagliamonte <paultag@debian.org>, 2013 under the terms
|
|
|
|
;; of the Expat license, a copy of which you have should have recieved with
|
|
|
|
;; the source.
|
2013-03-15 18:00:28 +01:00
|
|
|
|
|
|
|
(import sys)
|
2013-04-20 16:06:32 +02:00
|
|
|
(import [sunlight [openstates]]
|
|
|
|
[collections [Counter]])
|
2013-03-15 18:00:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
(def *state* (get sys.argv 1))
|
|
|
|
|
|
|
|
|
|
|
|
(defn get-legislators [state]
|
|
|
|
(kwapply (.legislators openstates) {"state" state}))
|
|
|
|
|
|
|
|
|
|
|
|
(defn get-party-breakdown [state]
|
|
|
|
(Counter (map
|
2013-04-28 16:31:31 +02:00
|
|
|
(lambda [x] (get x "party"))
|
|
|
|
(get-legislators state))))
|
2013-03-15 18:00:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
(print *state* "-" (get-party-breakdown *state*))
|