Skip to content

Commit 2358d4a

Browse files
author
Paul Tagliamonte
committed
Fixing the broken examples.
1 parent 6d68423 commit 2358d4a

20 files changed

+53
-32
lines changed

examples/capitolwords/gingrich_words

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/usr/bin/env python
22

3+
from __future__ import print_function
34
from sunlight import capitolwords
45

56
newt = "G000225"
67

78
favorate_phrases = capitolwords.phrases( "legislator", "G000225", sort="count+desc")
89
for phrase in favorate_phrases:
9-
print "%s: %s" % ( phrase['ngram'], phrase['count'] )
10+
print( "%s: %s" % ( phrase['ngram'], phrase['count'] ))
1011

examples/capitolwords/internet_dates

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/usr/bin/env python
22

3+
from __future__ import print_function
34
from sunlight import capitolwords
45

5-
print "Internet was mentioned N times on the following days:"
6-
print ""
6+
print( "Internet was mentioned N times on the following days:" )
7+
print( "" )
78

89
for date in capitolwords.dates("internet"):
9-
print "%s - %s" % ( date['count'], date['day'] )
10+
print( "%s - %s" % ( date['count'], date['day'] ))
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22

3+
from __future__ import print_function
34
from sunlight import capitolwords
45

56
for phrase in capitolwords.phrases( "month", "201007", sort="count+desc" ):
6-
print "%s was used %s times" % ( phrase['ngram'], phrase['count'] )
7+
print( "%s was used %s times" % ( phrase['ngram'], phrase['count'] ))
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/usr/bin/env python
22

3+
from __future__ import print_function
34
from sunlight import capitolwords
45

56
for person in capitolwords.phrases_by_entity(
67
"legislator",
78
phrase="free market",
89
sort="count",
910
):
10-
print "Congress BioGuide ID: %s" % person['legislator']
11+
print( "Congress BioGuide ID: %s" % person['legislator'] )

examples/capitolwords/obama_records

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22

3+
from __future__ import print_function
34
from sunlight import capitolwords
45

56
for phrase in capitolwords.text( phrase="obama administration" ):
6-
print "%s mentions Obama on %s" % ( phrase['title'], phrase['date'] )
7+
print( "%s mentions Obama on %s" % ( phrase['title'], phrase['date'] ))

examples/congress/get_nacy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env python
22

3+
from __future__ import print_function
34
from sunlight import congress
45

56
nancy = congress.legislators( lastname="Pelosi" )[0]
6-
print "%s %s %s (%s)" % ( nancy['title'], nancy['firstname'],
7-
nancy['lastname'], nancy['party'] )
7+
print( "%s %s %s (%s)" % ( nancy['title'], nancy['firstname'],
8+
nancy['lastname'], nancy['party'] ))

examples/cross-api/free_market_lovers

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python
22

3+
from __future__ import print_function
34
from sunlight import capitolwords
45
from sunlight import congress
56

@@ -12,8 +13,8 @@ for person in capitolwords.phrases_by_entity(
1213
all_legislators="true" )
1314
if len(n) >= 1:
1415
n = n[0]
15-
print "%s %s %s (%s)" % (
16+
print( "%s %s %s (%s)" % (
1617
n['title'], n['firstname'], n['lastname'], n['party']
17-
)
18+
))
1819
else:
19-
print "Missing data on %s" % person['legislator']
20+
print( "Missing data on %s" % person['legislator'] )
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python
22

3+
from __future__ import print_function
34
from sunlight import influenceexplorer
45

56
contrib = influenceexplorer.contributions(
@@ -8,8 +9,8 @@ contrib = influenceexplorer.contributions(
89
cycle="2008" )
910

1011
for contributor in contrib:
11-
print "%s from %s contributed %s" % (
12+
print( "%s from %s contributed %s" % (
1213
contributor['contributor_name'],
1314
contributor['contributor_city'],
1415
contributor['amount']
15-
)
16+
))
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#!/usr/bin/env python
22

3+
from __future__ import print_function
34
from sunlight import influenceexplorer
45

56
grants = influenceexplorer.grants(
67
agency_ft="Homeland Security"
78
)
89

910
for grant in grants:
10-
print "%s to %s for %s" % (
11+
print( "%s to %s for %s" % (
1112
grant['total_funding_amount'],
1213
grant['recipient_name'],
1314
grant['project_description']
14-
)
15+
))
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python
22

3+
from __future__ import print_function
34
from sunlight import influenceexplorer
45

56
lobs = influenceexplorer.lobbying(
@@ -8,6 +9,6 @@ lobs = influenceexplorer.lobbying(
89
)
910

1011
for lob in lobs:
11-
print lob['registrant_name']
12+
print( lob['registrant_name'] )
1213
for issue in lob['issues']:
13-
print " %s (%s)" % ( issue['general_issue'], issue['specific_issue'] )
14+
print( " %s (%s)" % ( issue['general_issue'], issue['specific_issue'] ))

0 commit comments

Comments
 (0)