Skip to content

Fixing typo in cython casting lint, and making it azure friendly #23486

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 2 commits into from
Nov 6, 2018
Merged

Fixing typo in cython casting lint, and making it azure friendly #23486

merged 2 commits into from
Nov 6, 2018

Conversation

datapythonista
Copy link
Member

@jbrockmendel

Fixing typo introduced in #23474, when validating the spaces in casts in the cython code.

The original grep command used was:
grep -r -E --include '*.pyx' --include '*.pxi.in' '> ' pandas/_libs | grep -v '[ ->]> '

If I'm not mistaken, the goal of grep -v '[ ->]> ' was to exclude from the initially caught > the cases where before the greater than we have a space, a hyphen or another greater than. The problem is that the hyphen is understood as a range, like in [a-z], and the regex is excluding other characters, like the star. So, we're exclusing cases like:

pandas/_libs/window.pyx:        buf = <float64_t *> arr.data
pandas/_libs/window.pyx:        oldbuf = <float64_t *> bufarr.data
pandas/_libs/window.pyx:            bufarr.data = <char *> buf
pandas/_libs/window.pyx:        bufarr.data = <char *> oldbuf

Which should probably have the same standard as the one we're enforcing.

Just by changing the order of '[ ->]> ' to '[ >-]> ' makes it work as expected. But there is an additional problem on this grep. In #22854 I'm moving code_checks.py from travis to azure. And I implemented a bash function invgrep that is like a grep, that besides inverting the exit status of grep, formats the output in a way that looks nicer in azure. And pipping two greps together is making things a bit more complex, so I'd prefer to avoid it if possible.

So, the proposed changes in this PR, create a new regex that tries to solve the problem with a single grep. I changed the pattern to match any alphanumberic of star followed by the greater than and the space. But equivalent to what you were doing, we can also use '[^ ^>^-]> '. Happy to change to it if it makes more sense to you.

If you can confirm that my assumptions are correct, I'll fix the pending cases in this PR, so the CI is green and we can merge.

@datapythonista datapythonista added Bug CI Continuous Integration Code Style Code style, linting, code_checks labels Nov 4, 2018
@jbrockmendel
Copy link
Member

Yep, good catch.

@jreback
Copy link
Contributor

jreback commented Nov 4, 2018

can you fix the issues as well so that this passes

@jreback jreback added this to the 0.24.0 milestone Nov 4, 2018
@datapythonista
Copy link
Member Author

Wanted to make sure I was not misunderstanding the problem first. All fixed, and made the the regex more robust too (one case in validate.pyx was not caught with your expression or mine before, not sure why, but it is now).

CI should finish on green now.

@codecov
Copy link

codecov bot commented Nov 5, 2018

Codecov Report

Merging #23486 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #23486   +/-   ##
=======================================
  Coverage   92.23%   92.23%           
=======================================
  Files         161      161           
  Lines       51197    51197           
=======================================
  Hits        47220    47220           
  Misses       3977     3977
Flag Coverage Δ
#multiple 90.61% <ø> (ø) ⬆️
#single 42.27% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/indexes/datetimes.py 96.41% <0%> (ø) ⬆️
pandas/core/indexes/api.py 99% <0%> (ø) ⬆️
pandas/core/generic.py 96.81% <0%> (ø) ⬆️
pandas/core/arrays/datetimes.py 98.84% <0%> (ø) ⬆️

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 8586644...356dce5. Read the comment docs.

@jreback jreback merged commit e9ca781 into pandas-dev:master Nov 6, 2018
@jreback
Copy link
Contributor

jreback commented Nov 6, 2018

thanks @datapythonista

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CI Continuous Integration Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants