@@ -18,9 +18,9 @@ def ros_type_to_dict(msg_type):
18
18
Create a dictionary which values say if the ROS message type is complex (not basic), which is its parent
19
19
ROS message module, its type, if it is an array and if so, its size.
20
20
21
- :param msg_type: ROS message type
21
+ :param msg_type: ROS message type.
22
22
:return: A dictionary which values say if the ROS message type is complex (not basic), which is its parent
23
- ROS message module, its type, if it is an array and if so, its size
23
+ ROS message module, its type, if it is an array and if so, its size.
24
24
"""
25
25
type_regexp = re .compile (
26
26
r'^(?P<complex>(?P<module>[\w]+)/)?(?P<type>[\w]+)(?P<array>\[(?P<array_size>[0-9]*)?\])?$' )
@@ -36,7 +36,7 @@ def ros_msg_loader(type_dict):
36
36
Dynamically import ROS message modules.
37
37
38
38
:param type_dict: A dictionary which values say if the ROS message type is complex (not basic), which is its parent
39
- ROS message module, its type, if it is an array and if so, its size
39
+ ROS message module, its type, if it is an array and if so, its size.
40
40
:return: The ROS message class. If the provided type does not exist, raises an import error.
41
41
"""
42
42
try :
@@ -53,10 +53,10 @@ def ros_msg_loader(type_dict):
53
53
54
54
def ros_msg_loader_str (msg_type ):
55
55
"""
56
- Wrapper for the :func:`ros_msg_loader` to treat string type command line arguments
56
+ Wrapper for the :func:`ros_msg_loader` to treat string type command line arguments.
57
57
58
- :param msg_type: A string type ROS message type (e.g. "Log")
59
- :return: The :func:`ros_msg_loader` function
58
+ :param msg_type: A string type ROS message type (e.g. "Log").
59
+ :return: The :func:`ros_msg_loader` function.
60
60
"""
61
61
type_dict = ros_type_to_dict (msg_type )
62
62
if type_dict :
@@ -70,8 +70,8 @@ def create_publisher(topic, msg_type):
70
70
Create an instance of a ROS publisher object an initialize it.
71
71
72
72
:param topic: The ROS topic that the publisher object is going to write in.
73
- :param msg_type: ROS message type (e.g. Log)
74
- :return: The newly created publisher object
73
+ :param msg_type: ROS message type (e.g. Log).
74
+ :return: The newly created publisher object.
75
75
"""
76
76
pub = rospy .Publisher (topic , msg_type , queue_size = 10 )
77
77
rospy .init_node ('fuzzer_node' , anonymous = False )
@@ -82,8 +82,8 @@ def map_ros_types(ros_class):
82
82
"""
83
83
A recursive function that maps ROS message fields to Hypothesis strategies.
84
84
85
- :param ros_class: The ROS class to be fuzzed
86
- :return: A function that generates Hypothesis strategies for a given ROS message type
85
+ :param ros_class: The ROS class to be fuzzed.
86
+ :return: A function that generates Hypothesis strategies for a given ROS message type.
87
87
"""
88
88
strategy_dict = {}
89
89
slot_names = ros_class .__slots__
@@ -112,10 +112,10 @@ def parse_basic_arrays(s_name, type_dict, strategy_dict):
112
112
"""
113
113
Generate Hypothesis strategies for array types.
114
114
115
- :param s_name: Slot name to be parsed
115
+ :param s_name: Slot name to be parsed.
116
116
:param type_dict: A dictionary which values say if the ROS message type is complex (not basic), which is its parent
117
- ROS message module, its type, if it is an array and if so, its size
118
- :param strategy_dict: A pointer to a dictionary to be filled with Hypothesis strategies
117
+ ROS message module, its type, if it is an array and if so, its size.
118
+ :param strategy_dict: A pointer to a dictionary to be filled with Hypothesis strategies.
119
119
"""
120
120
if type_dict ['array_size' ]:
121
121
array_size = int (type_dict ['array_size' ])
@@ -132,10 +132,10 @@ def parse_complex_types(s_name, type_dict, strategy_dict):
132
132
"""
133
133
Generate Hypothesis strategies for complex ROS types.
134
134
135
- :param s_name: Slot name to be parsed
135
+ :param s_name: Slot name to be parsed.
136
136
:param type_dict: A dictionary which values say if the ROS message type is complex (not basic), which is its parent
137
- ROS message module, its type, if it is an array and if so, its size
138
- :param strategy_dict: A pointer to a dictionary to be filled with Hypothesis strategies
137
+ ROS message module, its type, if it is an array and if so, its size.
138
+ :param strategy_dict: A pointer to a dictionary to be filled with Hypothesis strategies.
139
139
"""
140
140
if not type_dict ['array' ]:
141
141
strategy_dict [s_name ] = map_ros_types (ros_msg_loader (type_dict ))
@@ -153,9 +153,9 @@ def dynamic_strategy_generator_ros(draw, ros_class, strategy_dict): # This gene
153
153
"""
154
154
Generates Hypothesis strategies for a certain ROS class.
155
155
156
- :param ros_class: The ROS class to be filed with fuzzed values
157
- :param strategy_dict:
158
- :return: A pointer to a dictionary filled with Hypothesis strategies
156
+ :param ros_class: The ROS class to be filed with fuzzed values.
157
+ :param strategy_dict: Strategy dictionary.
158
+ :return: A pointer to a dictionary filled with Hypothesis strategies.
159
159
"""
160
160
aux_obj = ros_class ()
161
161
for key , value in strategy_dict .iteritems ():
0 commit comments