Skip to content

Commit

Permalink
Use 'is None' instead of equality
Browse files Browse the repository at this point in the history
  • Loading branch information
Descanonge committed Jan 13, 2021
1 parent 5f38bed commit 1b7dd42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tol_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ def __rainbow_discrete(self, lut=None):
'#90C987', '#CAE0AB', '#F7F056', '#F7CB45', '#F6C141',
'#F4A736', '#F1932D', '#EE8026', '#E8601C', '#E65518',
'#DC050C', '#A5170E', '#72190E', '#42150A']
if lut == None or lut < 1 or lut > 23:
indexes = [[9], [9, 25], [9, 17, 25], [9, 14, 17, 25],
[9, 13, 14, 17, 25], [9, 13, 14, 16, 17, 25],
[8, 9, 13, 14, 16, 17, 25], [8, 9, 13, 14, 16, 17, 22, 25],
Expand All @@ -235,6 +234,7 @@ def __rainbow_discrete(self, lut=None):
24, 25, 26, 27, 28],
[0, 1, 3, 4, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 20,
22, 24, 25, 26, 27, 28]]
if lut is None or lut < 1 or lut > 23:
lut = 22
self.cmap = discretemap(self.cname, [clrs[i] for i in indexes[lut-1]])
if lut == 23:
Expand Down Expand Up @@ -268,7 +268,7 @@ def tol_cmap(colormap=None, lut=None):
Parameter lut is ignored for all colormaps except 'rainbow_discrete'.
"""
obj = TOLcmaps()
if colormap == None:
if colormap is None:
return obj.namelist
if colormap not in obj.namelist:
colormap = 'rainbow_PuRd'
Expand All @@ -291,7 +291,7 @@ def tol_cset(colorset=None):
from collections import namedtuple

namelist = ('bright', 'high-contrast', 'vibrant', 'muted', 'light')
if colorset == None:
if colorset is None:
return namelist
if colorset not in namelist:
colorset = 'bright'
Expand Down

0 comments on commit 1b7dd42

Please sign in to comment.