Skip to content

Commit 6cf9c8c

Browse files
committed
allow tuple iterable along with list
1 parent 6e9b4d9 commit 6cf9c8c

14 files changed

Lines changed: 50 additions & 50 deletions

File tree

build/templates/_converters.py.mako

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,16 +339,16 @@ def convert_comma_separated_string_to_list(comma_separated_string):
339339

340340

341341
def convert_list_to_comma_separated_string(list_of_strings):
342-
'''Convert a list of strings into a comma-separated string.
342+
'''Convert a list or tuple of strings into a comma-separated string.
343343

344344
Args:
345-
list_of_strings (list[str]): List of strings.
345+
list_of_strings (list or tuple of str): List or tuple of strings.
346346

347347
Returns:
348348
str: Comma-separated string.
349349
'''
350-
if not isinstance(list_of_strings, list) or not all(isinstance(item, str) for item in list_of_strings):
351-
raise TypeError('Input must be a list of str')
350+
if not isinstance(list_of_strings, (list, tuple)) or not all(isinstance(item, str) for item in list_of_strings):
351+
raise TypeError('Input must be a list or tuple of str')
352352
return ','.join(list_of_strings)
353353

354354

generated/nidcpower/nidcpower/_converters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,16 +330,16 @@ def convert_comma_separated_string_to_list(comma_separated_string):
330330

331331

332332
def convert_list_to_comma_separated_string(list_of_strings):
333-
'''Convert a list of strings into a comma-separated string.
333+
'''Convert a list or tuple of strings into a comma-separated string.
334334
335335
Args:
336-
list_of_strings (list[str]): List of strings.
336+
list_of_strings (list or tuple of str): List or tuple of strings.
337337
338338
Returns:
339339
str: Comma-separated string.
340340
'''
341-
if not isinstance(list_of_strings, list) or not all(isinstance(item, str) for item in list_of_strings):
342-
raise TypeError('Input must be a list of str')
341+
if not isinstance(list_of_strings, (list, tuple)) or not all(isinstance(item, str) for item in list_of_strings):
342+
raise TypeError('Input must be a list or tuple of str')
343343
return ','.join(list_of_strings)
344344

345345

generated/nidigital/nidigital/_converters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,16 @@ def convert_comma_separated_string_to_list(comma_separated_string):
329329

330330

331331
def convert_list_to_comma_separated_string(list_of_strings):
332-
'''Convert a list of strings into a comma-separated string.
332+
'''Convert a list or tuple of strings into a comma-separated string.
333333
334334
Args:
335-
list_of_strings (list[str]): List of strings.
335+
list_of_strings (list or tuple of str): List or tuple of strings.
336336
337337
Returns:
338338
str: Comma-separated string.
339339
'''
340-
if not isinstance(list_of_strings, list) or not all(isinstance(item, str) for item in list_of_strings):
341-
raise TypeError('Input must be a list of str')
340+
if not isinstance(list_of_strings, (list, tuple)) or not all(isinstance(item, str) for item in list_of_strings):
341+
raise TypeError('Input must be a list or tuple of str')
342342
return ','.join(list_of_strings)
343343

344344

generated/nidmm/nidmm/_converters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,16 @@ def convert_comma_separated_string_to_list(comma_separated_string):
329329

330330

331331
def convert_list_to_comma_separated_string(list_of_strings):
332-
'''Convert a list of strings into a comma-separated string.
332+
'''Convert a list or tuple of strings into a comma-separated string.
333333
334334
Args:
335-
list_of_strings (list[str]): List of strings.
335+
list_of_strings (list or tuple of str): List or tuple of strings.
336336
337337
Returns:
338338
str: Comma-separated string.
339339
'''
340-
if not isinstance(list_of_strings, list) or not all(isinstance(item, str) for item in list_of_strings):
341-
raise TypeError('Input must be a list of str')
340+
if not isinstance(list_of_strings, (list, tuple)) or not all(isinstance(item, str) for item in list_of_strings):
341+
raise TypeError('Input must be a list or tuple of str')
342342
return ','.join(list_of_strings)
343343

344344

generated/nifake/nifake/_converters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,16 +330,16 @@ def convert_comma_separated_string_to_list(comma_separated_string):
330330

331331

332332
def convert_list_to_comma_separated_string(list_of_strings):
333-
'''Convert a list of strings into a comma-separated string.
333+
'''Convert a list or tuple of strings into a comma-separated string.
334334
335335
Args:
336-
list_of_strings (list[str]): List of strings.
336+
list_of_strings (list or tuple of str): List or tuple of strings.
337337
338338
Returns:
339339
str: Comma-separated string.
340340
'''
341-
if not isinstance(list_of_strings, list) or not all(isinstance(item, str) for item in list_of_strings):
342-
raise TypeError('Input must be a list of str')
341+
if not isinstance(list_of_strings, (list, tuple)) or not all(isinstance(item, str) for item in list_of_strings):
342+
raise TypeError('Input must be a list or tuple of str')
343343
return ','.join(list_of_strings)
344344

345345

generated/nifake/nifake/unit_tests/test_converters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,4 +418,4 @@ def test_convert_list_to_comma_separated_string():
418418
def test_convert_list_to_comma_separated_string_invalid_input():
419419
with pytest.raises(TypeError) as error_info:
420420
_converters.convert_list_to_comma_separated_string('PinA,PinB,PinC')
421-
assert str(error_info.value) == 'Input must be a list of str'
421+
assert str(error_info.value) == 'Input must be a list or tuple of str'

generated/nifgen/nifgen/_converters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,16 @@ def convert_comma_separated_string_to_list(comma_separated_string):
329329

330330

331331
def convert_list_to_comma_separated_string(list_of_strings):
332-
'''Convert a list of strings into a comma-separated string.
332+
'''Convert a list or tuple of strings into a comma-separated string.
333333
334334
Args:
335-
list_of_strings (list[str]): List of strings.
335+
list_of_strings (list or tuple of str): List or tuple of strings.
336336
337337
Returns:
338338
str: Comma-separated string.
339339
'''
340-
if not isinstance(list_of_strings, list) or not all(isinstance(item, str) for item in list_of_strings):
341-
raise TypeError('Input must be a list of str')
340+
if not isinstance(list_of_strings, (list, tuple)) or not all(isinstance(item, str) for item in list_of_strings):
341+
raise TypeError('Input must be a list or tuple of str')
342342
return ','.join(list_of_strings)
343343

344344

generated/nimodinst/nimodinst/_converters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,16 @@ def convert_comma_separated_string_to_list(comma_separated_string):
329329

330330

331331
def convert_list_to_comma_separated_string(list_of_strings):
332-
'''Convert a list of strings into a comma-separated string.
332+
'''Convert a list or tuple of strings into a comma-separated string.
333333
334334
Args:
335-
list_of_strings (list[str]): List of strings.
335+
list_of_strings (list or tuple of str): List or tuple of strings.
336336
337337
Returns:
338338
str: Comma-separated string.
339339
'''
340-
if not isinstance(list_of_strings, list) or not all(isinstance(item, str) for item in list_of_strings):
341-
raise TypeError('Input must be a list of str')
340+
if not isinstance(list_of_strings, (list, tuple)) or not all(isinstance(item, str) for item in list_of_strings):
341+
raise TypeError('Input must be a list or tuple of str')
342342
return ','.join(list_of_strings)
343343

344344

generated/nirfsg/nirfsg/_converters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,16 @@ def convert_comma_separated_string_to_list(comma_separated_string):
329329

330330

331331
def convert_list_to_comma_separated_string(list_of_strings):
332-
'''Convert a list of strings into a comma-separated string.
332+
'''Convert a list or tuple of strings into a comma-separated string.
333333
334334
Args:
335-
list_of_strings (list[str]): List of strings.
335+
list_of_strings (list or tuple of str): List or tuple of strings.
336336
337337
Returns:
338338
str: Comma-separated string.
339339
'''
340-
if not isinstance(list_of_strings, list) or not all(isinstance(item, str) for item in list_of_strings):
341-
raise TypeError('Input must be a list of str')
340+
if not isinstance(list_of_strings, (list, tuple)) or not all(isinstance(item, str) for item in list_of_strings):
341+
raise TypeError('Input must be a list or tuple of str')
342342
return ','.join(list_of_strings)
343343

344344

generated/niscope/niscope/_converters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,16 @@ def convert_comma_separated_string_to_list(comma_separated_string):
329329

330330

331331
def convert_list_to_comma_separated_string(list_of_strings):
332-
'''Convert a list of strings into a comma-separated string.
332+
'''Convert a list or tuple of strings into a comma-separated string.
333333
334334
Args:
335-
list_of_strings (list[str]): List of strings.
335+
list_of_strings (list or tuple of str): List or tuple of strings.
336336
337337
Returns:
338338
str: Comma-separated string.
339339
'''
340-
if not isinstance(list_of_strings, list) or not all(isinstance(item, str) for item in list_of_strings):
341-
raise TypeError('Input must be a list of str')
340+
if not isinstance(list_of_strings, (list, tuple)) or not all(isinstance(item, str) for item in list_of_strings):
341+
raise TypeError('Input must be a list or tuple of str')
342342
return ','.join(list_of_strings)
343343

344344

0 commit comments

Comments
 (0)