Remove some unnecesary uses of bool
This commit is contained in:
parent
a921f06345
commit
98788d3c3a
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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__)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue