@@ -161,7 +161,27 @@ def _dec(cls):
161161 {'name' : 'namespace' , 'type' : str , 'doc' : 'the namespace the neurodata_type is defined in' },
162162 is_method = False )
163163def get_class (** kwargs ):
164- """Get the class object of the NWBContainer subclass corresponding to a given neurodata_type.
164+ """
165+ Parse the YAML file for a given neurodata_type that is a subclass of NWBContainer and automatically generate its
166+ python API. This will work for most containers, but is known to not work for descendants of MultiContainerInterface
167+ and DynamicTable, so these must be defined manually (for now). `get_class` infers the API mapping directly from the
168+ specification. If you want to define a custom mapping, you should not use this function and you should define the
169+ class manually.
170+
171+ Examples
172+ --------
173+ Generating and registering an extension is as simple as::
174+
175+ MyClass = get_class('MyClass', 'ndx-my-extension')
176+
177+ `get_class` defines only the `__init__` for the class. In cases where you want to provide additional methods for
178+ querying, plotting, etc. you can still use `get_class` and attach methods to the class after-the-fact, e.g.::
179+
180+ def get_sum(self, a, b):
181+ return self.feat1 + self.feat2
182+
183+ MyClass.get_sum = get_sum
184+
165185 """
166186 neurodata_type , namespace = getargs ('neurodata_type' , 'namespace' , kwargs )
167187 return __TYPE_MAP .get_container_cls (namespace , neurodata_type )
0 commit comments