Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
min_value = feature.get('min', pylon_feature.GetMin())
min_value = (pylon_feature.GetMin(), min_value)[min_value <= pylon_feature.GetMin()]
widget_kwargs['min'] = min_value
elif(type_name == "bool"):
try:
pylon_feature = getattr(self._camera, feature_name)
except LogicalErrorException:
raise ValueError("Camera doesn't have attribute '{}'".format(feature_name)) from None
widget_kwargs['value'] = feature.get('value', pylon_feature.GetValue())
elif(type_name == "choice_text"):
try:
pylon_feature = getattr(self._camera, feature_name)
except LogicalErrorException:
raise ValueError("Camera doesn't have attribute '{}'".format(feature_name)) from None
widget_kwargs['value'] = feature.get('value', pylon_feature.GetValue())
if('options' not in feature or not isinstance(feature['options'], list)):
raise ValueError("Widget 'choice_text' has mandatory attribute 'options' (list)")
elif(not feature.get('options')):
raise ValueError("Attribute 'options' cannot be empty")
widget_kwargs['options'] = feature.get('options')
if(widget_kwargs['value'] not in widget_kwargs['options']):
warnings.warn("Current value of feature '{}' is '{}', but this value is not in options.".format(feature_name, widget_kwargs['value']))
widget_kwargs['value'] = widget_kwargs['options'][0]
elif(type_name == "h_box"):
content = feature.get('content')
if(content is None):
raise ValueError("Attribute 'content' cannot be empty for type 'h_box'")