-
Notifications
You must be signed in to change notification settings - Fork 102
Repeated Capabilites documentation improvements #1686
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
e9b6f72
7b3a1a5
8bc69bc
93d62f1
e4ba124
4fda89a
948db7a
f2dc5ea
f04652c
d48cfc9
1cc9cf4
ce93c56
8e8833c
cf13613
76fede8
fb8c3a0
ad59a96
30efefd
e461d65
19b2208
d2c61ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,10 +25,15 @@ ${helper.get_rst_header_snippet('Repeated Capabilities', '=')} | |
|
|
||
| Repeated capabilities attributes use the indexing operator :python:`[]` to indicate the repeated capabilities. | ||
| The parameter can be a string, list, tuple, or slice (range). Each element of those can be a string or | ||
| an integer. If it is a string, you can indicate a range using the same format as the driver: :python:`'0-2'` or | ||
| :python:`'0:2'` | ||
| an integer. | ||
|
|
||
| Some repeated capabilities use a prefix before the number and this is optional | ||
| .. | ||
| If it is a string, you can indicate a range using the same format as the driver: :python:`'0-2'` or | ||
| :python:`'0:2'` | ||
|
|
||
| Some repeated capabilities use a prefix before the number and this is optional. | ||
|
|
||
| The recommended way of accessing repeated capabilities is with an integer :python:`[0]` or range :python:`[0:2]`. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't think this will work since this is not the correct syntax for Python Having said that, I don't think any of the ways I've enumerated above can be recommended over others.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see @marcoskirsch doesn't like us to recommend the range-based strings. Since I saw we had logic specifically for handling it, I thought it was important. But it sounds like it was ill-conceived. I don't mind not documenting it. Once we land on recommended ways, we should go over the examples to ensure only recommended types are used. |
||
|
|
||
| % for rep_cap in config['repeated_capabilities']: | ||
| <% | ||
|
|
@@ -40,27 +45,43 @@ ${helper.get_rst_header_snippet(name, '-')} | |
| .. py:attribute:: ${module_name}.Session.${name}[] | ||
|
|
||
| % if len(prefix) > 0: | ||
| If no prefix is added to the items in the parameter, the correct prefix will be added when | ||
| the driver function call is made. | ||
| .. | ||
| If no prefix is added to the items in the parameter, the correct prefix will be added when | ||
| the driver function call is made. | ||
|
ni-jfitzger marked this conversation as resolved.
Outdated
|
||
|
|
||
| .. code:: python | ||
| .. code:: python | ||
|
|
||
| session.${name}['0-2'].channel_enabled = True | ||
|
|
||
| passes a string of :python:`'${prefix}0, ${prefix}1, ${prefix}2'` to the set attribute function. | ||
|
ni-jfitzger marked this conversation as resolved.
Outdated
|
||
|
|
||
| session.${name}['0-2'].channel_enabled = True | ||
| If an invalid repeated capability is passed to the driver, the driver will return an error. | ||
|
ni-jfitzger marked this conversation as resolved.
Outdated
|
||
|
|
||
| passes a string of :python:`'${prefix}0, ${prefix}1, ${prefix}2'` to the set attribute function. | ||
| You can also explicitly use the prefix as part of the parameter, but it must be the correct prefix | ||
| for the specific repeated capability. | ||
|
|
||
| If an invalid repeated capability is passed to the driver, the driver will return an error. | ||
| .. code:: python | ||
|
|
||
| You can also explicitly use the prefix as part of the parameter, but it must be the correct prefix | ||
| for the specific repeated capability. | ||
| session.${name}['${prefix}0-${prefix}2'].channel_enabled = True | ||
|
|
||
| passes a string of :python:`'${prefix}0, ${prefix}1, ${prefix}2'` to the set attribute function. | ||
|
|
||
| % endif | ||
| .. code:: python | ||
|
|
||
| session.${name}['${prefix}0-${prefix}2'].channel_enabled = True | ||
| session.${name}[0].channel_enabled = True | ||
|
|
||
| sets :py:attr:`channel_enabled` to :python:`True` for ${name} 0. | ||
|
|
||
| .. code:: python | ||
|
|
||
| passes a string of :python:`'${prefix}0, ${prefix}1, ${prefix}2'` to the set attribute function. | ||
| session.${name}[0:2].channel_enabled = True | ||
|
|
||
| sets :py:attr:`channel_enabled` to :python:`True` for ${name} 0, 1, 2. | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I add anything to the recommend types above, I should add an example usage, here. |
||
|
|
||
| Note that :py:attr:`channel_enabled` is only used as an example and is not necessarily a property which | ||
| supports this repeated capability. See documentation for individual properties and methods to | ||
| learn what repeated capabilites they support, if any. | ||
|
|
||
| % endfor | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.