Skip to content

selector argument accepting function now correctly documented #2862

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

Merged
merged 2 commits into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ below :-).
- [ ] For a new feature, I have added documentation examples in an existing or
new tutorial notebook (please see the doc checklist as well).
- [ ] I have added a CHANGELOG entry if fixing/changing/adding anything substantial.
- [ ] For a new feature or a change in behaviour, I have updated the relevant docstrings in the code to describe the feature or behaviour (please see the doc checklist as well).

-->
45 changes: 33 additions & 12 deletions packages/python/plotly/codegen/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,16 @@ def select_{plural_name}(

Parameters
----------
selector: dict or None (default None)
selector: dict, function, or None (default None)
Dict to use as selection criteria.
{singular_name} objects will be selected if they contain
properties corresponding to all of the dictionary's keys, with
values that exactly match the supplied values. If None
(the default), all {singular_name} objects are selected.
(the default), all {singular_name} objects are selected. If a
function, it must be a function accepting a single argument and
returning a boolean. The function will be called on each
{singular_name} and those for which the function returned True will
be in the selection.
row, col: int or None (default None)
Subplot row and column index of {singular_name} objects to select.
To select {singular_name} objects by row and column, the Figure
Expand All @@ -288,12 +292,16 @@ def for_each_{singular_name}(
----------
fn:
Function that inputs a single {singular_name} object.
selector: dict or None (default None)
selector: dict, function, or None (default None)
Dict to use as selection criteria.
{singular_name} objects will be selected if they contain
properties corresponding to all of the dictionary's keys, with
values that exactly match the supplied values. If None
(the default), all {singular_name} objects are selected.
(the default), all {singular_name} objects are selected. If a
function, it must be a function accepting a single argument and
returning a boolean. The function will be called on each
{singular_name} and those for which the function returned True will
be in the selection.
row, col: int or None (default None)
Subplot row and column index of {singular_name} objects to select.
To select {singular_name} objects by row and column, the Figure
Expand Down Expand Up @@ -327,12 +335,16 @@ def update_{plural_name}(
patch: dict
Dictionary of property updates to be applied to all
{singular_name} objects that satisfy the selection criteria.
selector: dict or None (default None)
selector: dict, function, or None (default None)
Dict to use as selection criteria.
{singular_name} objects will be selected if they contain
properties corresponding to all of the dictionary's keys, with
values that exactly match the supplied values. If None
(the default), all {singular_name} objects are selected.
(the default), all {singular_name} objects are selected. If a
function, it must be a function accepting a single argument and
returning a boolean. The function will be called on each
{singular_name} and those for which the function returned True will
be in the selection.
overwrite: bool
If True, overwrite existing properties. If False, apply updates
to existing properties recursively, preserving existing
Expand Down Expand Up @@ -383,12 +395,15 @@ def select_{method_prefix}{plural_name}(

Parameters
----------
selector: dict or None (default None)
selector: dict, function, or None (default None)
Dict to use as selection criteria.
Annotations will be selected if they contain properties corresponding
to all of the dictionary's keys, with values that exactly match
the supplied values. If None (the default), all {plural_name} are
selected.
selected. If a function, it must be a function accepting a single
argument and returning a boolean. The function will be called on
each {singular_name} and those for which the function returned True
will be in the selection.
row, col: int or None (default None)
Subplot row and column index of {plural_name} to select.
To select {plural_name} by row and column, the Figure must have been
Expand Down Expand Up @@ -428,12 +443,15 @@ def for_each_{method_prefix}{singular_name}(
----------
fn:
Function that inputs a single {singular_name} object.
selector: dict or None (default None)
selector: dict, function, or None (default None)
Dict to use as selection criteria.
Traces will be selected if they contain properties corresponding
to all of the dictionary's keys, with values that exactly match
the supplied values. If None (the default), all {plural_name} are
selected.
selected. If a function, it must be a function accepting a single
argument and returning a boolean. The function will be called on
each {singular_name} and those for which the function returned True
will be in the selection.
row, col: int or None (default None)
Subplot row and column index of {plural_name} to select.
To select {plural_name} by row and column, the Figure must have been
Expand Down Expand Up @@ -486,12 +504,15 @@ def update_{method_prefix}{plural_name}(
patch: dict or None (default None)
Dictionary of property updates to be applied to all {plural_name} that
satisfy the selection criteria.
selector: dict or None (default None)
selector: dict, function, or None (default None)
Dict to use as selection criteria.
Traces will be selected if they contain properties corresponding
to all of the dictionary's keys, with values that exactly match
the supplied values. If None (the default), all {plural_name} are
selected.
selected. If a function, it must be a function accepting a single
argument and returning a boolean. The function will be called on
each {singular_name} and those for which the function returned True
will be in the selection.
row, col: int or None (default None)
Subplot row and column index of {plural_name} to select.
To select {plural_name} by row and column, the Figure must have been
Expand Down
21 changes: 15 additions & 6 deletions packages/python/plotly/plotly/basedatatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,12 +857,15 @@ def select_traces(self, selector=None, row=None, col=None, secondary_y=None):

Parameters
----------
selector: dict or None (default None)
selector: dict, function, or None (default None)
Dict to use as selection criteria.
Traces will be selected if they contain properties corresponding
to all of the dictionary's keys, with values that exactly match
the supplied values. If None (the default), all traces are
selected.
selected. If a function, it must be a function accepting a single
argument and returning a boolean. The function will be called on
each trace and those for which the function returned True
will be in the selection.
row, col: int or None (default None)
Subplot row and column index of traces to select.
To select traces by row and column, the Figure must have been
Expand Down Expand Up @@ -984,12 +987,15 @@ def for_each_trace(self, fn, selector=None, row=None, col=None, secondary_y=None
----------
fn:
Function that inputs a single trace object.
selector: dict or None (default None)
selector: dict, function, or None (default None)
Dict to use as selection criteria.
Traces will be selected if they contain properties corresponding
to all of the dictionary's keys, with values that exactly match
the supplied values. If None (the default), all traces are
selected.
selected. If a function, it must be a function accepting a single
argument and returning a boolean. The function will be called on
each trace and those for which the function returned True
will be in the selection.
row, col: int or None (default None)
Subplot row and column index of traces to select.
To select traces by row and column, the Figure must have been
Expand Down Expand Up @@ -1038,12 +1044,15 @@ def update_traces(
patch: dict or None (default None)
Dictionary of property updates to be applied to all traces that
satisfy the selection criteria.
selector: dict or None (default None)
selector: dict, function, or None (default None)
Dict to use as selection criteria.
Traces will be selected if they contain properties corresponding
to all of the dictionary's keys, with values that exactly match
the supplied values. If None (the default), all traces are
selected.
selected. If a function, it must be a function accepting a single
argument and returning a boolean. The function will be called on
each trace and those for which the function returned True
will be in the selection.
row, col: int or None (default None)
Subplot row and column index of traces to select.
To select traces by row and column, the Figure must have been
Expand Down
Loading