Skip to content

Commit 4af1e69

Browse files
author
Zoltan Beck
committed
Revert "lint fix"
This reverts commit 6e9c991. Signed-off-by: Zoltan Beck <[email protected]>
1 parent 0bc06b4 commit 4af1e69

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

rosidl_runtime_py/convert.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def message_to_ordereddict(
187187
value = getattr(msg, field_name, None)
188188
value = _convert_value(
189189
value, field_type=field_type,
190-
truncate_len=truncate_length, no_arr=no_arr, no_str=no_str)
190+
truncate_length=truncate_length, no_arr=no_arr, no_str=no_str)
191191
d[field_name] = value
192192
return d
193193

@@ -196,54 +196,54 @@ def _convert_value(
196196
value,
197197
*,
198198
field_type=None,
199-
truncate_len=None,
199+
truncate_length=None,
200200
no_arr=False,
201201
no_str=False
202202
):
203203

204204
if isinstance(value, bytes):
205-
if truncate_len is not None and len(value) > truncate_len:
206-
value = ''.join([chr(c) for c in value[:truncate_len]]) + '...'
205+
if truncate_length is not None and len(value) > truncate_length:
206+
value = ''.join([chr(c) for c in value[:truncate_length]]) + '...'
207207
else:
208208
value = ''.join([chr(c) for c in value])
209209
elif isinstance(value, str):
210210
if no_str is True:
211211
value = '<string length: <{0}>>'.format(len(value))
212-
elif truncate_len is not None and len(value) > truncate_len:
213-
value = value[:truncate_len] + '...'
214-
elif isinstance(value, (array.array, numpy.ndarray)) and not no_arr and truncate_len is None:
212+
elif truncate_length is not None and len(value) > truncate_length:
213+
value = value[:truncate_length] + '...'
214+
elif isinstance(value, (array.array, numpy.ndarray)) and not no_arr and truncate_length is None:
215215
value = value.tolist()
216216
elif isinstance(value, (list, tuple, array.array, numpy.ndarray)):
217217
# Since arrays and ndarrays can't contain mixed types convert to list
218218
typename = tuple if isinstance(value, tuple) else list
219219
if no_arr is True and field_type is not None:
220220
value = __abbreviate_array_info(value, field_type)
221-
elif truncate_len is not None and len(value) > truncate_len:
221+
elif truncate_length is not None and len(value) > truncate_length:
222222
# Truncate the sequence
223-
value = value[:truncate_len]
223+
value = value[:truncate_length]
224224
# Truncate every item in the sequence
225225
value = typename(
226-
[_convert_value(v, truncate_len=truncate_len,
226+
[_convert_value(v, truncate_length=truncate_length,
227227
no_arr=no_arr, no_str=no_str) for v in value] + ['...'])
228228
else:
229229
# Truncate every item in the list
230230
value = typename(
231-
[_convert_value(v, truncate_len=truncate_len,
231+
[_convert_value(v, truncate_length=truncate_length,
232232
no_arr=no_arr, no_str=no_str) for v in value])
233233
elif isinstance(value, dict) or isinstance(value, OrderedDict):
234234
# Convert each key and value in the mapping
235235
new_value = {} if isinstance(value, dict) else OrderedDict()
236236
for k, v in value.items():
237237
# Don't truncate keys because that could result in key collisions and data loss
238238
new_value[_convert_value(k)] = _convert_value(
239-
v, truncate_len=truncate_len, no_arr=no_arr, no_str=no_str)
239+
v, truncate_length=truncate_length, no_arr=no_arr, no_str=no_str)
240240
value = new_value
241241
elif isinstance(value, numpy.number):
242242
value = value.item()
243243
elif not isinstance(value, (bool, float, int)):
244244
# Assuming value is a message since it is neither a collection nor a primitive type
245245
value = message_to_ordereddict(
246-
value, truncate_length=truncate_len, no_arr=no_arr, no_str=no_str)
246+
value, truncate_length=truncate_length, no_arr=no_arr, no_str=no_str)
247247
return value
248248

249249

0 commit comments

Comments
 (0)