@@ -127,28 +127,28 @@ subclass
127127 from traitlets.config.configurable import Configurable
128128 from traitlets import Int, Float, Unicode, Bool
129129
130- class MyClass (Configurable ):
130+ class School (Configurable ):
131131 name = Unicode(' defaultname' , help = " the name of the object" ).tag(config = True )
132132 ranking = Integer(0 , help = " the class's ranking" ).tag(config = True )
133133 value = Float(99.0 )
134134 # The rest of the class implementation would go here..
135135
136- # Construct from config via MyClass (config=..)
136+ # Construct from config via School (config=..)
137137
138- In this example, we see that :class: `MyClass ` has three attributes, two
138+ In this example, we see that :class: `School ` has three attributes, two
139139of which (``name ``, ``ranking ``) can be configured. All of the attributes
140- are given types and default values. If a :class: `MyClass ` is instantiated,
140+ are given types and default values. If a :class: `School ` is instantiated,
141141but not configured, these default values will be used. But let's see how
142142to configure this class in a configuration file
143143
144144.. code-block :: python
145145
146146 # Sample config file
147- c.MyClass .name = ' coolname'
148- c.MyClass .ranking = 10
147+ c.School .name = ' coolname'
148+ c.School .ranking = 10
149149
150150 After this configuration file is loaded, the values set in it will override
151- the class defaults anytime a :class: `MyClass ` is created. Furthermore,
151+ the class defaults anytime a :class: `School ` is created. Furthermore,
152152these attributes will be type checked and validated anytime they are set.
153153This type checking is handled by the :mod: `traitlets ` module,
154154which provides the :class: `~traitlets.Unicode `, :class: `~traitlets.Integer ` and
@@ -167,7 +167,7 @@ attribute of ``c`` is not the actual class, but instead is another
167167
168168.. note ::
169169
170- The careful reader may wonder how the ``ClassName `` (``MyClass `` in
170+ The careful reader may wonder how the ``ClassName `` (``School `` in
171171 the above example) attribute of the configuration object ``c `` gets
172172 created. These attributes are created on the fly by the
173173 :class: `~traitlets.config.Config ` instance, using a simple naming
@@ -191,7 +191,7 @@ JSON configuration file:
191191.. code-block :: json
192192
193193 {
194- "MyClass " : {
194+ "School " : {
195195 "name" : " coolname" ,
196196 "ranking" : 10
197197 }
@@ -218,8 +218,8 @@ example that loads all of the values from the file :file:`base_config.py`:
218218 :caption: examples/ docs/ configs/ base_config.py
219219
220220 c = get_config() # noqa
221- c.MyClass .name = ' coolname '
222- c.MyClass .ranking = 100
221+ c.School .name = ' Harvard '
222+ c.School .ranking = 100
223223
224224 into the configuration file :file: `main_config.py `:
225225
@@ -233,7 +233,7 @@ into the configuration file :file:`main_config.py`:
233233 load_subconfig(' base_config.py' ) # noqa
234234
235235 # Now override one of the values
236- c.MyClass .name = ' bettername'
236+ c.School .name = ' bettername'
237237
238238 In a situation like this the :func: `load_subconfig ` makes sure that the
239239search path for sub-configuration files is inherited from that of the parent.
0 commit comments