Skip to content

Commit fbd1db5

Browse files
Change docstring markdown code blocks to RST (#450) (#452)
Signed-off-by: Christophe Bedard <[email protected]> (cherry picked from commit 9abb3be) Co-authored-by: Christophe Bedard <[email protected]>
1 parent 5605898 commit fbd1db5

File tree

4 files changed

+42
-37
lines changed

4 files changed

+42
-37
lines changed

launch_ros/launch_ros/actions/set_parameter.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,25 @@ class SetParameter(Action):
3535
Action that sets a parameter in the current context.
3636
3737
This parameter will be set in all the nodes launched in the same scope.
38-
e.g.:
39-
```python3
38+
39+
For example:
40+
41+
.. code-block:: python
42+
4043
LaunchDescription([
4144
...,
4245
GroupAction(
4346
actions = [
4447
...,
4548
SetParameter(name='my_param', value='2'),
4649
...,
47-
Node(...), // the param will be passed to this node
50+
Node(...), # the param will be passed to this node
4851
...,
4952
]
5053
),
51-
Node(...), // here it won't be passed, as it's not in the same scope
54+
Node(...), # here it won't be passed, as it's not in the same scope
5255
...
5356
])
54-
```
5557
"""
5658

5759
def __init__(

launch_ros/launch_ros/actions/set_parameters_from_file.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,34 @@ class SetParametersFromFile(Action):
2929
"""
3030
Action that sets parameters for all nodes in scope based on a given yaml file.
3131
32-
e.g.
33-
```python3
32+
For example:
33+
34+
.. code-block:: python
35+
3436
LaunchDescription([
3537
...,
3638
GroupAction(
3739
actions = [
3840
...,
3941
SetParametersFromFile('path/to/file.yaml'),
4042
...,
41-
Node(...), // the params will be passed to this node
43+
Node(...), # the params will be passed to this node
4244
...,
4345
]
4446
),
45-
Node(...), // here it won't be passed, as it's not in the same scope
47+
Node(...), # here it won't be passed, as it's not in the same scope
4648
...
4749
])
48-
```
49-
```xml
50-
<launch>
51-
<group>
52-
<set_parameters_from_file filename='/path/to/file.yaml'/>
53-
<node .../> // Node in scope, params will be passed
54-
</group>
55-
<node .../> // Node not in scope, params won't be passed
56-
</launch>
5750
58-
```
51+
.. code-block:: xml
52+
53+
<launch>
54+
<group>
55+
<set_parameters_from_file filename='/path/to/file.yaml'/>
56+
<node .../> <!-- Node in scope, params will be passed -->
57+
</group>
58+
<node .../> <!-- Node not in scope, params won't be passed -->
59+
</launch>
5960
"""
6061

6162
def __init__(

launch_ros/launch_ros/actions/set_remap.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,25 @@ class SetRemap(Action):
3434
3535
This remapping rule will be passed to all the nodes launched in the same scope, overriding
3636
the ones specified in the `Node` action constructor.
37-
e.g.:
38-
```python3
37+
38+
For example:
39+
40+
.. code-block:: python
41+
3942
LaunchDescription([
4043
...,
4144
GroupAction(
4245
actions = [
4346
...,
4447
SetRemap(src='asd', dst='bsd'),
4548
...,
46-
Node(...), // the remap rule will be passed to this node
49+
Node(...), # the remap rule will be passed to this node
4750
...,
4851
]
4952
),
50-
Node(...), // here it won't be passed, as it's not in the same scope
53+
Node(...), # here it won't be passed, as it's not in the same scope
5154
...
5255
])
53-
```
5456
"""
5557

5658
def __init__(

launch_ros/launch_ros/utilities/namespace_utils.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,24 @@ def prefix_namespace(
4747
`ns` prefixed with `base_ns`.
4848
In all cases, trailing `/` are stripped from the result.
4949
50-
## Examples:
50+
For example:
5151
52-
```python3
53-
combined_ns = prefix_namespace('my_ns', 'original_ns')
54-
assert combined_ns == 'my_ns/original_ns'
52+
.. code-block:: python
5553
56-
combined_ns = prefix_namespace('/my_ns', 'original_ns')
57-
assert combined_ns == '/my_ns/original_ns'
54+
combined_ns = prefix_namespace('my_ns', 'original_ns')
55+
assert combined_ns == 'my_ns/original_ns'
5856
59-
combined_ns = prefix_namespace('my_ns', '/original_ns')
60-
assert combined_ns == '/original_ns'
57+
combined_ns = prefix_namespace('/my_ns', 'original_ns')
58+
assert combined_ns == '/my_ns/original_ns'
6159
62-
combined_ns = prefix_namespace(None, 'original_ns')
63-
assert combined_ns == 'original_ns'
60+
combined_ns = prefix_namespace('my_ns', '/original_ns')
61+
assert combined_ns == '/original_ns'
6462
65-
combined_ns = prefix_namespace('my_ns', None)
66-
assert combined_ns == 'my_ns'
67-
```
63+
combined_ns = prefix_namespace(None, 'original_ns')
64+
assert combined_ns == 'original_ns'
65+
66+
combined_ns = prefix_namespace('my_ns', None)
67+
assert combined_ns == 'my_ns'
6868
"""
6969
combined_ns: Optional[Text] = None
7070
if base_ns is not None or ns is not None:

0 commit comments

Comments
 (0)