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

Assorted _libs cleanups #22235

Merged
merged 20 commits into from
Aug 10, 2018
Merged

Assorted _libs cleanups #22235

merged 20 commits into from
Aug 10, 2018

Conversation

jbrockmendel
Copy link
Member

Modernize for-loop syntax
Modernize string formatting
Use memoryviews in a few places
Docstrings, change a couple of funcs in tslibs.parsing to cdef

Follow-up cleanup in tslibs.period
Move some unneeded stuff out of tslibs.util to wrap up the self-contained goal.



cdef int min_value(int left, int right) nogil:
if left < right:
Copy link
Contributor

Choose a reason for hiding this comment

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

grr how many times do we have this i the code base :)

Copy link
Member Author

Choose a reason for hiding this comment

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

We could probably use np_datetime.cmp_scalar here, would need to cast from int to int64_t

Copy link
Contributor

Choose a reason for hiding this comment

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

no it’s done - was just generally commenting

int col = max_value(from_index, to_index)
# row or col < 6 means frequency strictly lower than Daily, which
# do not use daytime_conversion_factors
if row < 6:
Copy link
Contributor

Choose a reason for hiding this comment

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

can u use the enumerated here?

Copy link
Member Author

Choose a reason for hiding this comment

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

huh? This is just moving the existing C code into cython.

Copy link
Contributor

Choose a reason for hiding this comment

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

I get it, but the 6 is pretty opaque

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.

can you start a cython section in internals.rst adding best practices

also I think a lint rule for not using 0 <= j < n might be appropriate

int col = max_value(from_index, to_index)
# row or col < 6 means frequency strictly lower than Daily, which
# do not use daytime_conversion_factors
if row < 6:
Copy link
Contributor

Choose a reason for hiding this comment

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

I get it, but the 6 is pretty opaque

#define PANDAS_INLINE
#endif
#endif
#include "helper.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

can we rename helper to something more informative

@@ -1103,7 +1102,7 @@ class Timestamp(_Timestamp):


# Add the min and max fields at the class level
cdef int64_t _NS_UPPER_BOUND = INT64_MAX
Copy link
Contributor

Choose a reason for hiding this comment

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

future TODO, we look up these limits all over the place. maybe make a limits.pyx somewhere

@jreback jreback added the Code Style Code style, linting, code_checks label Aug 8, 2018
@codecov
Copy link

codecov bot commented Aug 8, 2018

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #22235   +/-   ##
=======================================
  Coverage   92.08%   92.08%           
=======================================
  Files         169      169           
  Lines       50704    50704           
=======================================
  Hits        46691    46691           
  Misses       4013     4013
Flag Coverage Δ
#multiple 90.49% <ø> (ø) ⬆️
#single 42.33% <ø> (ø) ⬆️

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 475e391...6ae2c72. Read the comment docs.

@jreback jreback added this to the 0.24.0 milestone Aug 9, 2018
@jreback
Copy link
Contributor

jreback commented Aug 9, 2018

lgtm. merge on green.

@jbrockmendel
Copy link
Member Author

@pandas-dev/pandas-core do we have any windows users who can help troubleshoot appveyor-only build failures?

@gfyoung
Copy link
Member

gfyoung commented Aug 9, 2018

@jbrockmendel : I wasn't able to reproduce the AppVeyor failure unfortunately. That being said, very hard to believe that the removal of the profiler magic comment is the cause of the issue.

But I have to ask: what happens if you put the magic comment back?

@jbrockmendel
Copy link
Member Author

I wasn't able to reproduce the AppVeyor failure unfortunately.

Darn, thanks for trying.

But I have to ask: what happens if you put the magic comment back?

Its worth a try, but I expect the issue isn't with resolution.pyx but in one of its dependencies.

@chris-b1
Copy link
Contributor

chris-b1 commented Aug 9, 2018

I can reproduce - likely dependent on the 2.7 toolchain - will see what I can figure out

@chris-b1
Copy link
Contributor

chris-b1 commented Aug 9, 2018

Made a pull on your PR - long story short, it appears you were depending in a couple spots on an implicit include of stdint.h, which on MSCV doesn't define int64_t, so need a couple workarounds.

some typedefs for MSVC 2008
@jreback
Copy link
Contributor

jreback commented Aug 9, 2018

thanks @chris-b1

ok lgtm, merge on green (is the appveyor tests sufficient for this?)

@gfyoung
Copy link
Member

gfyoung commented Aug 10, 2018

@jreback : The AppVeyor test should be sufficient since it was a build issue. Also, I would have been much more concerned had it occurred on Python 3.x (instead of 2.x in this case).

@gfyoung gfyoung merged commit 7390963 into pandas-dev:master Aug 10, 2018
@gfyoung
Copy link
Member

gfyoung commented Aug 10, 2018

Thanks @jbrockmendel !

@jbrockmendel jbrockmendel deleted the contained4 branch August 10, 2018 17:21
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
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants