Skip to content

Commit 596cb9c

Browse files
committed
Replaced print statement by print function (forward compatibility syntax).
1 parent fe43ad5 commit 596cb9c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+310
-310
lines changed

django/bin/profiling/gather_profile_stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def gather_stats(p):
2424
prof = stats.load(os.path.join(p, f))
2525
else:
2626
continue
27-
print "Processing %s" % f
27+
print("Processing %s" % f)
2828
if path in profiles:
2929
profiles[path].add(prof)
3030
else:

django/bin/unique-messages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def unique_messages():
1111
elif os.path.isdir('locale'):
1212
basedir = os.path.abspath('locale')
1313
else:
14-
print "This script should be run from the Django Git tree or your project or app tree."
14+
print("This script should be run from the Django Git tree or your project or app tree.")
1515
sys.exit(1)
1616

1717
for (dirpath, dirnames, filenames) in os.walk(basedir):

django/contrib/auth/management/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def create_permissions(app, created_models, verbosity, **kwargs):
5454
auth_app.Permission.objects.bulk_create(objs)
5555
if verbosity >= 2:
5656
for obj in objs:
57-
print "Adding permission '%s'" % obj
57+
print("Adding permission '%s'" % obj)
5858

5959

6060
def create_superuser(app, created_models, verbosity, db, **kwargs):

django/contrib/contenttypes/management.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def update_contenttypes(app, created_models, verbosity=2, **kwargs):
3939
])
4040
if verbosity >= 2:
4141
for ct in cts:
42-
print "Adding content type '%s | %s'" % (ct.app_label, ct.model)
42+
print("Adding content type '%s | %s'" % (ct.app_label, ct.model))
4343

4444
# Confirm that the content type is stale before deletion.
4545
if to_remove:
@@ -63,11 +63,11 @@ def update_contenttypes(app, created_models, verbosity=2, **kwargs):
6363
if ok_to_delete == 'yes':
6464
for ct in to_remove:
6565
if verbosity >= 2:
66-
print "Deleting stale content type '%s | %s'" % (ct.app_label, ct.model)
66+
print("Deleting stale content type '%s | %s'" % (ct.app_label, ct.model))
6767
ct.delete()
6868
else:
6969
if verbosity >= 2:
70-
print "Stale content types remain."
70+
print("Stale content types remain.")
7171

7272
def update_all_contenttypes(verbosity=2, **kwargs):
7373
for app in get_apps():

django/contrib/gis/db/backends/spatialite/creation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def create_test_db(self, verbosity=1, autoclobber=False):
2424
test_db_repr = ''
2525
if verbosity >= 2:
2626
test_db_repr = " ('%s')" % test_database_name
27-
print "Creating test database for alias '%s'%s..." % (self.connection.alias, test_db_repr)
27+
print("Creating test database for alias '%s'%s..." % (self.connection.alias, test_db_repr))
2828

2929
self._create_test_db(verbosity, autoclobber)
3030

django/contrib/gis/gdal/geometries.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,30 @@
1313
>>> from django.contrib.gis.gdal import OGRGeometry, OGRGeomType, SpatialReference
1414
>>> wkt1, wkt2 = 'POINT(-90 30)', 'POLYGON((0 0, 5 0, 5 5, 0 5)'
1515
>>> pnt = OGRGeometry(wkt1)
16-
>>> print pnt
16+
>>> print(pnt)
1717
POINT (-90 30)
1818
>>> mpnt = OGRGeometry(OGRGeomType('MultiPoint'), SpatialReference('WGS84'))
1919
>>> mpnt.add(wkt1)
2020
>>> mpnt.add(wkt1)
21-
>>> print mpnt
21+
>>> print(mpnt)
2222
MULTIPOINT (-90 30,-90 30)
23-
>>> print mpnt.srs.name
23+
>>> print(mpnt.srs.name)
2424
WGS 84
25-
>>> print mpnt.srs.proj
25+
>>> print(mpnt.srs.proj)
2626
+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
2727
>>> mpnt.transform_to(SpatialReference('NAD27'))
28-
>>> print mpnt.proj
28+
>>> print(mpnt.proj)
2929
+proj=longlat +ellps=clrk66 +datum=NAD27 +no_defs
30-
>>> print mpnt
30+
>>> print(mpnt)
3131
MULTIPOINT (-89.999930378602485 29.999797886557641,-89.999930378602485 29.999797886557641)
3232
3333
The OGRGeomType class is to make it easy to specify an OGR geometry type:
3434
>>> from django.contrib.gis.gdal import OGRGeomType
3535
>>> gt1 = OGRGeomType(3) # Using an integer for the type
3636
>>> gt2 = OGRGeomType('Polygon') # Using a string
3737
>>> gt3 = OGRGeomType('POLYGON') # It's case-insensitive
38-
>>> print gt1 == 3, gt1 == 'Polygon' # Equivalence works w/non-OGRGeomType objects
39-
True
38+
>>> print(gt1 == 3, gt1 == 'Polygon') # Equivalence works w/non-OGRGeomType objects
39+
True True
4040
"""
4141
# Python library requisites.
4242
import sys

django/contrib/gis/gdal/srs.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Example:
55
>>> from django.contrib.gis.gdal import SpatialReference
66
>>> srs = SpatialReference('WGS84')
7-
>>> print srs
7+
>>> print(srs)
88
GEOGCS["WGS 84",
99
DATUM["WGS_1984",
1010
SPHEROID["WGS 84",6378137,298.257223563,
@@ -16,14 +16,14 @@
1616
UNIT["degree",0.01745329251994328,
1717
AUTHORITY["EPSG","9122"]],
1818
AUTHORITY["EPSG","4326"]]
19-
>>> print srs.proj
19+
>>> print(srs.proj)
2020
+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
21-
>>> print srs.ellipsoid
21+
>>> print(srs.ellipsoid)
2222
(6378137.0, 6356752.3142451793, 298.25722356300003)
23-
>>> print srs.projected, srs.geographic
23+
>>> print(srs.projected, srs.geographic)
2424
False True
2525
>>> srs.import_epsg(32140)
26-
>>> print srs.name
26+
>>> print(srs.name)
2727
NAD83 / Texas South Central
2828
"""
2929
from ctypes import byref, c_char_p, c_int
@@ -103,19 +103,19 @@ def __getitem__(self, target):
103103
104104
>>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]')
105105
>>> srs = SpatialReference(wkt) # could also use 'WGS84', or 4326
106-
>>> print srs['GEOGCS']
106+
>>> print(srs['GEOGCS'])
107107
WGS 84
108-
>>> print srs['DATUM']
108+
>>> print(srs['DATUM'])
109109
WGS_1984
110-
>>> print srs['AUTHORITY']
110+
>>> print(srs['AUTHORITY'])
111111
EPSG
112-
>>> print srs['AUTHORITY', 1] # The authority value
112+
>>> print(srs['AUTHORITY', 1]) # The authority value
113113
4326
114-
>>> print srs['TOWGS84', 4] # the fourth value in this wkt
114+
>>> print(srs['TOWGS84', 4]) # the fourth value in this wkt
115115
0
116-
>>> print srs['UNIT|AUTHORITY'] # For the units authority, have to use the pipe symbole.
116+
>>> print(srs['UNIT|AUTHORITY']) # For the units authority, have to use the pipe symbole.
117117
EPSG
118-
>>> print srs['UNIT|AUTHORITY', 1] # The authority value for the untis
118+
>>> print(srs['UNIT|AUTHORITY', 1]) # The authority value for the untis
119119
9122
120120
"""
121121
if isinstance(target, tuple):

django/contrib/gis/gdal/tests/test_ds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test02_invalid_shp(self):
5959

6060
def test03a_layers(self):
6161
"Testing Data Source Layers."
62-
print "\nBEGIN - expecting out of range feature id error; safe to ignore.\n"
62+
print("\nBEGIN - expecting out of range feature id error; safe to ignore.\n")
6363
for source in ds_list:
6464
ds = DataSource(source.ds)
6565

@@ -108,7 +108,7 @@ def test03a_layers(self):
108108
# the feature values here while in this loop.
109109
for fld_name in fld_names:
110110
self.assertEqual(source.field_values[fld_name][i], feat.get(fld_name))
111-
print "\nEND - expecting out of range feature id error; safe to ignore."
111+
print("\nEND - expecting out of range feature id error; safe to ignore.")
112112

113113
def test03b_layer_slice(self):
114114
"Test indexing and slicing on Layers."

django/contrib/gis/gdal/tests/test_geom.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,15 @@ def test07b_closepolygons(self):
234234
# Both rings in this geometry are not closed.
235235
poly = OGRGeometry('POLYGON((0 0, 5 0, 5 5, 0 5), (1 1, 2 1, 2 2, 2 1))')
236236
self.assertEqual(8, poly.point_count)
237-
print "\nBEGIN - expecting IllegalArgumentException; safe to ignore.\n"
237+
print("\nBEGIN - expecting IllegalArgumentException; safe to ignore.\n")
238238
try:
239239
c = poly.centroid
240240
except OGRException:
241241
# Should raise an OGR exception, rings are not closed
242242
pass
243243
else:
244244
self.fail('Should have raised an OGRException!')
245-
print "\nEND - expecting IllegalArgumentException; safe to ignore.\n"
245+
print("\nEND - expecting IllegalArgumentException; safe to ignore.\n")
246246

247247
# Closing the rings -- doesn't work on GDAL versions 1.4.1 and below:
248248
# http://trac.osgeo.org/gdal/ticket/1673

django/contrib/gis/geos/tests/test_geos.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def test01c_kml(self):
134134
def test01d_errors(self):
135135
"Testing the Error handlers."
136136
# string-based
137-
print "\nBEGIN - expecting GEOS_ERROR; safe to ignore.\n"
137+
print("\nBEGIN - expecting GEOS_ERROR; safe to ignore.\n")
138138
for err in self.geometries.errors:
139139
try:
140140
g = fromstr(err.wkt)
@@ -144,7 +144,7 @@ def test01d_errors(self):
144144
# Bad WKB
145145
self.assertRaises(GEOSException, GEOSGeometry, buffer('0'))
146146

147-
print "\nEND - expecting GEOS_ERROR; safe to ignore.\n"
147+
print("\nEND - expecting GEOS_ERROR; safe to ignore.\n")
148148

149149
class NotAGeometry(object):
150150
pass
@@ -439,7 +439,7 @@ def test05a_polygons(self):
439439

440440
def test05b_multipolygons(self):
441441
"Testing MultiPolygon objects."
442-
print "\nBEGIN - expecting GEOS_NOTICE; safe to ignore.\n"
442+
print("\nBEGIN - expecting GEOS_NOTICE; safe to ignore.\n")
443443
prev = fromstr('POINT (0 0)')
444444
for mp in self.geometries.multipolygons:
445445
mpoly = fromstr(mp.wkt)
@@ -458,7 +458,7 @@ def test05b_multipolygons(self):
458458
self.assertEqual(p.valid, True)
459459
self.assertEqual(mpoly.wkt, MultiPolygon(*tuple(poly.clone() for poly in mpoly)).wkt)
460460

461-
print "\nEND - expecting GEOS_NOTICE; safe to ignore.\n"
461+
print("\nEND - expecting GEOS_NOTICE; safe to ignore.\n")
462462

463463
def test06a_memory_hijinks(self):
464464
"Testing Geometry __del__() on rings and polygons."
@@ -995,15 +995,15 @@ def test27_valid_reason(self):
995995
self.assertTrue(isinstance(g.valid_reason, basestring))
996996
self.assertEqual(g.valid_reason, "Valid Geometry")
997997

998-
print "\nBEGIN - expecting GEOS_NOTICE; safe to ignore.\n"
998+
print("\nBEGIN - expecting GEOS_NOTICE; safe to ignore.\n")
999999

10001000
g = GEOSGeometry("LINESTRING(0 0, 0 0)")
10011001

10021002
self.assertTrue(not g.valid)
10031003
self.assertTrue(isinstance(g.valid_reason, basestring))
10041004
self.assertTrue(g.valid_reason.startswith("Too few points in geometry component"))
10051005

1006-
print "\nEND - expecting GEOS_NOTICE; safe to ignore.\n"
1006+
print("\nEND - expecting GEOS_NOTICE; safe to ignore.\n")
10071007

10081008
def test28_geos_version(self):
10091009
"Testing the GEOS version regular expression."

0 commit comments

Comments
 (0)