Skip to content

Conversation

@jbrockmendel
Copy link
Member

This PR defines a delegate_names decorator that provides an alternative (and to my taste, much nicer) syntax for pinning delegated attributes to Accessor classes.

Effectively this just moves the call to _add_delegate_accessors from after the class definition to a decorator on the class. I find this much harder to overlook when reading a class definition.

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry
@pep8speaks
Copy link

Hello @jbrockmendel! Thanks for submitting the PR.

@TomAugspurger
Copy link
Contributor

If you fetch and merge master the CI failures should be fixed.

@gfyoung gfyoung added Enhancement Refactor Internal refactoring of code ExtensionArray Extending pandas with custom dtypes or arrays. labels Sep 5, 2018
@codecov
Copy link

codecov bot commented Sep 6, 2018

Codecov Report

Merging #22599 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@ Coverage Diff @@ ## master #22599 +/- ## ========================================== + Coverage 92.04% 92.04% +<.01%  ========================================== Files 169 169 Lines 50782 50785 +3 ========================================== + Hits 46742 46745 +3  Misses 4040 4040
Flag Coverage Δ
#multiple 90.45% <100%> (ø) ⬆️
#single 42.3% <100%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/arrays/categorical.py 95.74% <100%> (ø) ⬆️
pandas/core/indexes/accessors.py 90.09% <100%> (ø) ⬆️
pandas/core/indexes/category.py 97.26% <100%> (-0.02%) ⬇️
pandas/core/accessor.py 98.79% <100%> (+0.07%) ⬆️

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 e2e1a10...7ff63e2. Read the comment docs.

Copy link
Contributor

@TomAugspurger TomAugspurger left a comment

Choose a reason for hiding this comment

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

Agreed this is nicer.

Merging on Monday if no objections.

CategoricalIndex._add_numeric_methods_disabled()
CategoricalIndex._add_logical_methods_disabled()
CategoricalIndex._add_comparison_methods()
CategoricalIndex._add_accessors()
Copy link
Contributor

Choose a reason for hiding this comment

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

slightly -0 here as I like the _add_* flow. but ok

@jreback jreback added this to the 0.24.0 milestone Sep 8, 2018
@jreback jreback merged commit aeb9299 into pandas-dev:master Sep 8, 2018
@jreback
Copy link
Contributor

jreback commented Sep 8, 2018

thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the delegation branch September 8, 2018 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement ExtensionArray Extending pandas with custom dtypes or arrays. Refactor Internal refactoring of code

5 participants