-
-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Flake8 #428
Fix Flake8 #428
Conversation
@@ -123,7 +123,7 @@ def export_set_as_simple_table(cls, dataset, column_widths=None): | |||
lines = [] | |||
wrapper = TextWrapper() | |||
if column_widths is None: | |||
column_widths = _get_column_widths(dataset, pad_len=2) | |||
column_widths = cls._get_column_widths(dataset, pad_len=2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to have a separate PR for this, with a test to complete coverage of that line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could probably remove this whole if
block. I don't see how column_widths
can be None
.
The default value is None
in the method definition:
def export_set_as_simple_table(cls, dataset, column_widths=None):
But it's only called from one place in export_set
, and it includes a variable for column_widths
, so it won't default to None
:
if use_simple_table and not force_grid:
return cls.export_set_as_simple_table(dataset, column_widths)
else:
return cls.export_set_as_grid_table(dataset, column_widths)
Earlier in that method, it is set as:
column_widths = cls._get_column_widths(dataset, max_table_width)
Which will always return a list:
column_widths = [max(w, l) for w, l in zip(column_widths, word_lens)]
return column_widths
A similar thing happens for the similar if
block in export_set_as_grid_table
.
These are all in _rst.py
, the underscore denoting a private, internal code, and not part of the API.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, as the method itself is not prefixed with underscore, so if someone could very well call something like fmt = registry.get_format('rst'); fmt.export_set_as_simple_table(dataset)
without breaking private rules. No strong opinion, but I would tend to fix and test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There we go! #433
Let's not worry about Black for now, it's not essential. |
Fixes #401.
Includes #427, the first two commits. The others are new to this PR.
Flake8 found one bug: e3b445c
And one bit of old Python 2 code: 77c5488
Locally:
Also run as part of:
Also run as part of the CI lint jobs.