params.py (10355:7565dcd505a4) | params.py (10364:c12ec2a0de52) |
---|---|
1# Copyright (c) 2012-2014 ARM Limited 2# All rights reserved. 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 297 unchanged lines hidden (view full) --- 306 307class VectorParamDesc(ParamDesc): 308 # Convert assigned value to appropriate type. If the RHS is not a 309 # list or tuple, it generates a single-element list. 310 def convert(self, value): 311 if isinstance(value, (list, tuple)): 312 # list: coerce each element into new list 313 tmp_list = [ ParamDesc.convert(self, v) for v in value ] | 1# Copyright (c) 2012-2014 ARM Limited 2# All rights reserved. 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 297 unchanged lines hidden (view full) --- 306 307class VectorParamDesc(ParamDesc): 308 # Convert assigned value to appropriate type. If the RHS is not a 309 # list or tuple, it generates a single-element list. 310 def convert(self, value): 311 if isinstance(value, (list, tuple)): 312 # list: coerce each element into new list 313 tmp_list = [ ParamDesc.convert(self, v) for v in value ] |
314 elif isinstance(value, str): 315 # If input is a csv string 316 tmp_list = [ ParamDesc.convert(self, v) \ 317 for v in value.strip('[').strip(']').split(',') ] |
|
314 else: 315 # singleton: coerce to a single-element list 316 tmp_list = [ ParamDesc.convert(self, value) ] 317 318 if isSimObjectSequence(tmp_list): 319 return SimObjectVector(tmp_list) 320 else: 321 return VectorParamValue(tmp_list) --- 19 unchanged lines hidden (view full) --- 341 342 # This is a helper function for the new config system 343 def __call__(self, value): 344 if isinstance(value, (list, tuple)): 345 # list: coerce each element into new list 346 tmp_list = [ ParamDesc.convert(self, v) for v in value ] 347 elif isinstance(value, str): 348 # If input is a csv string | 318 else: 319 # singleton: coerce to a single-element list 320 tmp_list = [ ParamDesc.convert(self, value) ] 321 322 if isSimObjectSequence(tmp_list): 323 return SimObjectVector(tmp_list) 324 else: 325 return VectorParamValue(tmp_list) --- 19 unchanged lines hidden (view full) --- 345 346 # This is a helper function for the new config system 347 def __call__(self, value): 348 if isinstance(value, (list, tuple)): 349 # list: coerce each element into new list 350 tmp_list = [ ParamDesc.convert(self, v) for v in value ] 351 elif isinstance(value, str): 352 # If input is a csv string |
349 tmp_list = [ ParamDesc.convert(self, v) for v in value.split(',') ] | 353 tmp_list = [ ParamDesc.convert(self, v) \ 354 for v in value.strip('[').strip(']').split(',') ] |
350 else: 351 # singleton: coerce to a single-element list 352 tmp_list = [ ParamDesc.convert(self, value) ] 353 354 return VectorParamValue(tmp_list) 355 356 def swig_module_name(self): 357 return "%s_vector" % self.ptype_str --- 1537 unchanged lines hidden --- | 355 else: 356 # singleton: coerce to a single-element list 357 tmp_list = [ ParamDesc.convert(self, value) ] 358 359 return VectorParamValue(tmp_list) 360 361 def swig_module_name(self): 362 return "%s_vector" % self.ptype_str --- 1537 unchanged lines hidden --- |