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

Fix ignored options #5016

Merged
merged 5 commits into from
Aug 3, 2021

Conversation

douglas-raillard-arm
Copy link
Contributor

No description provided.

Use functools.wraps in order to create the decorator rather than
manually setting __doc__. This allows forwarding a number of important
attribute, and allows access to the original callable using the
__wrapped__ attribute.
Use
    def f(foo=XXX):
	...

rather than:

    def f(**kwargs):
	foo = kwargs.pop('foo', XXX)

Since Python can already provide default values to parameters.
Containers in Python implement __bool__ for emptyness already.
Use Python control structures to avoid unnecessary flag variables.

This code:

    found = False
    for x in y:
	if cond(x):
	    found = True
	    f(x)
	    break
    if not found:
	error()

Is equivalent to else clause of for loops, which can be understood as
"paired" with the "if" statement breaking if cond is true inside the
loop:

    for x in y:
	if cond(x):
	    f(x)
	    break
    else:
	error()

Similar to (except that no "x" is bound):

    if any(map(cond, y)):
	f()
    else:
	error()
Take into account the backend the options are set on when creating a new
option tree. Otherwise, custom options set for a backend that is not the
current one will simply be discared, and only the new options will
survive.

Fixes holoviz#4962
@philippjfr
Copy link
Member

Thanks so much, looks good!

@philippjfr philippjfr merged commit 234638d into holoviz:master Aug 3, 2021
philippjfr pushed a commit that referenced this pull request Aug 23, 2021
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants