Skip to content

CLN: flake8 cleanup of core.internals #19202

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

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@jorisvandenbossche jorisvandenbossche changed the title flake8 cleanup of core.internals CLN: flake8 cleanup of core.internals Jan 12, 2018
@codecov
Copy link

codecov bot commented Jan 12, 2018

Codecov Report

Merging #19202 into master will increase coverage by 0.03%.
The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #19202      +/-   ##
==========================================
+ Coverage   91.51%   91.55%   +0.03%     
==========================================
  Files         147      147              
  Lines       48773    48796      +23     
==========================================
+ Hits        44637    44675      +38     
+ Misses       4136     4121      -15
Flag Coverage Δ
#multiple 89.92% <80%> (+0.03%) ⬆️
#single 41.6% <50%> (-0.03%) ⬇️
Impacted Files Coverage Δ
pandas/core/internals.py 94.49% <80%> (-0.01%) ⬇️
pandas/core/reshape/melt.py 97.19% <0%> (-0.06%) ⬇️
pandas/core/reshape/reshape.py 100% <0%> (ø) ⬆️
pandas/tseries/offsets.py 97.09% <0%> (+0.02%) ⬆️
pandas/core/dtypes/cast.py 88.66% <0%> (+0.07%) ⬆️
pandas/core/indexes/interval.py 92.29% <0%> (+0.1%) ⬆️
pandas/core/ops.py 92.06% <0%> (+0.17%) ⬆️
pandas/util/testing.py 84.41% <0%> (+0.21%) ⬆️
pandas/plotting/_converter.py 66.95% <0%> (+1.73%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78c3ff9...1258274. Read the comment docs.

@@ -1108,7 +1108,8 @@ def check_int_bool(self, inplace):
# a fill na type method
try:
m = missing.clean_fill_method(method)
except:
except Exception:
Copy link
Contributor

Choose a reason for hiding this comment

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

the entire point of correctly lining is to catch a more specific error
don’t put Execption everywhere with TODO that is not useful
his is why we are not raising on master atm with the latest linter yet

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know the appropriate exceptions to catch? I was going to fix these but didn't know what could be raised, and didn't want to break things.

Copy link
Contributor

Choose a reason for hiding this comment

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

you simply put a breakpoint in the exception and run the tests

Copy link
Member Author

Choose a reason for hiding this comment

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

Well looking at clean_fill_method the only thing it'll raise is ValueError, so this one I can make specific.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ditto for clean_interp_method.

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Jan 12, 2018 via email

@jreback
Copy link
Contributor

jreback commented Jan 12, 2018

its likeley to be TypeError, ValueError, but I'd rather error on the side of havining a bug pop up rather than keep hiding it (like we are doing now).

This is why just making these Exception is essentially no change from now.

@jreback jreback added the Code Style Code style, linting, code_checks label Jan 12, 2018
@jbrockmendel
Copy link
Member Author

The only one left is

        try:
            return self.sp_index.length
        except:
            return 0

Any idea what the failure mode here is?

@@ -840,7 +840,7 @@ def setitem(self, indexer, value, mgr=None):

transf = (lambda x: x.T) if self.ndim == 2 else (lambda x: x)
values = transf(values)
l = len(values)
vlen = len(values)
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this is only used in one place (line 858). Is there a reason to make it a variable in this case? Seems like we could just replace the one instance where vlen is used with len(values).

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good, will change.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

pls enumerate all of the exceptions rather than Exception

@@ -2807,7 +2806,8 @@ def _astype(self, dtype, copy=False, errors='raise', values=None,
def __len__(self):
try:
return self.sp_index.length
except:
except Exception:
Copy link
Contributor

Choose a reason for hiding this comment

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

enumerate these

Copy link
Member Author

Choose a reason for hiding this comment

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

Please read my previous comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

I did it was not helpful. you need to specify here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I did it was not helpful. you need to specify here.

Of course it wasn't helpful. It was asking for help!

Screw it, closing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Any idea what the failure mode here is?

@jreback was the comment @jbrockmendel referred to. Saying it was "not helpful" is driving away contributors.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jbrockmendel my point is that saying ping I am ready when you haven't answer my questions is not helpful.

Copy link
Contributor

Choose a reason for hiding this comment

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

I spend an enormous amounts of my time reviewing PR's and we have a lot of them. I do except answers to comments that I make.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm guessing these last two comments are about a "ping" over in #19139, where I had answered the question but that answer was ignored.

@jbrockmendel jbrockmendel deleted the internal_cleanup branch February 11, 2018 21:59
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