Parameter names

Parameter names can either be set manually or otherwise they will be derived (autocompleted) by the framework:

from hanna import Configurable, String

class Example(Configurable):
    manual = String('custom_name')
    derived = String()
    
Example.manual.name  # "custom_name"
Example.derived.name  # "derived"

By default the autocomplete of parameter names only works inside class definitions. That is if you set a parameter on an existing class then its name won't be autocompleted:

class Example(Configurable):
    pass
    
Example.test = String()
assert Example.test.name is None

Activating autocomplete of parameter names outside of class definitions

If you want to use this feature you can enable it by installing the corresponding add-on:

from hanna.addons import AutocompleteParameterNames
AutocompleteParameterNames.install()

We need to re-import the Configurable class because it was replaced by the add-on and then we can use the feature:

If you want to switch back to default behavior you can uninstall the feature via:

Last updated