Show More
@@ -55,7 +55,7 b' except:' | |||||
55 | from .importstring import import_item |
|
55 | from .importstring import import_item | |
56 | from IPython.utils import py3compat |
|
56 | from IPython.utils import py3compat | |
57 | from IPython.utils import eventful |
|
57 | from IPython.utils import eventful | |
58 | from IPython.utils.py3compat import iteritems |
|
58 | from IPython.utils.py3compat import iteritems, string_types | |
59 | from IPython.testing.skipdoctest import skip_doctest |
|
59 | from IPython.testing.skipdoctest import skip_doctest | |
60 |
|
60 | |||
61 | SequenceTypes = (list, tuple, set, frozenset) |
|
61 | SequenceTypes = (list, tuple, set, frozenset) | |
@@ -133,13 +133,13 b' def parse_notifier_name(name):' | |||||
133 | >>> parse_notifier_name(None) |
|
133 | >>> parse_notifier_name(None) | |
134 | ['anytrait'] |
|
134 | ['anytrait'] | |
135 | """ |
|
135 | """ | |
136 | if isinstance(name, str): |
|
136 | if isinstance(name, string_types): | |
137 | return [name] |
|
137 | return [name] | |
138 | elif name is None: |
|
138 | elif name is None: | |
139 | return ['anytrait'] |
|
139 | return ['anytrait'] | |
140 | elif isinstance(name, (list, tuple)): |
|
140 | elif isinstance(name, (list, tuple)): | |
141 | for n in name: |
|
141 | for n in name: | |
142 | assert isinstance(n, str), "names must be strings" |
|
142 | assert isinstance(n, string_types), "names must be strings" | |
143 | return name |
|
143 | return name | |
144 |
|
144 | |||
145 |
|
145 | |||
@@ -1193,7 +1193,7 b' class ObjectName(TraitType):' | |||||
1193 | def validate(self, obj, value): |
|
1193 | def validate(self, obj, value): | |
1194 | value = self.coerce_str(obj, value) |
|
1194 | value = self.coerce_str(obj, value) | |
1195 |
|
1195 | |||
1196 | if isinstance(value, str) and py3compat.isidentifier(value): |
|
1196 | if isinstance(value, string_types) and py3compat.isidentifier(value): | |
1197 | return value |
|
1197 | return value | |
1198 | self.error(obj, value) |
|
1198 | self.error(obj, value) | |
1199 |
|
1199 | |||
@@ -1202,7 +1202,7 b' class DottedObjectName(ObjectName):' | |||||
1202 | def validate(self, obj, value): |
|
1202 | def validate(self, obj, value): | |
1203 | value = self.coerce_str(obj, value) |
|
1203 | value = self.coerce_str(obj, value) | |
1204 |
|
1204 | |||
1205 | if isinstance(value, str) and py3compat.isidentifier(value, dotted=True): |
|
1205 | if isinstance(value, string_types) and py3compat.isidentifier(value, dotted=True): | |
1206 | return value |
|
1206 | return value | |
1207 | self.error(obj, value) |
|
1207 | self.error(obj, value) | |
1208 |
|
1208 |
General Comments 0
You need to be logged in to leave comments.
Login now