Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
bug fix related #5479 #6047
Conversation
mdboom
added the
needs_review
label
Feb 22, 2016
tacaswell
commented on an outdated diff
Feb 22, 2016
| @@ -410,7 +410,13 @@ def _do_cell_alignment(self): | ||
| def auto_set_column_width(self, col): | ||
| - self._autoColumns.append(col) | ||
| + # col is a list of column index | ||
| + if isinstance(col, list): |
tacaswell
Owner
|
|
I have change the format from type checking to exception checking. table.auto_set_column_width(-1) # Default input
table.auto_set_column_width([-1,0,1]) # List input
table.auto_set_column_width((-1,0,1)) # Tuple input |
tacaswell
commented on an outdated diff
Feb 23, 2016
| @@ -410,7 +410,14 @@ def _do_cell_alignment(self): | ||
| def auto_set_column_width(self, col): | ||
| - self._autoColumns.append(col) | ||
| + # check for col possibility on iteration | ||
| + try: | ||
| + iter(col) | ||
| + except (TypeError, AttributeError): | ||
| + self._autoColumns.append(col) | ||
| + else: | ||
| + for cell in col: |
|
|
ryanbelt
added some commits
Feb 23, 2016
|
I have just seen the comment from #6059. I am going to add the specific test case for this PR. |
ryanbelt
added some commits
Feb 26, 2016
|
@tacaswell , |
|
Strings are also iterable. Should that be also supported? |
tacaswell
added this to the
2.1 (next point release)
milestone
Feb 28, 2016
|
@dashed , inside the |
|
@ryanbelt Ah ok. Then should there be a test case for the behaviour you've just described? |
|
@dashed , thank you for the tips. Unexpected test case for iterable input as string has been added for this bug. |
dashed
commented on the diff
Feb 28, 2016
| @@ -410,7 +410,15 @@ def _do_cell_alignment(self): | ||
| def auto_set_column_width(self, col): | ||
| - self._autoColumns.append(col) | ||
| + # check for col possibility on iteration |
dashed
Contributor
|
|
@ryanbelt Awesome. |
tacaswell
added a commit
that referenced
this pull request
Mar 7, 2016
|
|
tacaswell |
963e51d
|
tacaswell
merged commit 963e51d
into matplotlib:master
Mar 7, 2016
tacaswell
removed the
needs_review
label
Mar 7, 2016
|
I'll leave that for @ryanbelt |
"""Given column indexs in either List, Tuple or int. Will be able to
autonatically set the columns into optimal sizes.
"""@tacaswell , |
|
@ryanbelt Make a new pull request. They are (more-or-less) free and the smaller the change, the easier it is to review. Could you also explain the meaning of the values that are expected to be passed in? |
ryanbelt commentedFeb 22, 2016
Table: auto_set_column_width not working #5479
As before, it append the whole parameter(col) into the
_autoColumnseven col is a list object.at table.py line 490 inside function
_update_position_auto_set_column_widthare not able to manipulate with the index number as list rather then int passed from line490.So, I decide to append number to _autoColumns as usual if and only if the parameter is integer. If it is a list, we will append each integer inside the parameter into
_autoColumns