Skip to content

Commit bb050f3

Browse files
committed
Update for Clean Code
Update for Clean Code - convert duplicated conditions to one line - remove unnecessary variable in loop
1 parent 3420d9e commit bb050f3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

python/visualizationCommand.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ def _vp_seaborn_show_values(axs, precision=1, space=0.01):
77
pstr = '{:.' + str(precision) + 'f}'
88

99
def _single(ax):
10-
# check orient
10+
# check orient / if 0
1111
orient = 'v'
12-
if len(ax.patches) == 1:
13-
# check if 0
14-
if ax.patches[0].get_x() == 0:
15-
orient = 'h'
12+
if len(ax.patches) == 1 and ax.patches[0].get_x() == 0:
13+
orient = 'h'
1614
else:
1715
# compare 0, 1 patches
1816
p0 = ax.patches[0]
@@ -36,7 +34,7 @@ def _single(ax):
3634
ax.text(_x, _y, value, ha='left')
3735

3836
if isinstance(axs, _vp_np.ndarray):
39-
for idx, ax in _vp_np.ndenumerate(axs):
37+
for _, ax in _vp_np.ndenumerate(axs):
4038
_single(ax)
4139
else:
4240
_single(axs)

0 commit comments

Comments
 (0)