From 596cb9c7e287abbb98c64974fb4944d522cb6b5a Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 28 Apr 2012 18:02:01 +0200 Subject: Replaced print statement by print function (forward compatibility syntax). --- docs/ref/contrib/gis/db-api.txt | 2 +- docs/ref/contrib/gis/gdal.txt | 24 ++++++------- docs/ref/contrib/gis/geoquerysets.txt | 16 ++++----- docs/ref/contrib/gis/geos.txt | 2 +- docs/ref/contrib/gis/layermapping.txt | 8 ++--- docs/ref/contrib/gis/measure.txt | 22 ++++++------ docs/ref/contrib/gis/tutorial.txt | 24 ++++++------- docs/ref/contrib/syndication.txt | 2 +- docs/ref/forms/api.txt | 68 +++++++++++++++++------------------ docs/ref/forms/fields.txt | 14 ++++---- docs/ref/models/instances.txt | 2 +- docs/ref/models/querysets.txt | 6 ++-- docs/ref/template-response.txt | 6 ++-- docs/ref/templates/api.txt | 2 +- 14 files changed, 99 insertions(+), 99 deletions(-) (limited to 'docs/ref') diff --git a/docs/ref/contrib/gis/db-api.txt b/docs/ref/contrib/gis/db-api.txt index 45698dd669..4cf65e513e 100644 --- a/docs/ref/contrib/gis/db-api.txt +++ b/docs/ref/contrib/gis/db-api.txt @@ -76,7 +76,7 @@ transform procedure:: >>> z = Zipcode(code=78212, poly=poly_3084) >>> z.save() >>> from django.db import connection - >>> print connection.queries[-1]['sql'] # printing the last SQL statement executed (requires DEBUG=True) + >>> print(connection.queries[-1]['sql']) # printing the last SQL statement executed (requires DEBUG=True) INSERT INTO "geoapp_zipcode" ("code", "poly") VALUES (78212, ST_Transform(ST_GeomFromWKB('\\001 ... ', 3084), 4326)) Thus, geometry parameters may be passed in using the ``GEOSGeometry`` object, WKT diff --git a/docs/ref/contrib/gis/gdal.txt b/docs/ref/contrib/gis/gdal.txt index 77c7c07618..5cd6187c6c 100644 --- a/docs/ref/contrib/gis/gdal.txt +++ b/docs/ref/contrib/gis/gdal.txt @@ -114,7 +114,7 @@ __ http://www.gdal.org/ogr/ogr_formats.html information about each layer in a :class:`DataSource`:: >>> for layer in ds: - ... print 'Layer "%s": %i %ss' % (layer.name, len(layer), layer.geom_type.name) + ... print('Layer "%s": %i %ss' % (layer.name, len(layer), layer.geom_type.name)) ... Layer "cities": 3 Points @@ -200,7 +200,7 @@ __ http://www.gdal.org/ogr/ogr_formats.html Property that returns the :class:`SpatialReference` associated with this layer:: - >>> print layer.srs + >>> print(layer.srs) GEOGCS["GCS_WGS_1984", DATUM["WGS_1984", SPHEROID["WGS_1984",6378137,298.257223563]], @@ -220,9 +220,9 @@ __ http://www.gdal.org/ogr/ogr_formats.html other than ``None``, only features that intersect the filter will be returned when iterating over the layer:: - >>> print layer.spatial_filter + >>> print(layer.spatial_filter) None - >>> print len(layer) + >>> print(len(layer)) 3 >>> [feat.get('Name') for feat in layer] ['Pueblo', 'Lawrence', 'Houston'] @@ -814,7 +814,7 @@ systems and coordinate transformation:: >>> gt1 = OGRGeomType(3) # Using an integer for the type >>> gt2 = OGRGeomType('Polygon') # Using a string >>> gt3 = OGRGeomType('POLYGON') # It's case-insensitive - >>> print gt1 == 3, gt1 == 'Polygon' # Equivalence works w/non-OGRGeomType objects + >>> print(gt1 == 3, gt1 == 'Polygon') # Equivalence works w/non-OGRGeomType objects True True .. attribute:: name @@ -927,19 +927,19 @@ Coordinate System Objects >>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]') >>> srs = SpatialReference(wkt) # could also use 'WGS84', or 4326 - >>> print srs['GEOGCS'] + >>> print(srs['GEOGCS']) WGS 84 - >>> print srs['DATUM'] + >>> print(srs['DATUM']) WGS_1984 - >>> print srs['AUTHORITY'] + >>> print(srs['AUTHORITY']) EPSG - >>> print srs['AUTHORITY', 1] # The authority value + >>> print(srs['AUTHORITY', 1]) # The authority value 4326 - >>> print srs['TOWGS84', 4] # the fourth value in this wkt + >>> print(srs['TOWGS84', 4]) # the fourth value in this wkt 0 - >>> print srs['UNIT|AUTHORITY'] # For the units authority, have to use the pipe symbol. + >>> print(srs['UNIT|AUTHORITY']) # For the units authority, have to use the pipe symbol. EPSG - >>> print srs['UNIT|AUTHORITY', 1] # The authority value for the units + >>> print(srs['UNIT|AUTHORITY', 1]) # The authority value for the units 9122 .. method:: attr_value(target, index=0) diff --git a/docs/ref/contrib/gis/geoquerysets.txt b/docs/ref/contrib/gis/geoquerysets.txt index 832f21e3e7..5bc9ab1f64 100644 --- a/docs/ref/contrib/gis/geoquerysets.txt +++ b/docs/ref/contrib/gis/geoquerysets.txt @@ -714,7 +714,7 @@ the distance from the `Tasmanian`__ city of Hobart to every other :class:`PointField` in the ``AustraliaCity`` queryset is calculated:: >>> pnt = AustraliaCity.objects.get(name='Hobart').point - >>> for city in AustraliaCity.objects.distance(pnt): print city.name, city.distance + >>> for city in AustraliaCity.objects.distance(pnt): print(city.name, city.distance) Wollongong 990071.220408 m Shellharbour 972804.613941 m Thirroul 1002334.36351 m @@ -874,9 +874,9 @@ Example:: >>> qs = Zipcode.objects.all().transform() # Transforms to WGS84 >>> qs = Zipcode.objects.all().transform(32140) # Transforming to "NAD83 / Texas South Central" - >>> print qs[0].poly.srid + >>> print(qs[0].poly.srid) 32140 - >>> print qs[0].poly + >>> print(qs[0].poly) POLYGON ((234055.1698884720099159 4937796.9232223574072123 ... ``translate`` @@ -990,7 +990,7 @@ Attaches a ``gml`` attribute to every model in the queryset that contains the Example:: >>> qs = Zipcode.objects.all().gml() - >>> print qs[0].gml + >>> print(qs[0].gml) -147.78711,70.245363 ... -147.78711,70.245363 ===================== ===================================================== @@ -1023,7 +1023,7 @@ necessary. Example:: >>> qs = Zipcode.objects.all().kml() - >>> print qs[0].kml + >>> print(qs[0].kml) -103.04135,36.217596,0 ... -103.04135,36.217596,0 ===================== ===================================================== @@ -1128,7 +1128,7 @@ lower left coordinate and the upper right coordinate. Example:: >>> qs = City.objects.filter(name__in=('Houston', 'Dallas')) - >>> print qs.extent() + >>> print(qs.extent()) (-96.8016128540039, 29.7633724212646, -95.3631439208984, 32.782058715820) ``extent3d`` @@ -1146,7 +1146,7 @@ the lower left coordinate and upper right coordinate. Example:: >>> qs = City.objects.filter(name__in=('Houston', 'Dallas')) - >>> print qs.extent3d() + >>> print(qs.extent3d()) (-96.8016128540039, 29.7633724212646, 0, -95.3631439208984, 32.782058715820, 0) ``make_line`` @@ -1161,7 +1161,7 @@ Returns a ``LineString`` constructed from the point field geometries in the Example:: - >>> print City.objects.filter(name__in=('Houston', 'Dallas')).make_line() + >>> print(City.objects.filter(name__in=('Houston', 'Dallas')).make_line()) LINESTRING (-95.3631510000000020 29.7633739999999989, -96.8016109999999941 32.7820570000000018) ``unionagg`` diff --git a/docs/ref/contrib/gis/geos.txt b/docs/ref/contrib/gis/geos.txt index 9fceda32d0..d3d9fe4442 100644 --- a/docs/ref/contrib/gis/geos.txt +++ b/docs/ref/contrib/gis/geos.txt @@ -231,7 +231,7 @@ Property that may be used to retrieve or set the SRID associated with the geometry. For example:: >>> pnt = Point(5, 23) - >>> print pnt.srid + >>> print(pnt.srid) None >>> pnt.srid = 4326 >>> pnt.srid diff --git a/docs/ref/contrib/gis/layermapping.txt b/docs/ref/contrib/gis/layermapping.txt index b0fb29e77a..dd0a41cbc0 100644 --- a/docs/ref/contrib/gis/layermapping.txt +++ b/docs/ref/contrib/gis/layermapping.txt @@ -39,13 +39,13 @@ Example >>> from django.contrib.gis.gdal import DataSource >>> ds = DataSource('test_poly.shp') >>> layer = ds[0] - >>> print layer.fields # Exploring the fields in the layer, we only want the 'str' field. + >>> print(layer.fields) # Exploring the fields in the layer, we only want the 'str' field. ['float', 'int', 'str'] - >>> print len(layer) # getting the number of features in the layer (should be 3) + >>> print(len(layer)) # getting the number of features in the layer (should be 3) 3 - >>> print layer.geom_type # Should be 'Polygon' + >>> print(layer.geom_type) # Should be 'Polygon' Polygon - >>> print layer.srs # WGS84 in WKT + >>> print(layer.srs) # WGS84 in WKT GEOGCS["GCS_WGS_1984", DATUM["WGS_1984", SPHEROID["WGS_1984",6378137,298.257223563]], diff --git a/docs/ref/contrib/gis/measure.txt b/docs/ref/contrib/gis/measure.txt index 6971788b4e..699677a50c 100644 --- a/docs/ref/contrib/gis/measure.txt +++ b/docs/ref/contrib/gis/measure.txt @@ -22,41 +22,41 @@ instantiated in units of kilometers (``km``) and miles (``mi``):: >>> from django.contrib.gis.measure import Distance, D >>> d1 = Distance(km=5) - >>> print d1 + >>> print(d1) 5.0 km >>> d2 = D(mi=5) # `D` is an alias for `Distance` - >>> print d2 + >>> print(d2) 5.0 mi Conversions are easy, just access the preferred unit attribute to get a converted distance quantity:: - >>> print d1.mi # Converting 5 kilometers to miles + >>> print(d1.mi) # Converting 5 kilometers to miles 3.10685596119 - >>> print d2.km # Converting 5 miles to kilometers + >>> print(d2.km) # Converting 5 miles to kilometers 8.04672 Moreover, arithmetic operations may be performed between the distance objects:: - >>> print d1 + d2 # Adding 5 miles to 5 kilometers + >>> print(d1 + d2) # Adding 5 miles to 5 kilometers 13.04672 km - >>> print d2 - d1 # Subtracting 5 kilometers from 5 miles + >>> print(d2 - d1) # Subtracting 5 kilometers from 5 miles 1.89314403881 mi Two :class:`Distance` objects multiplied together will yield an :class:`Area` object, which uses squared units of measure:: >>> a = d1 * d2 # Returns an Area object. - >>> print a + >>> print(a) 40.2336 sq_km To determine what the attribute abbreviation of a unit is, the ``unit_attname`` class method may be used:: - >>> print Distance.unit_attname('US Survey Foot') + >>> print(Distance.unit_attname('US Survey Foot')) survey_ft - >>> print Distance.unit_attname('centimeter') + >>> print(Distance.unit_attname('centimeter')) cm .. _supported_units: @@ -127,7 +127,7 @@ Measurement API Returns the distance value in units corresponding to the given unit attribute. For example:: - >>> print dist.km + >>> print(dist.km) 8.04672 .. classmethod:: unit_attname(unit_name) @@ -159,7 +159,7 @@ Measurement API Returns the area value in units corresponding to the given unit attribute. For example:: - >>> print a.sq_km + >>> print(a.sq_km) 12.949940551680001 .. classmethod:: unit_attname(unit_name) diff --git a/docs/ref/contrib/gis/tutorial.txt b/docs/ref/contrib/gis/tutorial.txt index 34014d7be4..395eac1821 100644 --- a/docs/ref/contrib/gis/tutorial.txt +++ b/docs/ref/contrib/gis/tutorial.txt @@ -362,24 +362,24 @@ Now, the world borders shapefile may be opened using GeoDjango's >>> from django.contrib.gis.gdal import DataSource >>> ds = DataSource(world_shp) - >>> print ds + >>> print(ds) / ... /geodjango/world/data/TM_WORLD_BORDERS-0.3.shp (ESRI Shapefile) Data source objects can have different layers of geospatial features; however, shapefiles are only allowed to have one layer:: - >>> print len(ds) + >>> print(len(ds)) 1 >>> lyr = ds[0] - >>> print lyr + >>> print(lyr) TM_WORLD_BORDERS-0.3 You can see what the geometry type of the layer is and how many features it contains:: - >>> print lyr.geom_type + >>> print(lyr.geom_type) Polygon - >>> print len(lyr) + >>> print(len(lyr)) 246 .. note:: @@ -397,7 +397,7 @@ system associated with it -- if it does, the ``srs`` attribute will return a :class:`~django.contrib.gis.gdal.SpatialReference` object:: >>> srs = lyr.srs - >>> print srs + >>> print(srs) GEOGCS["GCS_WGS_1984", DATUM["WGS_1984", SPHEROID["WGS_1984",6378137.0,298.257223563]], @@ -413,7 +413,7 @@ latitude. In addition, shapefiles also support attribute fields that may contain additional data. Here are the fields on the World Borders layer: - >>> print lyr.fields + >>> print(lyr.fields) ['FIPS', 'ISO2', 'ISO3', 'UN', 'NAME', 'AREA', 'POP2005', 'REGION', 'SUBREGION', 'LON', 'LAT'] Here we are examining the OGR types (e.g., whether a field is an integer or @@ -428,7 +428,7 @@ feature's attribute fields (whose **values** are accessed via ``get()`` method):: >>> for feat in lyr: - ... print feat.get('NAME'), feat.geom.num_points + ... print(feat.get('NAME'), feat.geom.num_points) ... Guernsey 18 Jersey 26 @@ -443,16 +443,16 @@ method):: And individual features may be retrieved by their feature ID:: >>> feat = lyr[234] - >>> print feat.get('NAME') + >>> print(feat.get('NAME')) San Marino Here the boundary geometry for San Marino is extracted and looking exported to WKT and GeoJSON:: >>> geom = feat.geom - >>> print geom.wkt + >>> print(geom.wkt) POLYGON ((12.415798 43.957954,12.450554 ... - >>> print geom.json + >>> print(geom.json) { "type": "Polygon", "coordinates": [ [ [ 12.415798, 43.957954 ], [ 12.450554, 43.979721 ], ... @@ -659,7 +659,7 @@ in transformation SQL, allowing the developer to work at a higher level of abstraction:: >>> qs = WorldBorder.objects.filter(mpoly__intersects=pnt) - >>> print qs.query # Generating the SQL + >>> print(qs.query) # Generating the SQL SELECT "world_worldborder"."id", "world_worldborder"."name", "world_worldborder"."area", "world_worldborder"."pop2005", "world_worldborder"."fips", "world_worldborder"."iso2", "world_worldborder"."iso3", "world_worldborder"."un", "world_worldborder"."region", diff --git a/docs/ref/contrib/syndication.txt b/docs/ref/contrib/syndication.txt index 754ac5843b..76c176e7b3 100644 --- a/docs/ref/contrib/syndication.txt +++ b/docs/ref/contrib/syndication.txt @@ -891,7 +891,7 @@ For example, to create an Atom 1.0 feed and print it to standard output:: ... link=u"http://www.example.com/entries/1/", ... pubdate=datetime.now(), ... description=u"

Today I had a Vienna Beef hot dog. It was pink, plump and perfect.

") - >>> print f.writeString('UTF-8') + >>> print(f.writeString('UTF-8')) ... diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index 86b6bb453e..a866fc550c 100644 --- a/docs/ref/forms/api.txt +++ b/docs/ref/forms/api.txt @@ -161,7 +161,7 @@ and the latter gets precedence:: ... url = forms.URLField() ... comment = forms.CharField() >>> f = CommentForm(initial={'name': 'instance'}, auto_id=False) - >>> print f + >>> print(f) Name: Url: Comment: @@ -266,7 +266,7 @@ The second task of a ``Form`` object is to render itself as HTML. To do so, simply ``print`` it:: >>> f = ContactForm() - >>> print f + >>> print(f) @@ -283,7 +283,7 @@ include ``checked="checked"`` if appropriate:: ... 'sender': 'foo@example.com', ... 'cc_myself': True} >>> f = ContactForm(data) - >>> print f + >>> print(f) @@ -331,7 +331,7 @@ a form object, and each rendering method returns a Unicode object. >>> f = ContactForm() >>> f.as_p() u'

\n

\n

\n

' - >>> print f.as_p() + >>> print(f.as_p())

@@ -350,7 +350,7 @@ a form object, and each rendering method returns a Unicode object. >>> f = ContactForm() >>> f.as_ul() u'
  • \n
  • \n
  • \n
  • ' - >>> print f.as_ul() + >>> print(f.as_ul())
  • @@ -368,7 +368,7 @@ a form object, and each rendering method returns a Unicode object. >>> f = ContactForm() >>> f.as_table() u'\n\n\n' - >>> print f.as_table() + >>> print(f.as_table()) @@ -398,7 +398,7 @@ Once you've done that, rows will be given ``"error"`` and/or ``"required"`` classes, as needed. The HTML will look something like:: >>> f = ContactForm(data) - >>> print f.as_table() + >>> print(f.as_table()) ... ... ... @@ -426,17 +426,17 @@ If ``auto_id`` is ``False``, then the form output will not include ``