Let's say i have this enum class :
from enum import Enum
class HsvValues(Enum):
BROWN = ('6, 63, 0', '23, 255, 81')
GREY = ('23, 0, 0', '80, 105, 107')
In my other class i currently have this function to get the lower hsv bound and upper hsv bound :
def get_hsv_bounds(color):
lower_hsv = ''
upper_hsv = ''
if (color == 'BROWN'):
lower_hsv = list(map(int, HsvValues.BROWN.value[0].split(',')))
upper_hsv = list(map(int, HsvValues.BROWN.value[1].split(',')))
if (color == 'GREY'):
lower_hsv = list(map(int, HsvValues.GREY.value[0].split(',')))
upper_hsv = list(map(int, HsvValues.GREY.value[1].split(',')))
return lower_hsv, upper_hsv
But i would like to be able to only call a getter method to get the lower bound value of the hsv value which is [0] and the upper bound value of the hsv which is [1]. I would like to do something like that which wouldn't require all the "if":
lower_hsv = color.get_lower_bound()
upper_hsv = color.get_upper_bound()
How can i do that in my HsvValues enum class ? I am really unsure on how to approach this. Thanks for your help.