Skip to content
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

pythonize cython code #22638

Merged
merged 4 commits into from
Sep 12, 2018
Merged

pythonize cython code #22638

merged 4 commits into from
Sep 12, 2018

Conversation

jbrockmendel
Copy link
Member

Use python-style type annotations instead of cython-style in a few places.

Use python-style isinstance checks in cases where cython will automatically optimize them into C calls.

Part of the hope is that we can get the code close enough to valid python that we can trick flake8 into working on it.

@@ -374,7 +374,7 @@ cpdef bint is_subperiod(source, target):
return source in {'N'}


cpdef bint is_superperiod(source, target):
def is_superperiod(source, target) -> bint:
Copy link
Member Author

Choose a reason for hiding this comment

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

These two are not used within cython, I think they were cpdef just because with the other syntax you can’t declare a return type with just def.

@codecov
Copy link

codecov bot commented Sep 11, 2018

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #22638   +/-   ##
=======================================
  Coverage   92.17%   92.17%           
=======================================
  Files         169      169           
  Lines       50708    50708           
=======================================
  Hits        46740    46740           
  Misses       3968     3968
Flag Coverage Δ
#multiple 90.58% <ø> (ø) ⬆️
#single 42.35% <ø> (ø) ⬆️

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 0976e12...f9c0c26. Read the comment docs.

@gfyoung gfyoung added Internals Related to non-user accessible pandas implementation Clean labels Sep 12, 2018
@jreback jreback added this to the 0.24.0 milestone Sep 12, 2018
@jreback jreback merged commit c040353 into pandas-dev:master Sep 12, 2018
@jreback
Copy link
Contributor

jreback commented Sep 12, 2018

thanks. maybe add a note somewhere that we can use type annotation in cython files (maybe at the top of each file?)

@jbrockmendel jbrockmendel deleted the annotate branch September 12, 2018 13:41
@jorisvandenbossche
Copy link
Member

Use python-style type annotations instead of cython-style in a few places.

Sorry, why do we think this is an improvement? Now we have two ways of doing things?
Can you provide a bit more background / reasoning?

@jbrockmendel
Copy link
Member Author

Some discussion in #22180.

Main motivation: I think that if we can get the code close enough to valid python, we can trick flake8 into running on it.

aeltanawy pushed a commit to aeltanawy/pandas that referenced this pull request Sep 20, 2018
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Internals Related to non-user accessible pandas implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants