-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Make option_context a ContextDecorator. #34253
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - test failure should be unrelated
Can you merge master and repush? Should get CI green |
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. doc-comments, ping on green.
doc/source/whatsnew/v1.1.0.rst
Outdated
@@ -236,6 +236,7 @@ Other enhancements | |||
and :class:`~pandas.io.stata.StataWriterUTF8` (:issue:`26599`). | |||
- :meth:`HDFStore.put` now accepts `track_times` parameter. Parameter is passed to ``create_table`` method of ``PyTables`` (:issue:`32682`). | |||
- Make :class:`pandas.core.window.Rolling` and :class:`pandas.core.window.Expanding` iterable(:issue:`11704`) | |||
- Make ``option_context`` a :class:`contextlib.ContextDecorator`, which allows it to be used as a decorator over an entire function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add this PR number as the issue number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -410,6 +410,12 @@ def eq(val): | |||
self.cf.set_option("a", 17) | |||
eq(17) | |||
|
|||
@self.cf.option_context("a", 123) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment with this issue number here (and a comment on what we are testing here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
This makes it possible to use option_context as a decorator over an entire function, saving an indent level and making it easy to comment out (or in) the context while keeping correct indentation.
thanks @anntzer |
This makes it possible to use option_context as a decorator over an
entire function, saving an indent level and making it easy to comment
out (or in) the context while keeping correct indentation.
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff