CLN: flake8 cleanup of core.internals
State: closed

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


Labels:
name: Code Style
description: Code style, linting, code_checks

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19202?src=pr&el=h1) Report
> Merging [#19202](https://codecov.io/gh/pandas-dev/pandas/pull/19202?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/78c3ff97a8795c2de9861b6b0a40a5fa4b8e331f?src=pr&el=desc) will **increase** coverage by `0.03%`.
> The diff coverage is `80%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/19202/graphs/tree.svg?height=150&width=650&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/19202?src=pr&el=tree)

```diff
@@            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%)` | :arrow_up: |
| #single | `41.6% <50%> (-0.03%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/19202?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/internals.py](https://codecov.io/gh/pandas-dev/pandas/pull/19202/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzLnB5) | `94.49% <80%> (-0.01%)` | :arrow_down: |
| [pandas/core/reshape/melt.py](https://codecov.io/gh/pandas-dev/pandas/pull/19202/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9tZWx0LnB5) | `97.19% <0%> (-0.06%)` | :arrow_down: |
| [pandas/core/reshape/reshape.py](https://codecov.io/gh/pandas-dev/pandas/pull/19202/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9yZXNoYXBlLnB5) | `100% <0%> (ø)` | :arrow_up: |
| [pandas/tseries/offsets.py](https://codecov.io/gh/pandas-dev/pandas/pull/19202/diff?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvb2Zmc2V0cy5weQ==) | `97.09% <0%> (+0.02%)` | :arrow_up: |
| [pandas/core/dtypes/cast.py](https://codecov.io/gh/pandas-dev/pandas/pull/19202/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2Nhc3QucHk=) | `88.66% <0%> (+0.07%)` | :arrow_up: |
| [pandas/core/indexes/interval.py](https://codecov.io/gh/pandas-dev/pandas/pull/19202/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9pbnRlcnZhbC5weQ==) | `92.29% <0%> (+0.1%)` | :arrow_up: |
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/19202/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `92.06% <0%> (+0.17%)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/19202/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `84.41% <0%> (+0.21%)` | :arrow_up: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/19202/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `66.95% <0%> (+1.73%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19202?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19202?src=pr&el=footer). Last update [78c3ff9...1258274](https://codecov.io/gh/pandas-dev/pandas/pull/19202?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

How confident are you that we have tests exercising all the exceptions that
get raised?

On Fri, Jan 12, 2018 at 6:11 AM, Jeff Reback <notifications@github.com>
wrote:

> *@jreback* commented on this pull request.
> ------------------------------
>
> In pandas/core/internals.py
> <https://github.com/pandas-dev/pandas/pull/19202#discussion_r161207183>:
>
> > @@ -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:
>
> you simply put a breakpoint in the exception and run the tests
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/19202#discussion_r161207183>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABQHIvX00sUJjLJ5wgh4qOfyryRDzPPRks5tJ0wHgaJpZM4Rb3Mh>
> .
>

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.
The only one left is

```
        try:
            return self.sp_index.length
        except:
            return 0
```

Any idea what the failure mode here is?