Skip to content

Remove redundant check arr_or_dtype is None #26655

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

Merged
merged 4 commits into from
Jun 5, 2019
Merged

Remove redundant check arr_or_dtype is None #26655

merged 4 commits into from
Jun 5, 2019

Conversation

AlexTereshenkov
Copy link
Contributor

  • [ 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 and scipy.

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)

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
@codecov
Copy link

codecov bot commented Jun 5, 2019

Codecov Report

Merging #26655 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            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% <ø> (ø) ⬆️
#single 41.78% <ø> (-0.1%) ⬇️
Impacted Files Coverage Δ
pandas/core/dtypes/common.py 96.15% <ø> (+0.29%) ⬆️
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
pandas/core/frame.py 97% <0%> (-0.12%) ⬇️
pandas/util/testing.py 90.91% <0%> (+0.1%) ⬆️

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 01d97d4...1524eb8. Read the comment docs.

@topper-123
Copy link
Contributor

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.

Keeping the check under the fastpath block so all fastpaths are collected.
@pep8speaks
Copy link

pep8speaks commented Jun 5, 2019

Hello @AlexTereshenkov! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

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

Comment last updated at 2019-06-05 12:42:41 UTC

Strip whitespace
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.

small comment

@jreback jreback added this to the 0.25.0 milestone Jun 5, 2019
Moving the check
@AlexTereshenkov
Copy link
Contributor Author

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...

@jreback
Copy link
Contributor

jreback commented Jun 5, 2019

ahh ok, this lgtm. ping on green.

@AlexTereshenkov
Copy link
Contributor Author

@jreback green!

@AlexTereshenkov
Copy link
Contributor Author

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

@jreback jreback merged commit f8b4c57 into pandas-dev:master Jun 5, 2019
@jreback
Copy link
Contributor

jreback commented Jun 5, 2019

thanks @AlexTereshenkov

@AlexTereshenkov
Copy link
Contributor Author

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

vaibhavhrt pushed a commit to vaibhavhrt/pandas that referenced this pull request Jun 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants