Remove unnecessary bool() calls throughout project

Can use truthy values in boolean expressions without first coercing to a
bool. Removes unnecessary call to bool().
This commit is contained in:
Jon Dufresne 2017-12-16 09:33:04 -08:00
parent 92bb1b5f06
commit c5a0d72c10
3 changed files with 3 additions and 3 deletions

View File

@ -2753,7 +2753,7 @@ def registered_extensions():
Returns a dictionary containing all file extensions belonging Returns a dictionary containing all file extensions belonging
to registered plugins to registered plugins
""" """
if not bool(EXTENSION): if not EXTENSION:
init() init()
return EXTENSION return EXTENSION

View File

@ -165,7 +165,7 @@ class PillowTestCase(unittest.TestCase):
travis=None, interpreter=None): travis=None, interpreter=None):
# Skip if platform/travis matches, and # Skip if platform/travis matches, and
# PILLOW_RUN_KNOWN_BAD is not true in the environment. # PILLOW_RUN_KNOWN_BAD is not true in the environment.
if bool(os.environ.get('PILLOW_RUN_KNOWN_BAD', False)): if os.environ.get('PILLOW_RUN_KNOWN_BAD', False):
print(os.environ.get('PILLOW_RUN_KNOWN_BAD', False)) print(os.environ.get('PILLOW_RUN_KNOWN_BAD', False))
return return

View File

@ -312,7 +312,7 @@ class TestImage(PillowTestCase):
extensions = Image.registered_extensions() extensions = Image.registered_extensions()
# Assert # Assert
self.assertTrue(bool(extensions)) self.assertTrue(extensions)
for ext in ['.cur', '.icns', '.tif', '.tiff']: for ext in ['.cur', '.icns', '.tif', '.tiff']:
self.assertIn(ext, extensions) self.assertIn(ext, extensions)