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

Skip to content

Commit b3c2148

Browse files
committed
improved coding style, removed unused imports
1 parent f5f44d9 commit b3c2148

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

lib/mpl_toolkits/axes_grid1/axes_grid.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33

4-
import six
5-
64
import matplotlib.cbook as cbook
75

86
import matplotlib.pyplot as plt
@@ -14,7 +12,7 @@
1412
import matplotlib.lines as mlines
1513
import matplotlib.ticker as ticker
1614

17-
from matplotlib.gridspec import SubplotSpec, GridSpec
15+
from matplotlib.gridspec import SubplotSpec
1816

1917
from .axes_divider import Size, SubplotDivider, LocatableAxes, Divider
2018

@@ -247,8 +245,8 @@ def __init__(self, fig,
247245
axes_class, axes_class_args = axes_class
248246

249247
self.axes_all = []
250-
self.axes_column = [[] for i in range(self._ncols)]
251-
self.axes_row = [[] for i in range(self._nrows)]
248+
self.axes_column = [[] for _ in range(self._ncols)]
249+
self.axes_row = [[] for _ in range(self._nrows)]
252250

253251
h = []
254252
v = []
@@ -270,8 +268,8 @@ def __init__(self, fig,
270268
rect = self._divider.get_position()
271269

272270
# reference axes
273-
self._column_refax = [None for i in range(self._ncols)]
274-
self._row_refax = [None for i in range(self._nrows)]
271+
self._column_refax = [None for _ in range(self._ncols)]
272+
self._row_refax = [None for _ in range(self._nrows)]
275273
self._refax = None
276274

277275
for i in range(self.ngrids):
@@ -330,9 +328,9 @@ def _update_locators(self):
330328
h = []
331329

332330
h_ax_pos = []
333-
h_cb_pos = []
331+
#h_cb_pos = []
334332

335-
for ax in self._column_refax:
333+
for _ in self._column_refax:
336334
#if h: h.append(Size.Fixed(self._axes_pad))
337335
if h:
338336
h.append(self._horiz_pad_size)
@@ -345,8 +343,8 @@ def _update_locators(self):
345343
v = []
346344

347345
v_ax_pos = []
348-
v_cb_pos = []
349-
for ax in self._row_refax[::-1]:
346+
v_cbI#_pos = []
347+
for _ in self._row_refax[::-1]:
350348
#if v: v.append(Size.Fixed(self._axes_pad))
351349
if v:
352350
v.append(self._vert_pad_size)
@@ -372,6 +370,10 @@ def _get_col_row(self, n):
372370

373371
return col, row
374372

373+
# Good to propagate __len__ if we have __getitem__
374+
def __len__(self):
375+
return len(self.axes_all)
376+
375377
def __getitem__(self, i):
376378
return self.axes_all[i]
377379

@@ -394,7 +396,7 @@ def get_axes_pad(self):
394396
"""
395397
get axes_pad
396398
397-
Returns
399+
Returns
398400
-------
399401
tuple
400402
Padding in inches, (horizontal pad, vertical pad)
@@ -561,8 +563,8 @@ def __init__(self, fig,
561563
axes_class, axes_class_args = axes_class
562564

563565
self.axes_all = []
564-
self.axes_column = [[] for i in range(self._ncols)]
565-
self.axes_row = [[] for i in range(self._nrows)]
566+
self.axes_column = [[] for _ in range(self._ncols)]
567+
self.axes_row = [[] for _ in range(self._nrows)]
566568

567569
self.cbar_axes = []
568570

@@ -586,8 +588,8 @@ def __init__(self, fig,
586588
rect = self._divider.get_position()
587589

588590
# reference axes
589-
self._column_refax = [None for i in range(self._ncols)]
590-
self._row_refax = [None for i in range(self._nrows)]
591+
self._column_refax = [None for _ in range(self._ncols)]
592+
self._row_refax = [None for _ in range(self._nrows)]
591593
self._refax = None
592594

593595
for i in range(self.ngrids):

0 commit comments

Comments
 (0)