Skip to content

CLN: fix all flake8 warnings in pandas/io #12096

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

Closed
wants to merge 2 commits into from
Closed

Conversation

wesm
Copy link
Member

@wesm wesm commented Jan 20, 2016

I suppressed warnings in test_parsers.py because of the amount of literal strings in the file.

@@ -101,7 +100,8 @@ class ParserWarning(Warning):
keep_default_na : bool, default True
If na_values are specified and keep_default_na is False the default NaN
values are overridden, otherwise they're appended to
parse_dates : boolean, list of ints or names, list of lists, or dict, default False
parse_dates : boolean, list of ints or names, list of lists, or dict,
default False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as in one of the previous rounds. This 'default False' on the new line will give non-ideal results in the html docs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This begs a general question: what to do with parameters that accept a ton of different types of input? I don't think we are doing users any favors by making a long line listing them all out; it would be better to have a bulleted list below the parameter name if that will render properly in the docs. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this quite a bit. Many times, I find I spend quite a bit of time parsing the different possibilities.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if the options are clearly listed below (as is already a bit the case, only the bullet symbols are missing), a shorter type description is certainly OK. Eg boolean, list or dict, default False is certainly sufficient (and short enough)

@jreback jreback added the Code Style Code style, linting, code_checks label Jan 20, 2016
@jreback jreback added this to the 0.18.0 milestone Jan 20, 2016
@wesm
Copy link
Member Author

wesm commented Jan 20, 2016

@jreback can you give me a thumbs up to merge if the build passes?

@wesm
Copy link
Member Author

wesm commented Jan 20, 2016

or @jorisvandenbossche too. Nested lists in RST I think require the extra line break

num_format_str = self.datetime_format
elif isinstance(cell.val, datetime.date):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I guess. I just usually import datetime then directly reference this as IMHO it is more clear.

@jreback
Copy link
Contributor

jreback commented Jan 20, 2016

some minor comments. only issue is maybe we shouldn't touch.

io/data.py, io/wb.py & io/ga.py (and associated tests) and just put no qa at the top as these are deprecated.

@wesm
Copy link
Member Author

wesm commented Jan 20, 2016

I see; any harm in leaving them as is here or would you prefer I revert the changes?

@jreback
Copy link
Contributor

jreback commented Jan 20, 2016

in theory your changes should be fine for io/data.y & io/wb.py (except for sure revert the ga as those tests have not been run for quite some time and are essentially disabled).

just trying not to touch those until they are removed.

@jorisvandenbossche
Copy link
Member

@jreback I think we are not going to updat the ´io/data.py´ code anymore with changes that happen in pandas-datareader? (as we did in the beginning) If that is the case, I don't think there is any harm in leaving that file in here, otherwise I would say to revert (to more easily compare/update with pandas-datareader)

@jreback
Copy link
Contributor

jreback commented Jan 21, 2016

@jorisvandenbossche no it won't be updated. Just trying to not change it. These pep changes won't hurt, as they are tested, so really no big deal. (bigger deal is ga.py which in theory should still work as hasn't been touched).

* dict

* {'foo' : [1, 3]} -> parse columns 1, 3 as date and call result 'foo'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as you say, in principle rst needs blank lines if you use a nested list (but I am not sure how this is actually handled in the docstrings, should test that).
But in this case, as trade-off between looking nice in html and in plain text, I would maybe go without the nesting of the lists? (as now it takes quite some space in the plaintext version). Something like:

* boolean: If True -> try parsing the index.
* list of ints or names: If [1, 2, 3] -> try parsing columns 1, 2, 3 each as a separate date
  column.
* list of lists: If [[1, 3]] -> combine columns 1 and 3 and parse as a single date
  column.
* dict: {'foo' : [1, 3]} -> parse columns 1, 3 as date and call result 'foo'

@wesm
Copy link
Member Author

wesm commented Jan 21, 2016

OK, I unstaged the ga/wb/data changes and cleaned up the parse_dates bit of the docstring. Will merge once the build passes

@wesm wesm closed this in f5550e2 Jan 21, 2016
@wesm wesm deleted the style/io branch January 21, 2016 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants