コード例 #1
0
    def __init__(self, weight, height, age, sex, impedance):
        self.weight = weight
        self.height = height
        self.age = age
        self.sex = sex
        self.impedance = impedance
        self.scales = bodyScales(age, height, sex, weight)

        # Check for potential out of boundaries
        if self.height > 220:
            print("Height is too high (limit: >220cm) or scale is sleeping")
            sys.stderr.write('Height is over 220cm or scale is sleeping\n')
            exit()
        elif weight < 10 or weight > 200:
            print("Weight is either too low or too high (limits: <10kg and >200kg) or scale is sleeping")
            sys.stderr.write('Weight is above 10kg or below 200kg or scale is sleeping\n')
            exit()
        elif age > 99:
            print("Age is too high (limit >99 years) or scale is sleeping")
            sys.stderr.write('Age is above 99 years or scale is sleeping\n')
            exit()
        elif impedance > 3000:
            print("Impedance is above 3000ohm or scale is sleeping")
            sys.stderr.write('Impedance is above 3000ohm or scale is sleeping\n')
            exit()
コード例 #2
0
 def __init__(self, age, sex, height, weight, bmi, bodyfat, muscle, water, visceral_fat, bone, basal_metabolism, protein):
     self.age = age
     self.sex = sex
     self.height = height
     self.weight = weight
     self.bmi = bmi
     self.bodyfat = bodyfat
     self.muscle = muscle
     self.water = water
     self.visceral_fat = visceral_fat
     self.bone = bone
     self.basal_metabolism = basal_metabolism
     self.protein = protein
     self.scales = bodyScales(age, height, sex, weight)
コード例 #3
0
ファイル: body_metrics.py プロジェクト: milosmilic/Bluetooth
    def __init__(self, weight, height, age, sex, impedance):
        self.weight = weight
        self.height = height
        self.age = age
        self.sex = sex
        self.impedance = impedance
        self.scales = bodyScales(age, height, sex, weight)

        # Check for potential out of boundaries
        if self.height > 220:
            raise Exception("Height is too high (limit: >220cm)")
        elif weight < 10 or weight > 200:
            raise Exception("Weight is either too low or too high (limits: <10kg and >200kg)")
        elif age > 99:
            raise Exception("Age is too high (limit >99 years)")
        elif impedance > 3000:
            raise Exception("Impedance is too high (limit >3000ohm)")