Remove some unnecesary uses of bool

This commit is contained in:
Alex Gaynor 2013-10-17 05:27:34 -07:00
parent a921f06345
commit 98788d3c3a
7 changed files with 7 additions and 7 deletions

View File

@ -86,7 +86,7 @@ class DataSource(GDALBase):
else: else:
raise OGRException('Invalid data source input type: %s' % type(ds_input)) raise OGRException('Invalid data source input type: %s' % type(ds_input))
if bool(ds): if ds:
self.ptr = ds self.ptr = ds
self.driver = Driver(ds_driver) self.driver = Driver(ds_driver)
else: else:

View File

@ -122,7 +122,7 @@ class OGRGeometry(GDALBase):
self.ptr = g self.ptr = g
# Assigning the SpatialReference object to the geometry, if valid. # Assigning the SpatialReference object to the geometry, if valid.
if bool(srs): if srs:
self.srs = srs self.srs = srs
# Setting the class depending upon the OGR Geometry Type # Setting the class depending upon the OGR Geometry Type

View File

@ -111,7 +111,7 @@ def check_pointer(result, func, cargs):
"Makes sure the result pointer is valid." "Makes sure the result pointer is valid."
if isinstance(result, six.integer_types): if isinstance(result, six.integer_types):
result = c_void_p(result) result = c_void_p(result)
if bool(result): if result:
return result return result
else: else:
raise OGRException('Invalid pointer returned from "%s"' % func.__name__) raise OGRException('Invalid pointer returned from "%s"' % func.__name__)

View File

@ -50,7 +50,7 @@ GeoIPRecord_delete.restype = None
# For retrieving records by name or address. # For retrieving records by name or address.
def check_record(result, func, cargs): def check_record(result, func, cargs):
if bool(result): if result:
# Checking the pointer to the C structure, if valid pull out elements # Checking the pointer to the C structure, if valid pull out elements
# into a dicionary. # into a dicionary.
rec = result.contents rec = result.contents

View File

@ -89,7 +89,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
# Invalid geometry type. # Invalid geometry type.
raise TypeError('Improper geometry input type: %s' % str(type(geo_input))) raise TypeError('Improper geometry input type: %s' % str(type(geo_input)))
if bool(g): if g:
# Setting the pointer object with a valid pointer. # Setting the pointer object with a valid pointer.
self.ptr = g self.ptr = g
else: else:

View File

@ -224,7 +224,7 @@ class WKBWriter(IOBase):
return bool(ord(wkb_writer_get_include_srid(self.ptr))) return bool(ord(wkb_writer_get_include_srid(self.ptr)))
def _set_include_srid(self, include): def _set_include_srid(self, include):
if bool(include): if include:
flag = b'\x01' flag = b'\x01'
else: else:
flag = b'\x00' flag = b'\x00'

View File

@ -120,7 +120,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
# It's possible to have the unique and PK constraints in separate indexes. # It's possible to have the unique and PK constraints in separate indexes.
if row[2] == 'PRIMARY': if row[2] == 'PRIMARY':
indexes[row[4]]['primary_key'] = True indexes[row[4]]['primary_key'] = True
if not bool(row[1]): if not row[1]:
indexes[row[4]]['unique'] = True indexes[row[4]]['unique'] = True
return indexes return indexes