Remove redundant check arr_or_dtype is None
State: closed

- [ X ] tests passed
- [ X ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

Checking whether `if arr_or_dtype is None` is done in the beginning of the function so the following check is redundant and can be safely removed.

This issue (among a few others) were flagged up by LGTM.com website: https://lgtm.com/projects/g/pandas-dev/pandas/alerts/?mode=tree. Some of the other numerical computing repositories have been analyzed there as well such as [numpy](https://lgtm.com/projects/g/numpy/numpy/alerts/?mode=tree) and [scipy](https://lgtm.com/projects/g/scipy/scipy/alerts/?mode=tree).

If you like, you can use LGTM for automatically reviewing code in pull requests. Here's an example of how Google's AMPHTML use that to flag up security vulnerabilities in their code base: ampproject/amphtml#13060.

(full disclosure: I'm a huge fan of `pandas` and also part of the team that runs LGTM.com)



Labels:
name: Clean

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26655?src=pr&el=h1) Report
> Merging [#26655](https://codecov.io/gh/pandas-dev/pandas/pull/26655?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/01d97d48b08c546a46b91c27a5886f52b46f22c2?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #26655      +/-   ##
==========================================
- Coverage   91.87%   91.87%   -0.01%     
==========================================
  Files         174      174              
  Lines       50683    50681       -2     
==========================================
- Hits        46567    46563       -4     
- Misses       4116     4118       +2
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.41% <ø> (ø)` | :arrow_up: |
| #single | `41.78% <ø> (-0.1%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26655?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/dtypes/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/26655/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbW1vbi5weQ==) | `96.15% <ø> (+0.29%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26655/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26655/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97% <0%> (-0.12%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/26655/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `90.91% <0%> (+0.1%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26655?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/26655?src=pr&el=footer). Last update [01d97d4...1524eb8](https://codecov.io/gh/pandas-dev/pandas/pull/26655?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Hey, thanks for contributing!

Could you remove the first occurrence of the pattern, rather than the second, so all fastpaths are collected. Else looks good. Ping on green.

With regards to the proposed tool, could you bring it up on the issue tracker, so it can get a separate discussion from the PR.

Hello @AlexTereshenkov! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:



There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2019-06-05 12:42:41 UTC
> small comment

It's funny as I was told the opposite first as you can see in the comment above. :) no worries, moved it back agian...
ahh ok, this lgtm. ping on green.
@jreback green!
> Hey, thanks for contributing!
> 
> Could you remove the first occurrence of the pattern, rather than the second, so all fastpaths are collected. Else looks good. Ping on green.
> 
> With regards to the proposed tool, could you bring it up on the issue tracker, so it can get a separate discussion from the PR.

@topper-123 thanks for the suggestion, I've raised #26664 for this
thanks @AlexTereshenkov 
No worries at all! There are more issues that are found by LGTM.com but they are more complex so I may need to raise an issue first to let someone verify that this is a bug and not just some obscure magic that is necessary to get `numpy` and `scipy` do what's necessary :) and only then open a PR. Cheers