Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9d05e6b

Browse files
committed
MNT: do not use is and is not with literals
These will be syntax errors in the future.
1 parent c420ad8 commit 9d05e6b

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

trendvis/gridclass.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def set_stackposition(self, onespine_forboth):
186186
# Position list in the case of a stack of 1
187187
if self.stackdim == 1:
188188
if onespine_forboth:
189-
if self.mainax_id is 'x':
189+
if self.mainax_id == 'x':
190190
self.startpos = 'bottom'
191191
self.stackpos_list = [self.startpos]
192192
else:
@@ -396,7 +396,7 @@ def set_ax_visibility(self, ax, which, visible):
396396

397397
ax.spines[which].set_visible(visible)
398398

399-
if which is 'left' or which is 'right':
399+
if which == 'left' or which == 'right':
400400
if visible:
401401
ytick_dict = {'both' : {'left' : 'both',
402402
'right': 'both'},
@@ -432,7 +432,7 @@ def set_ax_visibility(self, ax, which, visible):
432432
ax.yaxis.set_tick_params(labelright=r, labelleft=f)
433433
self.grid_isclean = False
434434

435-
if which is 'top' or which is 'bottom':
435+
if which == 'top' or which == 'bottom':
436436
if visible:
437437
xtick_dict = {'both' : {'top' : 'both',
438438
'bottom': 'both'},
@@ -522,7 +522,7 @@ def set_xaxis_ticknum(self, axis, xticks, scale='linear'):
522522
523523
"""
524524

525-
if scale is 'linear':
525+
if scale == 'linear':
526526

527527
xmajor_loc = MultipleLocator(xticks[0])
528528
xminor_loc = MultipleLocator(xticks[1])
@@ -549,7 +549,7 @@ def set_yaxis_ticknum(self, axis, yticks, scale='linear'):
549549
550550
"""
551551

552-
if scale is 'linear':
552+
if scale == 'linear':
553553
ymajor_loc = MultipleLocator(yticks[0])
554554
yminor_loc = MultipleLocator(yticks[1])
555555

@@ -660,11 +660,11 @@ def draw_frame(self, lw='default', zorder=-1, edgecolor='black',
660660
last_instack = self.stackdim - 1
661661
patchlist = self.fig.patches
662662

663-
if lw is 'default':
663+
if lw == 'default':
664664
lw = self.spinewidth
665665

666666
for main in range(0, self.mainax_dim):
667-
if self.mainax_id is 'x':
667+
if self.mainax_id == 'x':
668668
ll_axis = self.axes[last_instack][main]
669669
ur_axis = self.axes[0][main]
670670
else:
@@ -724,7 +724,7 @@ def draw_bar(self, ll_axis, ur_axis, bar_limits, orientation='vertical',
724724
725725
"""
726726

727-
if orientation is 'vertical':
727+
if orientation == 'vertical':
728728
lldx, urdx = bar_limits
729729
lldy = ll_axis.get_ylim()[0]
730730
urdy = ur_axis.get_ylim()[1]
@@ -866,9 +866,9 @@ def _make_lists(self, dim, item, choice1, choice2):
866866
867867
"""
868868

869-
if item is 'none':
869+
if item == 'none':
870870
itemlist = [choice1] * dim
871-
elif item is 'all':
871+
elif item == 'all':
872872
itemlist = [choice2] * dim
873873
else:
874874
itemlist = []

trendvis/gridwrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ def make_grid(xratios, yratios, figsize, xticks, yticks, main_axis,
7575

7676
startside = startside_dict[mainax]
7777

78-
if mainax is 'y':
78+
if mainax == 'y':
7979
# Set up grid, grid formatting
8080
grid = XGrid(xratios, yratios, figsize, startside=startside,
8181
alternate_sides=True, onespine_forboth=False)
8282

83-
elif mainax is 'x':
83+
elif mainax == 'x':
8484
grid = YGrid(xratios, yratios, figsize, startside=startside,
8585
alternate_sides=True, onespine_forboth=False)
8686

trendvis/xgrid_ystack.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,9 @@ def set_all_ticknums(self, xticks, yticks, logxscale='none',
325325
for row, yt, ysc in zip(self.axes, yticks, yscale):
326326
for ax, xt, xsc in zip(row, xticks, xscale):
327327

328-
if yt is not None or ysc is 'log':
328+
if yt is not None or ysc == 'log':
329329
self.set_yaxis_ticknum(ax, yt, scale=ysc)
330-
if xt is not None or xsc is 'log':
330+
if xt is not None or xsc == 'log':
331331
self.set_xaxis_ticknum(ax, xt, scale=xsc)
332332

333333
def ticknum_format(self, ax='all', xformatter='%d', yformatter='%d'):
@@ -352,7 +352,7 @@ def ticknum_format(self, ax='all', xformatter='%d', yformatter='%d'):
352352
353353
"""
354354

355-
if ax is not 'all':
355+
if ax != 'all':
356356
if xformatter is not None:
357357
xfrmttr = FormatStrFormatter(xformatter)
358358
ax.xaxis.set_major_formatter(xfrmttr)
@@ -396,7 +396,7 @@ def reverse_yaxis(self, reverse_y='all', adjust_bar_frame=True):
396396
397397
"""
398398

399-
if reverse_y is 'all':
399+
if reverse_y == 'all':
400400
reverse_y = range(0, self.total_stackdim)
401401

402402
# Invert yaxis of first axis in each row
@@ -422,7 +422,7 @@ def reverse_xaxis(self, reverse_x='all', adjust_bar_frame=True):
422422
423423
"""
424424

425-
if reverse_x is 'all':
425+
if reverse_x == 'all':
426426
reverse_x = range(0, self.mainax_dim)
427427

428428
# Invert x axis of each axis in first row
@@ -552,16 +552,16 @@ def set_ticks(self, row='all', column='all', xy_axis='both', which='both',
552552
553553
"""
554554

555-
if row is 'all':
555+
if row == 'all':
556556
row = range(0, self.total_stackdim)
557-
if column is 'all':
557+
if column == 'all':
558558
column = range(0, self.mainax_dim)
559559

560-
if which is not 'major':
560+
if which != 'major':
561561
Grid._set_ticks(self, row, column, xy_axis, 'minor', minor_dim,
562562
labelsize, pad, minor_dir)
563563

564-
if which is not 'minor':
564+
if which != 'minor':
565565
Grid._set_ticks(self, row, column, xy_axis, 'major', major_dim,
566566
labelsize, pad, major_dir)
567567

@@ -600,7 +600,7 @@ def draw_cutout(self, di=0.025, lw='default', **kwargs):
600600

601601
low_ind = self.stackdim - 1
602602

603-
if lw is 'default':
603+
if lw == 'default':
604604
lw = self.spinewidth
605605

606606
top_ax = self.axes[0][0]

trendvis/ygrid_xstack.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,9 @@ def set_all_ticknums(self, xticks, yticks, logxscale='none',
325325
for col, xt, xsc in zip(self.axes, xticks, xscale):
326326
for ax, yt, ysc in zip(col, yticks, yscale):
327327

328-
if yt is not None or ysc is 'log':
328+
if yt is not None or ysc == 'log':
329329
self.set_yaxis_ticknum(ax, yt, scale=ysc)
330-
if xt is not None or xsc is 'log':
330+
if xt is not None or xsc == 'log':
331331
self.set_xaxis_ticknum(ax, xt, scale=xsc)
332332

333333
def ticknum_format(self, ax='all', xformatter='%d', yformatter='%d'):
@@ -352,7 +352,7 @@ def ticknum_format(self, ax='all', xformatter='%d', yformatter='%d'):
352352
353353
"""
354354

355-
if ax is not 'all':
355+
if ax != 'all':
356356
if xformatter is not None:
357357
xfrmttr = FormatStrFormatter(xformatter)
358358
ax.xaxis.set_major_formatter(xfrmttr)
@@ -396,7 +396,7 @@ def reverse_yaxis(self, reverse_y='all', adjust_bar_frame=True):
396396
397397
"""
398398

399-
if reverse_y is 'all':
399+
if reverse_y == 'all':
400400
reverse_y = range(0, self.mainax_dim)
401401

402402
# Invert y axis of each axis in the first column
@@ -422,7 +422,7 @@ def reverse_xaxis(self, reverse_x='all', adjust_bar_frame=True):
422422
423423
"""
424424

425-
if reverse_x is 'all':
425+
if reverse_x == 'all':
426426
reverse_x = range(0, self.total_stackdim)
427427

428428
# Invert x axis of first axis in each column
@@ -552,16 +552,16 @@ def set_ticks(self, row='all', column='all', xy_axis='both', which='both',
552552
553553
"""
554554

555-
if row is 'all':
555+
if row == 'all':
556556
row = range(0, self.mainax_dim)
557-
if column is 'all':
557+
if column == 'all':
558558
column = range(0, self.total_stackdim)
559559

560-
if which is not 'major':
560+
if which != 'major':
561561
Grid._set_ticks(self, column, row, xy_axis, 'minor', minor_dim,
562562
labelsize, pad, minor_tickdir)
563563

564-
if which is not 'minor':
564+
if which != 'minor':
565565
Grid._set_ticks(self, column, row, xy_axis, 'major', major_dim,
566566
labelsize, pad, major_tickdir)
567567

@@ -600,7 +600,7 @@ def draw_cutout(self, di=0.025, lw='default', **kwargs):
600600

601601
right_ind = self.stackdim - 1
602602

603-
if lw is 'default':
603+
if lw == 'default':
604604
lw = self.spinewidth
605605

606606
l_ax = self.axes[0][0]

0 commit comments

Comments
 (0)