Show More
@@ -173,15 +173,15 b' class InteractiveShellApp(Configurable):' | |||||
173 | module_to_run = Unicode('', config=True, |
|
173 | module_to_run = Unicode('', config=True, | |
174 | help="Run the module as a script." |
|
174 | help="Run the module as a script." | |
175 | ) |
|
175 | ) | |
176 | gui = CaselessStrEnum(gui_keys, config=True, |
|
176 | gui = CaselessStrEnum(gui_keys, config=True, allow_none=True, | |
177 | help="Enable GUI event loop integration with any of {0}.".format(gui_keys) |
|
177 | help="Enable GUI event loop integration with any of {0}.".format(gui_keys) | |
178 | ) |
|
178 | ) | |
179 | matplotlib = CaselessStrEnum(backend_keys, |
|
179 | matplotlib = CaselessStrEnum(backend_keys, allow_none=True, | |
180 | config=True, |
|
180 | config=True, | |
181 | help="""Configure matplotlib for interactive use with |
|
181 | help="""Configure matplotlib for interactive use with | |
182 | the default matplotlib backend.""" |
|
182 | the default matplotlib backend.""" | |
183 | ) |
|
183 | ) | |
184 | pylab = CaselessStrEnum(backend_keys, |
|
184 | pylab = CaselessStrEnum(backend_keys, allow_none=True, | |
185 | config=True, |
|
185 | config=True, | |
186 | help="""Pre-load matplotlib and numpy for interactive use, |
|
186 | help="""Pre-load matplotlib and numpy for interactive use, | |
187 | selecting a particular matplotlib backend and loop integration. |
|
187 | selecting a particular matplotlib backend and loop integration. |
@@ -109,7 +109,7 b' class ContentsManager(LoggingConfigurable):' | |||||
109 |
|
109 | |||
110 | checkpoints_class = Type(Checkpoints, config=True) |
|
110 | checkpoints_class = Type(Checkpoints, config=True) | |
111 | checkpoints = Instance(Checkpoints, config=True) |
|
111 | checkpoints = Instance(Checkpoints, config=True) | |
112 |
checkpoints_kwargs = Dict( |
|
112 | checkpoints_kwargs = Dict(config=True) | |
113 |
|
113 | |||
114 | def _checkpoints_default(self): |
|
114 | def _checkpoints_default(self): | |
115 | return self.checkpoints_class(**self.checkpoints_kwargs) |
|
115 | return self.checkpoints_class(**self.checkpoints_kwargs) |
@@ -140,7 +140,7 b' class Widget(LoggingConfigurable):' | |||||
140 |
|
140 | |||
141 | _property_lock = Tuple((None, None)) |
|
141 | _property_lock = Tuple((None, None)) | |
142 | _send_state_lock = Int(0) |
|
142 | _send_state_lock = Int(0) | |
143 |
_states_to_send = Set( |
|
143 | _states_to_send = Set() | |
144 | _display_callbacks = Instance(CallbackDispatcher, ()) |
|
144 | _display_callbacks = Instance(CallbackDispatcher, ()) | |
145 | _msg_callbacks = Instance(CallbackDispatcher, ()) |
|
145 | _msg_callbacks = Instance(CallbackDispatcher, ()) | |
146 |
|
146 |
@@ -18,16 +18,16 b' class Box(DOMWidget):' | |||||
18 | # Child widgets in the container. |
|
18 | # Child widgets in the container. | |
19 | # Using a tuple here to force reassignment to update the list. |
|
19 | # Using a tuple here to force reassignment to update the list. | |
20 | # When a proper notifying-list trait exists, that is what should be used here. |
|
20 | # When a proper notifying-list trait exists, that is what should be used here. | |
21 |
children = Tuple(sync=True |
|
21 | children = Tuple(sync=True) | |
22 |
|
22 | |||
23 | _overflow_values = ['visible', 'hidden', 'scroll', 'auto', 'initial', 'inherit', ''] |
|
23 | _overflow_values = ['visible', 'hidden', 'scroll', 'auto', 'initial', 'inherit', ''] | |
24 | overflow_x = CaselessStrEnum( |
|
24 | overflow_x = CaselessStrEnum( | |
25 | values=_overflow_values, |
|
25 | values=_overflow_values, | |
26 |
default_value='' |
|
26 | default_value='', sync=True, help="""Specifies what | |
27 | happens to content that is too large for the rendered region.""") |
|
27 | happens to content that is too large for the rendered region.""") | |
28 | overflow_y = CaselessStrEnum( |
|
28 | overflow_y = CaselessStrEnum( | |
29 | values=_overflow_values, |
|
29 | values=_overflow_values, | |
30 |
default_value='' |
|
30 | default_value='', sync=True, help="""Specifies what | |
31 | happens to content that is too large for the rendered region.""") |
|
31 | happens to content that is too large for the rendered region.""") | |
32 |
|
32 | |||
33 | box_style = CaselessStrEnum( |
|
33 | box_style = CaselessStrEnum( | |
@@ -59,10 +59,10 b' class FlexBox(Box):' | |||||
59 | _locations = ['start', 'center', 'end', 'baseline', 'stretch'] |
|
59 | _locations = ['start', 'center', 'end', 'baseline', 'stretch'] | |
60 | pack = CaselessStrEnum( |
|
60 | pack = CaselessStrEnum( | |
61 | values=_locations, |
|
61 | values=_locations, | |
62 |
default_value='start', |
|
62 | default_value='start', sync=True) | |
63 | align = CaselessStrEnum( |
|
63 | align = CaselessStrEnum( | |
64 | values=_locations, |
|
64 | values=_locations, | |
65 |
default_value='start', |
|
65 | default_value='start', sync=True) | |
66 |
|
66 | |||
67 |
|
67 | |||
68 | def VBox(*pargs, **kwargs): |
|
68 | def VBox(*pargs, **kwargs): |
@@ -130,8 +130,7 b' class FloatSlider(_BoundedFloat):' | |||||
130 | """ |
|
130 | """ | |
131 | _view_name = Unicode('FloatSliderView', sync=True) |
|
131 | _view_name = Unicode('FloatSliderView', sync=True) | |
132 | orientation = CaselessStrEnum(values=['horizontal', 'vertical'], |
|
132 | orientation = CaselessStrEnum(values=['horizontal', 'vertical'], | |
133 | default_value='horizontal', |
|
133 | default_value='horizontal', help="Vertical or horizontal.", sync=True) | |
134 | help="Vertical or horizontal.", allow_none=False, sync=True) |
|
|||
135 | _range = Bool(False, help="Display a range selector", sync=True) |
|
134 | _range = Bool(False, help="Display a range selector", sync=True) | |
136 | readout = Bool(True, help="Display the current value of the slider next to it.", sync=True) |
|
135 | readout = Bool(True, help="Display the current value of the slider next to it.", sync=True) | |
137 | slider_color = Unicode(sync=True) |
|
136 | slider_color = Unicode(sync=True) | |
@@ -285,8 +284,7 b' class FloatRangeSlider(_BoundedFloatRange):' | |||||
285 | """ |
|
284 | """ | |
286 | _view_name = Unicode('FloatSliderView', sync=True) |
|
285 | _view_name = Unicode('FloatSliderView', sync=True) | |
287 | orientation = CaselessStrEnum(values=['horizontal', 'vertical'], |
|
286 | orientation = CaselessStrEnum(values=['horizontal', 'vertical'], | |
288 |
default_value='horizontal', |
|
287 | default_value='horizontal', help="Vertical or horizontal.", sync=True) | |
289 | help="Vertical or horizontal.", sync=True) |
|
|||
290 | _range = Bool(True, help="Display a range selector", sync=True) |
|
288 | _range = Bool(True, help="Display a range selector", sync=True) | |
291 | readout = Bool(True, help="Display the current value of the slider next to it.", sync=True) |
|
289 | readout = Bool(True, help="Display the current value of the slider next to it.", sync=True) | |
292 | slider_color = Unicode(sync=True) |
|
290 | slider_color = Unicode(sync=True) |
@@ -84,8 +84,7 b' class IntSlider(_BoundedInt):' | |||||
84 | """Slider widget that represents a int bounded by a minimum and maximum value.""" |
|
84 | """Slider widget that represents a int bounded by a minimum and maximum value.""" | |
85 | _view_name = Unicode('IntSliderView', sync=True) |
|
85 | _view_name = Unicode('IntSliderView', sync=True) | |
86 | orientation = CaselessStrEnum(values=['horizontal', 'vertical'], |
|
86 | orientation = CaselessStrEnum(values=['horizontal', 'vertical'], | |
87 |
default_value='horizontal', |
|
87 | default_value='horizontal', help="Vertical or horizontal.", sync=True) | |
88 | help="Vertical or horizontal.", sync=True) |
|
|||
89 | _range = Bool(False, help="Display a range selector", sync=True) |
|
88 | _range = Bool(False, help="Display a range selector", sync=True) | |
90 | readout = Bool(True, help="Display the current value of the slider next to it.", sync=True) |
|
89 | readout = Bool(True, help="Display the current value of the slider next to it.", sync=True) | |
91 | slider_color = Unicode(sync=True) |
|
90 | slider_color = Unicode(sync=True) | |
@@ -196,8 +195,7 b' class IntRangeSlider(_BoundedIntRange):' | |||||
196 | """Slider widget that represents a pair of ints between a minimum and maximum value.""" |
|
195 | """Slider widget that represents a pair of ints between a minimum and maximum value.""" | |
197 | _view_name = Unicode('IntSliderView', sync=True) |
|
196 | _view_name = Unicode('IntSliderView', sync=True) | |
198 | orientation = CaselessStrEnum(values=['horizontal', 'vertical'], |
|
197 | orientation = CaselessStrEnum(values=['horizontal', 'vertical'], | |
199 |
default_value='horizontal', |
|
198 | default_value='horizontal', help="Vertical or horizontal.", sync=True) | |
200 | help="Vertical or horizontal.", sync=True) |
|
|||
201 | _range = Bool(True, help="Display a range selector", sync=True) |
|
199 | _range = Bool(True, help="Display a range selector", sync=True) | |
202 | readout = Bool(True, help="Display the current value of the slider next to it.", sync=True) |
|
200 | readout = Bool(True, help="Display the current value of the slider next to it.", sync=True) | |
203 | slider_color = Unicode(sync=True) |
|
201 | slider_color = Unicode(sync=True) |
@@ -106,7 +106,7 b' class MimeBundle(Reference):' | |||||
106 |
|
106 | |||
107 | class ExecuteReply(Reference): |
|
107 | class ExecuteReply(Reference): | |
108 | execution_count = Integer() |
|
108 | execution_count = Integer() | |
109 | status = Enum((u'ok', u'error')) |
|
109 | status = Enum((u'ok', u'error'), default_value=u'ok') | |
110 |
|
110 | |||
111 | def check(self, d): |
|
111 | def check(self, d): | |
112 | Reference.check(self, d) |
|
112 | Reference.check(self, d) | |
@@ -139,7 +139,7 b' class ArgSpec(Reference):' | |||||
139 |
|
139 | |||
140 |
|
140 | |||
141 | class Status(Reference): |
|
141 | class Status(Reference): | |
142 | execution_state = Enum((u'busy', u'idle', u'starting')) |
|
142 | execution_state = Enum((u'busy', u'idle', u'starting'), default_value=u'busy') | |
143 |
|
143 | |||
144 |
|
144 | |||
145 | class CompleteReply(Reference): |
|
145 | class CompleteReply(Reference): | |
@@ -165,7 +165,7 b' class KernelInfoReply(Reference):' | |||||
165 |
|
165 | |||
166 |
|
166 | |||
167 | class IsCompleteReply(Reference): |
|
167 | class IsCompleteReply(Reference): | |
168 | status = Enum((u'complete', u'incomplete', u'invalid', u'unknown')) |
|
168 | status = Enum((u'complete', u'incomplete', u'invalid', u'unknown'), default_value=u'complete') | |
169 |
|
169 | |||
170 | def check(self, d): |
|
170 | def check(self, d): | |
171 | Reference.check(self, d) |
|
171 | Reference.check(self, d) | |
@@ -187,7 +187,7 b' Error = ExecuteReplyError' | |||||
187 |
|
187 | |||
188 |
|
188 | |||
189 | class Stream(Reference): |
|
189 | class Stream(Reference): | |
190 | name = Enum((u'stdout', u'stderr')) |
|
190 | name = Enum((u'stdout', u'stderr'), default_value=u'stdout') | |
191 | text = Unicode() |
|
191 | text = Unicode() | |
192 |
|
192 | |||
193 |
|
193 |
@@ -171,7 +171,7 b' class TaskScheduler(SessionFactory):' | |||||
171 | """ |
|
171 | """ | |
172 | ) |
|
172 | ) | |
173 | scheme_name = Enum(('leastload', 'pure', 'lru', 'plainrandom', 'weighted', 'twobin'), |
|
173 | scheme_name = Enum(('leastload', 'pure', 'lru', 'plainrandom', 'weighted', 'twobin'), | |
174 |
'leastload', config=True, |
|
174 | 'leastload', config=True, | |
175 |
|
|
175 | help="""select the task scheduler scheme [default: Python LRU] | |
176 | Options are: 'pure', 'lru', 'plainrandom', 'weighted', 'twobin','leastload'""" |
|
176 | Options are: 'pure', 'lru', 'plainrandom', 'weighted', 'twobin','leastload'""" | |
177 | ) |
|
177 | ) |
@@ -50,7 +50,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||||
50 | ) |
|
50 | ) | |
51 |
|
51 | |||
52 | image_handler = Enum(('PIL', 'stream', 'tempfile', 'callable'), |
|
52 | image_handler = Enum(('PIL', 'stream', 'tempfile', 'callable'), | |
53 | config=True, help= |
|
53 | config=True, allow_none=True, help= | |
54 | """ |
|
54 | """ | |
55 | Handler for image type output. This is useful, for example, |
|
55 | Handler for image type output. This is useful, for example, | |
56 | when connecting to the kernel in which pylab inline backend is |
|
56 | when connecting to the kernel in which pylab inline backend is | |
@@ -99,7 +99,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||||
99 |
|
99 | |||
100 | mime_preference = List( |
|
100 | mime_preference = List( | |
101 | default_value=['image/png', 'image/jpeg', 'image/svg+xml'], |
|
101 | default_value=['image/png', 'image/jpeg', 'image/svg+xml'], | |
102 |
config=True, |
|
102 | config=True, help= | |
103 | """ |
|
103 | """ | |
104 | Preferred object representation MIME type in order. First |
|
104 | Preferred object representation MIME type in order. First | |
105 | matched MIME type will be used. |
|
105 | matched MIME type will be used. |
@@ -976,8 +976,8 b' class TestInstanceList(TraitTestBase):' | |||||
976 | self.assertIs(self.obj.traits()['value']._trait.klass, Foo) |
|
976 | self.assertIs(self.obj.traits()['value']._trait.klass, Foo) | |
977 |
|
977 | |||
978 | _default_value = [] |
|
978 | _default_value = [] | |
979 |
_good_values = [[Foo(), Foo(), None], |
|
979 | _good_values = [[Foo(), Foo(), None], []] | |
980 | _bad_values = [['1', 2,], '1', [Foo]] |
|
980 | _bad_values = [['1', 2,], '1', [Foo], None] | |
981 |
|
981 | |||
982 | class LenListTrait(HasTraits): |
|
982 | class LenListTrait(HasTraits): | |
983 |
|
983 | |||
@@ -1431,14 +1431,14 b' class TestForwardDeclaredInstanceList(TraitTestBase):' | |||||
1431 | [ForwardDeclaredBar(), ForwardDeclaredBarSub(), None], |
|
1431 | [ForwardDeclaredBar(), ForwardDeclaredBarSub(), None], | |
1432 | [None], |
|
1432 | [None], | |
1433 | [], |
|
1433 | [], | |
1434 | None, |
|
|||
1435 | ] |
|
1434 | ] | |
1436 | _bad_values = [ |
|
1435 | _bad_values = [ | |
1437 | ForwardDeclaredBar(), |
|
1436 | ForwardDeclaredBar(), | |
1438 | [ForwardDeclaredBar(), 3], |
|
1437 | [ForwardDeclaredBar(), 3], | |
1439 | '1', |
|
1438 | '1', | |
1440 | # Note that this is the type, not an instance. |
|
1439 | # Note that this is the type, not an instance. | |
1441 | [ForwardDeclaredBar] |
|
1440 | [ForwardDeclaredBar], | |
|
1441 | None, | |||
1442 | ] |
|
1442 | ] | |
1443 |
|
1443 | |||
1444 | class TestForwardDeclaredTypeList(TraitTestBase): |
|
1444 | class TestForwardDeclaredTypeList(TraitTestBase): | |
@@ -1454,14 +1454,14 b' class TestForwardDeclaredTypeList(TraitTestBase):' | |||||
1454 | [ForwardDeclaredBar, ForwardDeclaredBarSub, None], |
|
1454 | [ForwardDeclaredBar, ForwardDeclaredBarSub, None], | |
1455 | [], |
|
1455 | [], | |
1456 | [None], |
|
1456 | [None], | |
1457 | None, |
|
|||
1458 | ] |
|
1457 | ] | |
1459 | _bad_values = [ |
|
1458 | _bad_values = [ | |
1460 | ForwardDeclaredBar, |
|
1459 | ForwardDeclaredBar, | |
1461 | [ForwardDeclaredBar, 3], |
|
1460 | [ForwardDeclaredBar, 3], | |
1462 | '1', |
|
1461 | '1', | |
1463 | # Note that this is an instance, not the type. |
|
1462 | # Note that this is an instance, not the type. | |
1464 | [ForwardDeclaredBar()] |
|
1463 | [ForwardDeclaredBar()], | |
|
1464 | None, | |||
1465 | ] |
|
1465 | ] | |
1466 | ### |
|
1466 | ### | |
1467 | # End Forward Declaration Tests |
|
1467 | # End Forward Declaration Tests |
@@ -815,7 +815,7 b' class Type(ClassBasedTraitType):' | |||||
815 | may be specified in a string like: 'foo.bar.MyClass'. |
|
815 | may be specified in a string like: 'foo.bar.MyClass'. | |
816 | The string is resolved into real class, when the parent |
|
816 | The string is resolved into real class, when the parent | |
817 | :class:`HasTraits` class is instantiated. |
|
817 | :class:`HasTraits` class is instantiated. | |
818 |
allow_none : bool |
|
818 | allow_none : bool [ default True ] | |
819 | Indicates whether None is allowed as an assignable value. Even if |
|
819 | Indicates whether None is allowed as an assignable value. Even if | |
820 | ``False``, the default value may be ``None``. |
|
820 | ``False``, the default value may be ``None``. | |
821 | """ |
|
821 | """ | |
@@ -912,7 +912,7 b' class Instance(ClassBasedTraitType):' | |||||
912 | Positional arguments for generating the default value. |
|
912 | Positional arguments for generating the default value. | |
913 | kw : dict |
|
913 | kw : dict | |
914 | Keyword arguments for generating the default value. |
|
914 | Keyword arguments for generating the default value. | |
915 | allow_none : bool |
|
915 | allow_none : bool [default True] | |
916 | Indicates whether None is allowed as a value. |
|
916 | Indicates whether None is allowed as a value. | |
917 |
|
917 | |||
918 | Notes |
|
918 | Notes | |
@@ -1334,9 +1334,9 b' class CBool(Bool):' | |||||
1334 | class Enum(TraitType): |
|
1334 | class Enum(TraitType): | |
1335 | """An enum that whose value must be in a given sequence.""" |
|
1335 | """An enum that whose value must be in a given sequence.""" | |
1336 |
|
1336 | |||
1337 |
def __init__(self, values, default_value=None, |
|
1337 | def __init__(self, values, default_value=None, **metadata): | |
1338 | self.values = values |
|
1338 | self.values = values | |
1339 |
super(Enum, self).__init__(default_value, |
|
1339 | super(Enum, self).__init__(default_value, **metadata) | |
1340 |
|
1340 | |||
1341 | def validate(self, obj, value): |
|
1341 | def validate(self, obj, value): | |
1342 | if value in self.values: |
|
1342 | if value in self.values: | |
@@ -1372,7 +1372,7 b' class Container(Instance):' | |||||
1372 | _valid_defaults = SequenceTypes |
|
1372 | _valid_defaults = SequenceTypes | |
1373 | _trait = None |
|
1373 | _trait = None | |
1374 |
|
1374 | |||
1375 |
def __init__(self, trait=None, default_value=None, allow_none= |
|
1375 | def __init__(self, trait=None, default_value=None, allow_none=False, | |
1376 | **metadata): |
|
1376 | **metadata): | |
1377 | """Create a container trait type from a list, set, or tuple. |
|
1377 | """Create a container trait type from a list, set, or tuple. | |
1378 |
|
1378 | |||
@@ -1398,7 +1398,7 b' class Container(Instance):' | |||||
1398 | The default value for the Trait. Must be list/tuple/set, and |
|
1398 | The default value for the Trait. Must be list/tuple/set, and | |
1399 | will be cast to the container type. |
|
1399 | will be cast to the container type. | |
1400 |
|
1400 | |||
1401 |
allow_none : |
|
1401 | allow_none : bool [ default False ] | |
1402 | Whether to allow the value to be None |
|
1402 | Whether to allow the value to be None | |
1403 |
|
1403 | |||
1404 | **metadata : any |
|
1404 | **metadata : any | |
@@ -1468,8 +1468,7 b' class List(Container):' | |||||
1468 | klass = list |
|
1468 | klass = list | |
1469 | _cast_types = (tuple,) |
|
1469 | _cast_types = (tuple,) | |
1470 |
|
1470 | |||
1471 | def __init__(self, trait=None, default_value=None, minlen=0, maxlen=sys.maxsize, |
|
1471 | def __init__(self, trait=None, default_value=None, minlen=0, maxlen=sys.maxsize, **metadata): | |
1472 | allow_none=True, **metadata): |
|
|||
1473 | """Create a List trait type from a list, set, or tuple. |
|
1472 | """Create a List trait type from a list, set, or tuple. | |
1474 |
|
1473 | |||
1475 | The default value is created by doing ``List(default_value)``, |
|
1474 | The default value is created by doing ``List(default_value)``, | |
@@ -1500,7 +1499,7 b' class List(Container):' | |||||
1500 | maxlen : Int [ default sys.maxsize ] |
|
1499 | maxlen : Int [ default sys.maxsize ] | |
1501 | The maximum length of the input list |
|
1500 | The maximum length of the input list | |
1502 |
|
1501 | |||
1503 |
allow_none : |
|
1502 | allow_none : bool [ default False ] | |
1504 | Whether to allow the value to be None |
|
1503 | Whether to allow the value to be None | |
1505 |
|
1504 | |||
1506 | **metadata : any |
|
1505 | **metadata : any | |
@@ -1510,7 +1509,7 b' class List(Container):' | |||||
1510 | self._minlen = minlen |
|
1509 | self._minlen = minlen | |
1511 | self._maxlen = maxlen |
|
1510 | self._maxlen = maxlen | |
1512 | super(List, self).__init__(trait=trait, default_value=default_value, |
|
1511 | super(List, self).__init__(trait=trait, default_value=default_value, | |
1513 |
|
|
1512 | **metadata) | |
1514 |
|
1513 | |||
1515 | def length_error(self, obj, value): |
|
1514 | def length_error(self, obj, value): | |
1516 | e = "The '%s' trait of %s instance must be of length %i <= L <= %i, but a value of %s was specified." \ |
|
1515 | e = "The '%s' trait of %s instance must be of length %i <= L <= %i, but a value of %s was specified." \ | |
@@ -1544,7 +1543,7 b' class Tuple(Container):' | |||||
1544 | _cast_types = (list,) |
|
1543 | _cast_types = (list,) | |
1545 |
|
1544 | |||
1546 | def __init__(self, *traits, **metadata): |
|
1545 | def __init__(self, *traits, **metadata): | |
1547 |
"""Tuple(*traits, default_value=None, |
|
1546 | """Tuple(*traits, default_value=None, **medatata) | |
1548 |
|
1547 | |||
1549 | Create a tuple from a list, set, or tuple. |
|
1548 | Create a tuple from a list, set, or tuple. | |
1550 |
|
1549 | |||
@@ -1575,7 +1574,7 b' class Tuple(Container):' | |||||
1575 | will be cast to a tuple. If `traits` are specified, the |
|
1574 | will be cast to a tuple. If `traits` are specified, the | |
1576 | `default_value` must conform to the shape and type they specify. |
|
1575 | `default_value` must conform to the shape and type they specify. | |
1577 |
|
1576 | |||
1578 |
allow_none : |
|
1577 | allow_none : bool [ default False ] | |
1579 | Whether to allow the value to be None |
|
1578 | Whether to allow the value to be None | |
1580 |
|
1579 | |||
1581 | **metadata : any |
|
1580 | **metadata : any | |
@@ -1606,8 +1605,7 b' class Tuple(Container):' | |||||
1606 | if self._traits and default_value is None: |
|
1605 | if self._traits and default_value is None: | |
1607 | # don't allow default to be an empty container if length is specified |
|
1606 | # don't allow default to be an empty container if length is specified | |
1608 | args = None |
|
1607 | args = None | |
1609 | super(Container,self).__init__(klass=self.klass, args=args, |
|
1608 | super(Container,self).__init__(klass=self.klass, args=args, **metadata) | |
1610 | allow_none=allow_none, **metadata) |
|
|||
1611 |
|
1609 | |||
1612 | def validate_elements(self, obj, value): |
|
1610 | def validate_elements(self, obj, value): | |
1613 | if not self._traits: |
|
1611 | if not self._traits: | |
@@ -1640,7 +1638,7 b' class Tuple(Container):' | |||||
1640 | class Dict(Instance): |
|
1638 | class Dict(Instance): | |
1641 | """An instance of a Python dict.""" |
|
1639 | """An instance of a Python dict.""" | |
1642 |
|
1640 | |||
1643 |
def __init__(self, default_value={}, allow_none= |
|
1641 | def __init__(self, default_value={}, allow_none=False, **metadata): | |
1644 | """Create a dict trait type from a dict. |
|
1642 | """Create a dict trait type from a dict. | |
1645 |
|
1643 | |||
1646 | The default value is created by doing ``dict(default_value)``, |
|
1644 | The default value is created by doing ``dict(default_value)``, | |
@@ -1662,7 +1660,7 b' class Dict(Instance):' | |||||
1662 | class EventfulDict(Instance): |
|
1660 | class EventfulDict(Instance): | |
1663 | """An instance of an EventfulDict.""" |
|
1661 | """An instance of an EventfulDict.""" | |
1664 |
|
1662 | |||
1665 |
def __init__(self, default_value={}, allow_none= |
|
1663 | def __init__(self, default_value={}, allow_none=False, **metadata): | |
1666 | """Create a EventfulDict trait type from a dict. |
|
1664 | """Create a EventfulDict trait type from a dict. | |
1667 |
|
1665 | |||
1668 | The default value is created by doing |
|
1666 | The default value is created by doing | |
@@ -1685,7 +1683,7 b' class EventfulDict(Instance):' | |||||
1685 | class EventfulList(Instance): |
|
1683 | class EventfulList(Instance): | |
1686 | """An instance of an EventfulList.""" |
|
1684 | """An instance of an EventfulList.""" | |
1687 |
|
1685 | |||
1688 |
def __init__(self, default_value=None, allow_none= |
|
1686 | def __init__(self, default_value=None, allow_none=False, **metadata): | |
1689 | """Create a EventfulList trait type from a dict. |
|
1687 | """Create a EventfulList trait type from a dict. | |
1690 |
|
1688 | |||
1691 | The default value is created by doing |
|
1689 | The default value is created by doing |
General Comments 0
You need to be logged in to leave comments.
Login now