Show More
@@ -16,17 +16,6 from IPython.utils.py3compat import string_types, iteritems | |||
|
16 | 16 | # some utilities to validate message structure, these might get moved elsewhere |
|
17 | 17 | # if they prove to have more generic utility |
|
18 | 18 | |
|
19 | def validate_string_list(lst): | |
|
20 | """Validate that the input is a list of strings. | |
|
21 | ||
|
22 | Raises ValueError if not.""" | |
|
23 | if not isinstance(lst, list): | |
|
24 | raise ValueError('input %r must be a list' % lst) | |
|
25 | for x in lst: | |
|
26 | if not isinstance(x, string_types): | |
|
27 | raise ValueError('element %r in list must be a string' % x) | |
|
28 | ||
|
29 | ||
|
30 | 19 | def validate_string_dict(dct): |
|
31 | 20 | """Validate that the input is a dict with string keys and values. |
|
32 | 21 |
@@ -40,17 +40,6 class InvalidPortNumber(Exception): | |||
|
40 | 40 | # some utilities to validate message structure, these might get moved elsewhere |
|
41 | 41 | # if they prove to have more generic utility |
|
42 | 42 | |
|
43 | def validate_string_list(lst): | |
|
44 | """Validate that the input is a list of strings. | |
|
45 | ||
|
46 | Raises ValueError if not.""" | |
|
47 | if not isinstance(lst, list): | |
|
48 | raise ValueError('input %r must be a list' % lst) | |
|
49 | for x in lst: | |
|
50 | if not isinstance(x, string_types): | |
|
51 | raise ValueError('element %r in list must be a string' % x) | |
|
52 | ||
|
53 | ||
|
54 | 43 | def validate_string_dict(dct): |
|
55 | 44 | """Validate that the input is a dict with string keys and values. |
|
56 | 45 |
General Comments 0
You need to be logged in to leave comments.
Login now