Skip to content

Commit e8d8782

Browse files
committed
2to3 -f print
1 parent c1505df commit e8d8782

25 files changed

Lines changed: 281 additions & 256 deletions

samples-index.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
2929
The rest of the file is ignored when it comes to building the index.
3030
"""
31+
from __future__ import print_function
3132

3233
import httplib2
3334
import itertools
@@ -239,7 +240,7 @@ def main():
239240
</tr>""" % context)
240241
page.append('</table>\n')
241242

242-
print ''.join(page)
243+
print(''.join(page))
243244

244245

245246
if __name__ == '__main__':

samples/adexchangeseller/generate_report.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
2121
Tags: reports.generate
2222
"""
23+
from __future__ import print_function
2324

2425
__author__ = 'sgomes@google.com (Sérgio Gomes)'
2526

@@ -68,14 +69,14 @@ def main(argv):
6869
sys.exit(1)
6970
# Display headers.
7071
for header in result['headers']:
71-
print '%25s' % header['name'],
72-
print
72+
print('%25s' % header['name'], end=' ')
73+
print()
7374

7475
# Display results.
7576
for row in result['rows']:
7677
for column in row:
77-
print '%25s' % column,
78-
print
78+
print('%25s' % column, end=' ')
79+
print()
7980

8081
except client.AccessTokenRefreshError:
8182
print ('The credentials have been revoked or expired, please re-run the '

samples/adexchangeseller/generate_report_with_paging.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
2525
Tags: reports.generate
2626
"""
27+
from __future__ import print_function
2728

2829
__author__ = 'sgomes@google.com (Sérgio Gomes)'
2930

@@ -70,14 +71,14 @@ def main(argv):
7071
# If this is the first page, display the headers.
7172
if start_index == 0:
7273
for header in result['headers']:
73-
print '%25s' % header['name'],
74-
print
74+
print('%25s' % header['name'], end=' ')
75+
print()
7576

7677
# Display results for this page.
7778
for row in result['rows']:
7879
for column in row:
79-
print '%25s' % column,
80-
print
80+
print('%25s' % column, end=' ')
81+
print()
8182

8283
start_index += len(result['rows'])
8384

samples/adexchangeseller/get_all_ad_clients.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
1919
Tags: adclients.list
2020
"""
21+
from __future__ import print_function
2122

2223
__author__ = 'sgomes@google.com (Sérgio Gomes)'
2324

@@ -43,11 +44,11 @@ def main(argv):
4344
result = request.execute()
4445
ad_clients = result['items']
4546
for ad_client in ad_clients:
46-
print ('Ad client for product "%s" with ID "%s" was found. '
47-
% (ad_client['productCode'], ad_client['id']))
47+
print(('Ad client for product "%s" with ID "%s" was found. '
48+
% (ad_client['productCode'], ad_client['id'])))
4849

49-
print ('\tSupports reporting: %s' %
50-
(ad_client['supportsReporting'] and 'Yes' or 'No'))
50+
print(('\tSupports reporting: %s' %
51+
(ad_client['supportsReporting'] and 'Yes' or 'No')))
5152

5253
request = service.adclients().list_next(request, result)
5354

samples/adexchangeseller/get_all_ad_units.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
2121
Tags: adunits.list
2222
"""
23+
from __future__ import print_function
2324

2425
__author__ = 'sgomes@google.com (Sérgio Gomes)'
2526

@@ -54,8 +55,8 @@ def main(argv):
5455
result = request.execute()
5556
ad_units = result['items']
5657
for ad_unit in ad_units:
57-
print ('Ad unit with code "%s", name "%s" and status "%s" was found. ' %
58-
(ad_unit['code'], ad_unit['name'], ad_unit['status']))
58+
print(('Ad unit with code "%s", name "%s" and status "%s" was found. ' %
59+
(ad_unit['code'], ad_unit['name'], ad_unit['status'])))
5960

6061
request = service.adunits().list_next(request, result)
6162

samples/adexchangeseller/get_all_ad_units_for_custom_channel.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
2121
Tags: customchannels.adunits.list
2222
"""
23+
from __future__ import print_function
2324

2425
__author__ = 'sgomes@google.com (Sérgio Gomes)'
2526

@@ -59,8 +60,8 @@ def main(argv):
5960
result = request.execute()
6061
ad_units = result['items']
6162
for ad_unit in ad_units:
62-
print ('Ad unit with code "%s", name "%s" and status "%s" was found. ' %
63-
(ad_unit['code'], ad_unit['name'], ad_unit['status']))
63+
print(('Ad unit with code "%s", name "%s" and status "%s" was found. ' %
64+
(ad_unit['code'], ad_unit['name'], ad_unit['status'])))
6465

6566
request = service.adunits().list_next(request, result)
6667

samples/adexchangeseller/get_all_alerts.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
1919
Tags: alerts.list
2020
"""
21+
from __future__ import print_function
2122

2223
__author__ = 'sgomes@google.com (Sérgio Gomes)'
2324

@@ -43,10 +44,10 @@ def main(argv):
4344
if 'items' in result:
4445
alerts = result['items']
4546
for alert in alerts:
46-
print ('Alert id "%s" with severity "%s" and type "%s" was found. '
47-
% (alert['id'], alert['severity'], alert['type']))
47+
print(('Alert id "%s" with severity "%s" and type "%s" was found. '
48+
% (alert['id'], alert['severity'], alert['type'])))
4849
else:
49-
print 'No alerts found!'
50+
print('No alerts found!')
5051
except client.AccessTokenRefreshError:
5152
print ('The credentials have been revoked or expired, please re-run the '
5253
'application to re-authorize')

samples/adexchangeseller/get_all_custom_channels.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
2121
Tags: customchannels.list
2222
"""
23+
from __future__ import print_function
2324

2425
__author__ = 'sgomes@google.com (Sérgio Gomes)'
2526

@@ -54,20 +55,20 @@ def main(argv):
5455
result = request.execute()
5556
custom_channels = result['items']
5657
for custom_channel in custom_channels:
57-
print ('Custom channel with id "%s" and name "%s" was found. '
58-
% (custom_channel['id'], custom_channel['name']))
58+
print(('Custom channel with id "%s" and name "%s" was found. '
59+
% (custom_channel['id'], custom_channel['name'])))
5960

6061
if 'targetingInfo' in custom_channel:
61-
print ' Targeting info:'
62+
print(' Targeting info:')
6263
targeting_info = custom_channel['targetingInfo']
6364
if 'adsAppearOn' in targeting_info:
64-
print ' Ads appear on: %s' % targeting_info['adsAppearOn']
65+
print(' Ads appear on: %s' % targeting_info['adsAppearOn'])
6566
if 'location' in targeting_info:
66-
print ' Location: %s' % targeting_info['location']
67+
print(' Location: %s' % targeting_info['location'])
6768
if 'description' in targeting_info:
68-
print ' Description: %s' % targeting_info['description']
69+
print(' Description: %s' % targeting_info['description'])
6970
if 'siteLanguage' in targeting_info:
70-
print ' Site language: %s' % targeting_info['siteLanguage']
71+
print(' Site language: %s' % targeting_info['siteLanguage'])
7172

7273
request = service.customchannels().list_next(request, result)
7374

samples/adexchangeseller/get_all_custom_channels_for_ad_unit.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
2222
Tags: customchannels.list
2323
"""
24+
from __future__ import print_function
2425

2526
__author__ = 'sgomes@google.com (Sérgio Gomes)'
2627

@@ -62,20 +63,20 @@ def main(argv):
6263
result = request.execute()
6364
custom_channels = result['items']
6465
for custom_channel in custom_channels:
65-
print ('Custom channel with code "%s" and name "%s" was found. '
66-
% (custom_channel['code'], custom_channel['name']))
66+
print(('Custom channel with code "%s" and name "%s" was found. '
67+
% (custom_channel['code'], custom_channel['name'])))
6768

6869
if 'targetingInfo' in custom_channel:
69-
print ' Targeting info:'
70+
print(' Targeting info:')
7071
targeting_info = custom_channel['targetingInfo']
7172
if 'adsAppearOn' in targeting_info:
72-
print ' Ads appear on: %s' % targeting_info['adsAppearOn']
73+
print(' Ads appear on: %s' % targeting_info['adsAppearOn'])
7374
if 'location' in targeting_info:
74-
print ' Location: %s' % targeting_info['location']
75+
print(' Location: %s' % targeting_info['location'])
7576
if 'description' in targeting_info:
76-
print ' Description: %s' % targeting_info['description']
77+
print(' Description: %s' % targeting_info['description'])
7778
if 'siteLanguage' in targeting_info:
78-
print ' Site language: %s' % targeting_info['siteLanguage']
79+
print(' Site language: %s' % targeting_info['siteLanguage'])
7980

8081
request = service.customchannels().list_next(request, result)
8182

samples/adexchangeseller/get_all_dimensions.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
1919
Tags: metadata.dimensions.list
2020
"""
21+
from __future__ import print_function
2122

2223
__author__ = 'sgomes@google.com (Sérgio Gomes)'
2324

@@ -43,10 +44,10 @@ def main(argv):
4344
if 'items' in result:
4445
dimensions = result['items']
4546
for dimension in dimensions:
46-
print ('Dimension id "%s" for product(s): [%s] was found. '
47-
% (dimension['id'], ', '.join(dimension['supportedProducts'])))
47+
print(('Dimension id "%s" for product(s): [%s] was found. '
48+
% (dimension['id'], ', '.join(dimension['supportedProducts']))))
4849
else:
49-
print 'No dimensions found!'
50+
print('No dimensions found!')
5051
except client.AccessTokenRefreshError:
5152
print ('The credentials have been revoked or expired, please re-run the '
5253
'application to re-authorize')

0 commit comments

Comments
 (0)