diff --git a/django/contrib/gis/gdal/datasource.py b/django/contrib/gis/gdal/datasource.py index 53a185841b..0d7f78a735 100644 --- a/django/contrib/gis/gdal/datasource.py +++ b/django/contrib/gis/gdal/datasource.py @@ -86,7 +86,7 @@ class DataSource(GDALBase): else: raise OGRException('Invalid data source input type: %s' % type(ds_input)) - if bool(ds): + if ds: self.ptr = ds self.driver = Driver(ds_driver) else: diff --git a/django/contrib/gis/gdal/geometries.py b/django/contrib/gis/gdal/geometries.py index 139cebefac..f9b94ea7fd 100644 --- a/django/contrib/gis/gdal/geometries.py +++ b/django/contrib/gis/gdal/geometries.py @@ -122,7 +122,7 @@ class OGRGeometry(GDALBase): self.ptr = g # Assigning the SpatialReference object to the geometry, if valid. - if bool(srs): + if srs: self.srs = srs # Setting the class depending upon the OGR Geometry Type diff --git a/django/contrib/gis/gdal/prototypes/errcheck.py b/django/contrib/gis/gdal/prototypes/errcheck.py index 3006107e45..1dbd924ab5 100644 --- a/django/contrib/gis/gdal/prototypes/errcheck.py +++ b/django/contrib/gis/gdal/prototypes/errcheck.py @@ -111,7 +111,7 @@ def check_pointer(result, func, cargs): "Makes sure the result pointer is valid." if isinstance(result, six.integer_types): result = c_void_p(result) - if bool(result): + if result: return result else: raise OGRException('Invalid pointer returned from "%s"' % func.__name__) diff --git a/django/contrib/gis/geoip/prototypes.py b/django/contrib/gis/geoip/prototypes.py index b6d5fe9c50..6d55a1041b 100644 --- a/django/contrib/gis/geoip/prototypes.py +++ b/django/contrib/gis/geoip/prototypes.py @@ -50,7 +50,7 @@ GeoIPRecord_delete.restype = None # For retrieving records by name or address. def check_record(result, func, cargs): - if bool(result): + if result: # Checking the pointer to the C structure, if valid pull out elements # into a dicionary. rec = result.contents diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py index 2b31b08d38..7965fffa79 100644 --- a/django/contrib/gis/geos/geometry.py +++ b/django/contrib/gis/geos/geometry.py @@ -89,7 +89,7 @@ class GEOSGeometry(GEOSBase, ListMixin): # Invalid geometry type. raise TypeError('Improper geometry input type: %s' % str(type(geo_input))) - if bool(g): + if g: # Setting the pointer object with a valid pointer. self.ptr = g else: diff --git a/django/contrib/gis/geos/prototypes/io.py b/django/contrib/gis/geos/prototypes/io.py index ecc0e42e21..c7233f79fc 100644 --- a/django/contrib/gis/geos/prototypes/io.py +++ b/django/contrib/gis/geos/prototypes/io.py @@ -224,7 +224,7 @@ class WKBWriter(IOBase): return bool(ord(wkb_writer_get_include_srid(self.ptr))) def _set_include_srid(self, include): - if bool(include): + if include: flag = b'\x01' else: flag = b'\x00' diff --git a/django/db/backends/mysql/introspection.py b/django/db/backends/mysql/introspection.py index 6e3b8d4ea0..14aea3b475 100644 --- a/django/db/backends/mysql/introspection.py +++ b/django/db/backends/mysql/introspection.py @@ -120,7 +120,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): # It's possible to have the unique and PK constraints in separate indexes. if row[2] == 'PRIMARY': indexes[row[4]]['primary_key'] = True - if not bool(row[1]): + if not row[1]: indexes[row[4]]['unique'] = True return indexes