(string)
return float(number) * FACTORS.get(unit, 1)
Parse quantity allows to convert the value in the resources spec like:
        resources:
          requests:
            cpu: "100m"
            memory": "200Mi"
          limits:
            memory: "300Mi"
        :param string: str
        :return: float
Parse quantity allows to convert the value in the resources spec like:
        resources:
          requests:
            cpu: "100m"
            memory": "200Mi"
          limits:
            memory: "300Mi"
        :param string: str
        :return: float
Parse quantity allows to convert the value in the resources spec like : resources : requests : cpu : 100m memory : 200Mi limits : memory : 300Mi : param string : str : return : float
def parse_quantity(string):
        """
        Parse quantity allows to convert the value in the resources spec like:
        resources:
          requests:
            cpu: "100m"
            memory": "200Mi"
          limits:
            memory: "300Mi"
        :param string: str
        :return: float
        """
        number, unit = '', ''
        for char in string:
            if char.isdigit() or char == '.':
                number += char
            else:
                unit += char
        return float(number) * FACTORS.get(unit, 1)
def parse_quantity ( string ) : number , unit = '' , '' for char in string : if char . isdigit ( ) or char == '.' : number += char else : unit += char return float ( number ) * FACTORS . get ( unit , 1 )