@@ -114,7 +114,7 @@ def parse(cls, elementTree): # noqa
114
114
if self .index is not None :
115
115
self .index = int (self .index )
116
116
117
- if self .default :
117
+ if self .default is not None :
118
118
try :
119
119
self .default = self .parseValue (self .default )
120
120
except ValueError as e :
@@ -124,7 +124,7 @@ def parse(cls, elementTree): # noqa
124
124
not self .isVector () and not self .isExternalType () and
125
125
self .channel != 'output' ):
126
126
ctk_cli .module .logger .warning (
127
- 'No <default> provided for element of type <%s>' , self .typ )
127
+ 'No <default> provided for element of type <%s> (%s) ' , self .typ , self . name )
128
128
129
129
if self .typ .endswith ('-enumeration' ):
130
130
try :
@@ -158,6 +158,26 @@ def _ctkCliParse(cls, elementTree): # noqa
158
158
159
159
ctk_cli .module .CLIParameters .parse = _ctkCliParse
160
160
161
+ _orig_CLIModule_init = ctk_cli .CLIModule .__init__
162
+
163
+
164
+ def _CLIModule_init (self , path = None , env = None , stream = None ):
165
+ ret = _orig_CLIModule_init (self , path , env , stream )
166
+ indices = set ()
167
+ for param in self .parameters ():
168
+ if param .index is not None :
169
+ idx = int (param .index )
170
+ if idx in indices :
171
+ ctk_cli .module .logger .warning ('Parameter index %d used multiple times' , idx )
172
+ indices .add (idx )
173
+ if len (indices ) and (min (indices ) < 0 or max (indices ) >= len (indices )):
174
+ ctk_cli .module .logger .warning ('Parameter indices are not continuous from 0 upwards' )
175
+
176
+ return ret
177
+
178
+
179
+ ctk_cli .CLIModule .__init__ = _CLIModule_init
161
180
CLIModule = ctk_cli .CLIModule
162
181
182
+
163
183
__all__ = ['CLIModule' ]
0 commit comments