Exemplo n.º 1
0
 def __init__(self,
              hertz=None,
              kilohertz=None,
              megahertz=None,
              gigahertz=None):
     if not is_none(hertz):
         self.hertz = hertz
         self.kilohertz = hertz / 1000
         self.megahertz = hertz / 1e+6
         self.gigahertz = hertz / 1e+9
     elif not is_none(kilohertz):
         self.hertz = kilohertz * 1000
         self.kilohertz = kilohertz
         self.megahertz = kilohertz / 1000
         self.gigahertz = kilohertz / 1e+6
     elif not is_none(megahertz):
         self.hertz = megahertz * 1e+6
         self.kilohertz = megahertz * 1000
         self.megahertz = megahertz
         self.gigahertz = megahertz / 1000
     elif not is_none(gigahertz):
         self.hertz = gigahertz * 1e+9
         self.kilohertz = gigahertz * 1e+6
         self.megahertz = gigahertz * 1000
         self.gigahertz = gigahertz
     else:
         raise TypeError(f"{self.__class__.__name__} expected 1 argument.")
Exemplo n.º 2
0
 def __init__(self,
              miles_per_gallon=None,
              miles_per_gallon_imperial=None,
              kilometer_per_liter=None,
              liter_per_100_kilometers=None):
     if not is_none(miles_per_gallon):
         self.miles_per_gallon = miles_per_gallon
         self.miles_per_gallon_imperial = miles_per_gallon * 1.201
         self.kilometer_per_liter = miles_per_gallon / 2.352
         self.liter_per_100_kilometers = 235.215 / (miles_per_gallon)
     elif not is_none(miles_per_gallon_imperial):
         self.miles_per_gallon = miles_per_gallon_imperial / 1.201
         self.miles_per_gallon_imperial = miles_per_gallon_imperial
         self.kilometer_per_liter = miles_per_gallon_imperial / 2.825
         self.liter_per_100_kilometers = 282.481 / (
             miles_per_gallon_imperial)
     elif not is_none(kilometer_per_liter):
         self.miles_per_gallon = kilometer_per_liter * 2.352
         self.miles_per_gallon_imperial = kilometer_per_liter * 2.825
         self.kilometer_per_liter = kilometer_per_liter
         self.liter_per_100_kilometers = 100 / (kilometer_per_liter)
     elif not is_none(liter_per_100_kilometers):
         self.miles_per_gallon = 235.215 / (liter_per_100_kilometers)
         self.miles_per_gallon_imperial = 282.481 / (
             liter_per_100_kilometers)
         self.kilometer_per_liter = 100 / (liter_per_100_kilometers)
         self.liter_per_100_kilometers = liter_per_100_kilometers
     else:
         raise TypeError(f"{self.__class__.__name__} expected 1 argument.")
Exemplo n.º 3
0
 def __init__(self,
              bar=None,
              pascal=None,
              pound_force_per_square_inch=None,
              standard_atmosphere=None,
              torr=None):
     if not is_none(bar):
         self.bar = bar
         self.pascal = bar * 100000
         self.pound_force_per_square_inch = bar * 14.504
         self.standard_atmosphere = bar / 1.013
         self.torr = bar * 750
     elif not is_none(pascal):
         self.bar = pascal / 133
         self.pascal = pascal
         self.pound_force_per_square_inch = pascal / 6895
         self.standard_atmosphere = pascal / 101325
         self.torr = pascal / 133
     elif not is_none(pound_force_per_square_inch):
         self.bar = pound_force_per_square_inch / 14.504
         self.pascal = pound_force_per_square_inch * 6895
         self.pound_force_per_square_inch = pound_force_per_square_inch
         self.standard_atmosphere = pound_force_per_square_inch / 14.696
         self.torr = pound_force_per_square_inch * 51.715
     elif not is_none(standard_atmosphere):
         self.bar = standard_atmosphere * 1.013
         self.pascal = standard_atmosphere * 101325
         self.pound_force_per_square_inch = standard_atmosphere * 14.696
         self.standard_atmosphere = standard_atmosphere
         self.torr = standard_atmosphere * 760
     elif not is_none(torr):
         self.bar = torr / 750
         self.pascal = torr * 133
         self.pound_force_per_square_inch = torr / 51.715
         self.standard_atmosphere = torr / 760
         self.torr = torr
     else:
         raise TypeError(f"{self.__class__.__name__} expected 1 argument.")
Exemplo n.º 4
0
 def __init__(self,
              miles_per_hour=None,
              foot_per_second=None,
              meter_per_second=None,
              kilometer_per_hour=None,
              knot=None):
     if not is_none(miles_per_hour):
         self.miles_per_hour = miles_per_hour
         self.foot_per_second = miles_per_hour * 1.467
         self.meter_per_second = miles_per_hour / 2.237
         self.kilometer_per_hour = miles_per_hour * 1.609
         self.knot = miles_per_hour / 1.151
     elif not is_none(foot_per_second):
         self.miles_per_hour = foot_per_second / 1.467
         self.foot_per_second = foot_per_second
         self.meter_per_second = foot_per_second / 3.281
         self.kilometer_per_hour = foot_per_second * 1.097
         self.knot = foot_per_second / 1.688
     elif not is_none(meter_per_second):
         self.miles_per_hour = meter_per_second * 2.237
         self.foot_per_second = meter_per_second * 3.281
         self.meter_per_second = meter_per_second
         self.kilometer_per_hour = meter_per_second * 3.6
         self.knot = meter_per_second * 1.944
     elif not is_none(kilometer_per_hour):
         self.miles_per_hour = kilometer_per_hour / 1.609
         self.foot_per_second = kilometer_per_hour / 1.097
         self.meter_per_second = kilometer_per_hour / 3.6
         self.kilometer_per_hour = kilometer_per_hour
         self.knot = kilometer_per_hour / 1.852
     elif not is_none(knot):
         self.miles_per_hour = knot * 1.151
         self.foot_per_second = knot * 1.688
         self.meter_per_second = knot / 1.944
         self.kilometer_per_hour = knot * 1.852
         self.knot = knot
     else:
         raise TypeError(f"{self.__class__.__name__} expected 1 argument.")
Exemplo n.º 5
0
 def __init__(self,
              degree=None,
              gradian=None,
              milliradian=None,
              minute_of_arc=None,
              radian=None,
              second_of_arc=None):
     if not is_none(degree):
         self.degree = degree
         self.gradian = degree * 200 / 180
         self.milliradian = degree * 1000 * pi / 180
         self.minute_of_arc = degree * 60
         self.radian = degree * pi / 180
         self.second_of_arc = degree * 3600
     elif not is_none(gradian):
         self.degree = gradian * 180 / 200
         self.gradian = gradian
         self.milliradian = gradian * 1000 * pi / 200
         self.minute_of_arc = gradian * 54
         self.radian = gradian * pi / 200
         self.second_of_arc = gradian * 3240
     elif not is_none(milliradian):
         self.degree = milliradian * (3600 * 180) / 1000 * pi
         self.gradian = milliradian * 200 / 1000 * pi
         self.milliradian = milliradian
         self.minute_of_arc = milliradian * (60 * 180) / 1000 * pi
         self.radian = milliradian / 1000
         self.second_of_arc = milliradian * (3600 * 180) / 1000 * pi
     elif not is_none(minute_of_arc):
         self.degree = minute_of_arc / 60
         self.gradian = minute_of_arc / 54
         self.milliradian = minute_of_arc * 1000 * pi / (60 * 180)
         self.minute_of_arc = minute_of_arc
         self.radian = minute_of_arc * pi / (60 * 180)
         self.second_of_arc = minute_of_arc * 60
     elif not is_none(radian):
         self.degree = radian * 180 / pi
         self.gradian = radian * 200 / pi
         self.milliradian = radian * 1000
         self.minute_of_arc = radian * (60 * 180) / pi
         self.radian = radian
         self.second_of_arc = radian * (3600 * 180) / pi
     elif not is_none(second_of_arc):
         self.degree = second_of_arc / 3600
         self.gradian = second_of_arc / 3240
         self.milliradian = second_of_arc * 1000 * pi / (180 * 3600)
         self.minute_of_arc = second_of_arc / 60
         self.radian = second_of_arc * pi / (180 * 3600)
         self.second_of_arc = second_of_arc
     else:
         raise TypeError(f"{self.__class__.__name__} expected 1 argument.")
Exemplo n.º 6
0
 def __init__(self,
              kilometer=None,
              meter=None,
              centimeter=None,
              millimeter=None,
              micrometer=None,
              nanometer=None,
              mile=None,
              yard=None,
              foot=None,
              inch=None,
              nautical_mile=None):
     if not is_none(kilometer):
         self.kilometer = kilometer
         self.meter = kilometer * 1000
         self.centimeter = kilometer * 100000
         self.millimeter = kilometer * 1e+6
         self.micrometer = kilometer * 1e+9
         self.nanometer = kilometer * 1e+12
         self.mile = kilometer / 1.609
         self.yard = kilometer * 1094
         self.foot = kilometer * 3281
         self.inch = kilometer * 39370
         self.nautical_mile = kilometer / 1.852
     elif not is_none(meter):
         self.kilometer = meter / 1000
         self.meter = meter
         self.centimeter = meter * 100
         self.millimeter = meter * 1000
         self.micrometer = meter * 1e+6
         self.nanometer = meter * 1e+9
         self.mile = meter / 1609
         self.yard = meter * 1.094
         self.foot = meter * 3.281
         self.inch = meter * 39.37
         self.nautical_mile = meter / 1852
     elif not is_none(centimeter):
         self.kilometer = centimeter / 100000
         self.meter = centimeter / 100
         self.centimeter = centimeter
         self.millimeter = centimeter * 10
         self.micrometer = centimeter * 10000
         self.nanometer = centimeter * 1e+7
         self.mile = centimeter / 160934
         self.yard = centimeter / 91.44
         self.foot = centimeter / 30.48
         self.inch = centimeter / 2.54
         self.nautical_mile = centimeter / 185200
     elif not is_none(millimeter):
         self.kilometer = millimeter / 1e+6
         self.meter = millimeter / 1000
         self.centimeter = millimeter / 10
         self.millimeter = millimeter
         self.micrometer = millimeter * 1000
         self.nanometer = millimeter * 1e+6
         self.mile = millimeter / 1.609e+6
         self.yard = millimeter / 914
         self.foot = millimeter / 305
         self.inch = millimeter / 25.4
         self.nautical_mile = millimeter / 1.852e+6
     elif not is_none(micrometer):
         self.kilometer = micrometer / 1e+9
         self.meter = micrometer / 1e+6
         self.centimeter = micrometer / 10000
         self.millimeter = micrometer / 1000
         self.micrometer = micrometer
         self.nanometer = micrometer * 1000
         self.mile = micrometer / 1.609e+9
         self.yard = micrometer / 914400
         self.foot = micrometer / 304800
         self.inch = micrometer / 25400
         self.nautical_mile = micrometer / 1.852e+9
     elif not is_none(nanometer):
         self.kilometer = nanometer / 1e+12
         self.meter = nanometer / 1e+9
         self.centimeter = nanometer / 1e+7
         self.millimeter = nanometer / 1e+6
         self.micrometer = nanometer / 1000
         self.nanometer = nanometer
         self.mile = nanometer / 1.609e+12
         self.yard = nanometer / 9.144e+8
         self.foot = nanometer / 3.048e+8
         self.inch = nanometer / 2.54e+7
         self.nautical_mile = nanometer / 1.852e+12
     elif not is_none(mile):
         self.kilometer = mile * 1.609
         self.meter = mile * 1609
         self.centimeter = mile * 160934
         self.millimeter = mile * 1.609e+6
         self.micrometer = mile * 1.609e+9
         self.nanometer = mile * 1.609e+12
         self.mile = mile
         self.yard = mile * 1760
         self.foot = mile * 5280
         self.inch = mile * 63360
         self.nautical_mile = mile / 1.151
     elif not is_none(yard):
         self.kilometer = yard / 1094
         self.meter = yard / 1.094
         self.centimeter = yard * 91.44
         self.millimeter = yard * 914
         self.micrometer = yard * 914400
         self.nanometer = yard * 9.144e+8
         self.mile = yard / 1760
         self.yard = yard
         self.foot = yard * 3
         self.inch = yard * 36
         self.nautical_mile = yard / 2025
     elif not is_none(foot):
         self.kilometer = foot / 3281
         self.meter = foot / 3.281
         self.centimeter = foot * 30.48
         self.millimeter = foot * 305
         self.micrometer = foot * 304800
         self.nanometer = foot * 3.048e+8
         self.mile = foot / 5280
         self.yard = foot / 3
         self.foot = foot
         self.inch = foot * 12
         self.nautical_mile = foot / 6076
     elif not is_none(inch):
         self.kilometer = inch / 39370
         self.meter = inch / 39.37
         self.centimeter = inch * 2.54
         self.millimeter = inch * 25.4
         self.micrometer = inch * 25400
         self.nanometer = inch * 2.54e+7
         self.mile = inch / 63360
         self.yard = inch / 36
         self.foot = inch / 12
         self.inch = inch
         self.nautical_mile = inch / 72913
     elif not is_none(nautical_mile):
         self.kilometer = nautical_mile * 1.852
         self.meter = nautical_mile * 1852
         self.centimeter = nautical_mile * 185200
         self.millimeter = nautical_mile * 1.852e+6
         self.micrometer = nautical_mile * 1.852e+9
         self.nanometer = nautical_mile * 1.852e+12
         self.mile = nautical_mile * 1.151
         self.yard = nautical_mile * 2025
         self.foot = nautical_mile * 6076
         self.inch = nautical_mile * 72913
         self.nautical_mile = nautical_mile
     else:
         raise TypeError(f"{self.__class__.__name__} expected 1 argument.")
 def __init__(self,
              bit_per_second=None,
              kilobit_per_second=None,
              kilobyte_per_second=None,
              kibibit_per_second=None,
              megabit_per_second=None,
              megabyte_per_second=None,
              mebibit_per_second=None,
              gigabit_per_second=None,
              gigabyte_per_second=None,
              gibibit_per_second=None,
              terabit_per_second=None,
              terabyte_per_second=None,
              tebibit_per_second=None):
     if not is_none(bit_per_second):
         self.bit_per_second = bit_per_second
         self.kilobit_per_second = bit_per_second / 1000
         self.kilobyte_per_second = bit_per_second / 8000
         self.kibibit_per_second = bit_per_second / 1024
         self.megabit_per_second = bit_per_second / 1e+6
         self.megabyte_per_second = bit_per_second / 8e+6
         self.mebibit_per_second = bit_per_second / 1.049e+6
         self.gigabit_per_second = bit_per_second / 1e+9
         self.gigabyte_per_second = bit_per_second / 8e+9
         self.gibibit_per_second = bit_per_second / 1.074e+9
         self.terabit_per_second = bit_per_second / 1e+12
         self.terabyte_per_second = bit_per_second / 8e+12
         self.tebibit_per_second = bit_per_second / 1.1e+12
     elif not is_none(kilobit_per_second):
         self.bit_per_second = kilobit_per_second * 1000
         self.kilobit_per_second = kilobit_per_second
         self.kilobyte_per_second = kilobit_per_second / 8
         self.kibibit_per_second = kilobit_per_second / 1.024
         self.megabit_per_second = kilobit_per_second / 1000
         self.megabyte_per_second = kilobit_per_second / 8000
         self.mebibit_per_second = kilobit_per_second / 1049
         self.gigabit_per_second = kilobit_per_second / 1e+6
         self.gigabyte_per_second = kilobit_per_second / 8e+6
         self.gibibit_per_second = kilobit_per_second / 1.074e+6
         self.terabit_per_second = kilobit_per_second / 1e+9
         self.terabyte_per_second = kilobit_per_second / 8e+9
         self.tebibit_per_second = kilobit_per_second / 1.1e+9
     elif not is_none(kilobyte_per_second):
         self.bit_per_second = kilobyte_per_second * 8000
         self.kilobit_per_second = kilobyte_per_second * 8
         self.kilobyte_per_second = kilobyte_per_second
         self.kibibit_per_second = kilobyte_per_second * 7.812
         self.megabit_per_second = kilobyte_per_second / 125
         self.megabyte_per_second = kilobyte_per_second / 1000
         self.mebibit_per_second = kilobyte_per_second / 131
         self.gigabit_per_second = kilobyte_per_second / 125000
         self.gigabyte_per_second = kilobyte_per_second / 1e+6
         self.gibibit_per_second = kilobyte_per_second / 134218
         self.terabit_per_second = kilobyte_per_second / 1.25e+8
         self.terabyte_per_second = kilobyte_per_second / 1e+9
         self.tebibit_per_second = kilobyte_per_second / 1.374e+8
     elif not is_none(kibibit_per_second):
         self.bit_per_second = kibibit_per_second * 1024
         self.kilobit_per_second = kibibit_per_second * 1.024
         self.kilobyte_per_second = kibibit_per_second / 7.812
         self.kibibit_per_second = kibibit_per_second
         self.megabit_per_second = kibibit_per_second / 977
         self.megabyte_per_second = kibibit_per_second / 7813
         self.mebibit_per_second = kibibit_per_second / 1024
         self.gigabit_per_second = kibibit_per_second / 976562
         self.gigabyte_per_second = kibibit_per_second / 7.812e+6
         self.gibibit_per_second = kibibit_per_second / 1.049e+6
         self.terabit_per_second = kibibit_per_second / 9.766e+8
         self.terabyte_per_second = kibibit_per_second / 7.812e+9
         self.tebibit_per_second = kibibit_per_second / 1.074e+9
     elif not is_none(megabit_per_second):
         self.bit_per_second = megabit_per_second * 1e+6
         self.kilobit_per_second = megabit_per_second * 1000
         self.kilobyte_per_second = megabit_per_second * 125
         self.kibibit_per_second = megabit_per_second * 977
         self.megabit_per_second = megabit_per_second
         self.megabyte_per_second = megabit_per_second / 8
         self.mebibit_per_second = megabit_per_second / 1.049
         self.gigabit_per_second = megabit_per_second / 1000
         self.gigabyte_per_second = megabit_per_second / 8000
         self.gibibit_per_second = megabit_per_second / 1074
         self.terabit_per_second = megabit_per_second / 1e+6
         self.terabyte_per_second = megabit_per_second / 8e+6
         self.tebibit_per_second = megabit_per_second / 1.1e+6
     elif not is_none(megabyte_per_second):
         self.bit_per_second = megabyte_per_second * 8e+6
         self.kilobit_per_second = megabyte_per_second * 8000
         self.kilobyte_per_second = megabyte_per_second * 1000
         self.kibibit_per_second = megabyte_per_second * 7813
         self.megabit_per_second = megabyte_per_second * 8
         self.megabyte_per_second = megabyte_per_second
         self.mebibit_per_second = megabyte_per_second * 7.629
         self.gigabit_per_second = megabyte_per_second / 125
         self.gigabyte_per_second = megabyte_per_second / 1000
         self.gibibit_per_second = megabyte_per_second / 134
         self.terabit_per_second = megabyte_per_second / 125000
         self.terabyte_per_second = megabyte_per_second / 1e+6
         self.tebibit_per_second = megabyte_per_second / 137439
     elif not is_none(mebibit_per_second):
         self.bit_per_second = mebibit_per_second * 1.049e+6
         self.kilobit_per_second = mebibit_per_second * 1049
         self.kilobyte_per_second = mebibit_per_second * 131
         self.kibibit_per_second = mebibit_per_second * 1024
         self.megabit_per_second = mebibit_per_second * 1.049
         self.megabyte_per_second = mebibit_per_second / 7.629
         self.mebibit_per_second = mebibit_per_second
         self.gigabit_per_second = mebibit_per_second / 954
         self.gigabyte_per_second = mebibit_per_second / 7629
         self.gibibit_per_second = mebibit_per_second / 1024
         self.terabit_per_second = mebibit_per_second / 953674
         self.terabyte_per_second = mebibit_per_second / 7.629e+6
         self.tebibit_per_second = mebibit_per_second / 1.049e+6
     elif not is_none(gigabit_per_second):
         self.bit_per_second = gigabit_per_second * 1e+9
         self.kilobit_per_second = gigabit_per_second * 1e+6
         self.kilobyte_per_second = gigabit_per_second * 125000
         self.kibibit_per_second = gigabit_per_second * 976563
         self.megabit_per_second = gigabit_per_second * 1000
         self.megabyte_per_second = gigabit_per_second * 125
         self.mebibit_per_second = gigabit_per_second * 954
         self.gigabit_per_second = gigabit_per_second
         self.gigabyte_per_second = gigabit_per_second / 8
         self.gibibit_per_second = gigabit_per_second / 1.074
         self.terabit_per_second = gigabit_per_second / 1000
         self.terabyte_per_second = gigabit_per_second / 8000
         self.tebibit_per_second = gigabit_per_second / 1100
     elif not is_none(gigabyte_per_second):
         self.bit_per_second = gigabyte_per_second * 8e+9
         self.kilobit_per_second = gigabyte_per_second * 8e+6
         self.kilobyte_per_second = gigabyte_per_second * 1e+6
         self.kibibit_per_second = gigabyte_per_second * 7.812e+6
         self.megabit_per_second = gigabyte_per_second * 8000
         self.megabyte_per_second = gigabyte_per_second * 1000
         self.mebibit_per_second = gigabyte_per_second * 7629
         self.gigabit_per_second = gigabyte_per_second * 8
         self.gigabyte_per_second = gigabyte_per_second
         self.gibibit_per_second = gigabyte_per_second * 7.451
         self.terabit_per_second = gigabyte_per_second / 125
         self.terabyte_per_second = gigabyte_per_second / 1000
         self.tebibit_per_second = gigabyte_per_second / 137
     elif not is_none(gibibit_per_second):
         self.bit_per_second = gibibit_per_second * 1.074e+9
         self.kilobit_per_second = gibibit_per_second * 1.074e+6
         self.kilobyte_per_second = gibibit_per_second * 134218
         self.kibibit_per_second = gibibit_per_second * 1.049e+6
         self.megabit_per_second = gibibit_per_second * 1074
         self.megabyte_per_second = gibibit_per_second * 134
         self.mebibit_per_second = gibibit_per_second * 1024
         self.gigabit_per_second = gibibit_per_second * 1.074
         self.gigabyte_per_second = gibibit_per_second / 7.451
         self.gibibit_per_second = gibibit_per_second
         self.terabit_per_second = gibibit_per_second / 931
         self.terabyte_per_second = gibibit_per_second / 7451
         self.tebibit_per_second = gibibit_per_second / 1024
     elif not is_none(terabit_per_second):
         self.bit_per_second = terabit_per_second * 1e+12
         self.kilobit_per_second = terabit_per_second * 1e+9
         self.kilobyte_per_second = terabit_per_second * 1.25e+8
         self.kibibit_per_second = terabit_per_second * 9.766e+8
         self.megabit_per_second = terabit_per_second * 1e+6
         self.megabyte_per_second = terabit_per_second * 125000
         self.mebibit_per_second = terabit_per_second * 953674
         self.gigabit_per_second = terabit_per_second * 1000
         self.gigabyte_per_second = terabit_per_second * 125
         self.gibibit_per_second = terabit_per_second * 931
         self.terabit_per_second = terabit_per_second
         self.terabyte_per_second = terabit_per_second / 8
         self.tebibit_per_second = terabit_per_second / 1.1
     elif not is_none(terabyte_per_second):
         self.bit_per_second = terabyte_per_second * 8e+12
         self.kilobit_per_second = terabyte_per_second * 8e+9
         self.kilobyte_per_second = terabyte_per_second * 1e+9
         self.kibibit_per_second = terabyte_per_second * 7.812e+9
         self.megabit_per_second = terabyte_per_second * 8e+6
         self.megabyte_per_second = terabyte_per_second * 1e+6
         self.mebibit_per_second = terabyte_per_second * 7.629e+6
         self.gigabit_per_second = terabyte_per_second * 8000
         self.gigabyte_per_second = terabyte_per_second * 1000
         self.gibibit_per_second = terabyte_per_second * 7451
         self.terabit_per_second = terabyte_per_second * 8
         self.terabyte_per_second = terabyte_per_second
         self.tebibit_per_second = terabyte_per_second * 7.276
     elif not is_none(tebibit_per_second):
         self.bit_per_second = tebibit_per_second * 1.1e+12
         self.kilobit_per_second = tebibit_per_second * 1.1e+9
         self.kilobyte_per_second = tebibit_per_second * 1.374e+8
         self.kibibit_per_second = tebibit_per_second * 1.074e+9
         self.megabit_per_second = tebibit_per_second * 1.1e+6
         self.megabyte_per_second = tebibit_per_second * 137439
         self.mebibit_per_second = tebibit_per_second * 1.049e+6
         self.gigabit_per_second = tebibit_per_second * 1100
         self.gigabyte_per_second = tebibit_per_second * 137
         self.gibibit_per_second = tebibit_per_second * 1024
         self.terabit_per_second = tebibit_per_second * 1.1
         self.terabyte_per_second = tebibit_per_second / 7.276
         self.tebibit_per_second = tebibit_per_second
     else:
         raise TypeError(f"{self.__class__.__name__} expected 1 argument.")
Exemplo n.º 8
0
 def __init__(self,
              nanosecond=None,
              microsecond=None,
              millisecond=None,
              second=None,
              minute=None,
              hour=None,
              day=None,
              week=None,
              month=None,
              calendar_year=None,
              decade=None,
              century=None):
     if not is_none(nanosecond):
         self.nanosecond = nanosecond
         self.microsecond = nanosecond / 1000
         self.millisecond = nanosecond / 1e+6
         self.second = nanosecond / 1e+9
         self.minute = nanosecond / 6e+10
         self.hour = nanosecond / 3.6e+12
         self.day = nanosecond / 8.64e+13
         self.week = nanosecond / 6.048e+14
         self.month = nanosecond / 2.628e+15
         self.calendar_year = nanosecond / 3.154e+16
         self.decade = nanosecond / 3.154e+17
         self.century = nanosecond / 3.154e+18
     elif not is_none(microsecond):
         self.nanosecond = microsecond * 1000
         self.microsecond = microsecond
         self.millisecond = microsecond / 1000
         self.second = microsecond / 1e+6
         self.minute = microsecond / 6e+7
         self.hour = microsecond / 3.6e+9
         self.day = microsecond / 8.64e+10
         self.week = microsecond / 6.048e+11
         self.month = microsecond / 2.628e+12
         self.calendar_year = microsecond / 3.154e+13
         self.decade = microsecond / 3.154e+14
         self.century = microsecond / 3.154e+15
     elif not is_none(millisecond):
         self.nanosecond = millisecond * 1e+6
         self.microsecond = millisecond * 1000
         self.millisecond = millisecond
         self.second = millisecond / 1000
         self.minute = millisecond / 60000
         self.hour = millisecond / 3.6e+6
         self.day = millisecond / 8.64e+7
         self.week = millisecond / 6.048e+8
         self.month = millisecond / 2.628e+9
         self.calendar_year = millisecond / 3.154e+10
         self.decade = millisecond / 3.154e+11
         self.century = millisecond / 3.154e+12
     elif not is_none(second):
         self.nanosecond = second * 1e+9
         self.microsecond = second * 1e+6
         self.millisecond = second * 1000
         self.second = second
         self.minute = second / 60
         self.hour = second / 3600
         self.day = second / 86400
         self.week = second / 604800
         self.month = second / 2.628e+6
         self.calendar_year = second / 3.154e+7
         self.decade = second / 3.154e+8
         self.century = second / 3.154e+9
     elif not is_none(minute):
         self.nanosecond = minute * 6e+10
         self.microsecond = minute * 6e+7
         self.millisecond = minute * 60000
         self.second = minute * 60
         self.minute = minute
         self.hour = minute / 60
         self.day = minute / 1440
         self.week = minute / 10080
         self.month = minute / 43800
         self.calendar_year = minute / 525600
         self.decade = minute / 5.256e+6
         self.century = minute / 5.256e+7
     elif not is_none(hour):
         self.nanosecond = hour * 3.6e+12
         self.microsecond = hour * 3.6e+9
         self.millisecond = hour * 3.6e+6
         self.second = hour * 3600
         self.minute = hour * 60
         self.hour = hour
         self.day = hour / 24
         self.week = hour / 168
         self.month = hour / 730
         self.calendar_year = hour / 8760
         self.decade = hour / 87600
         self.century = hour / 876000
     elif not is_none(day):
         self.nanosecond = day * 8.64e+13
         self.microsecond = day * 8.64e+10
         self.millisecond = day * 8.64e+7
         self.second = day * 86400
         self.minute = day * 1440
         self.hour = day * 24
         self.day = day
         self.week = day / 7
         self.month = day / 30.417
         self.calendar_year = day / 365
         self.decade = day / 3650
         self.century = day / 36500
     elif not is_none(week):
         self.nanosecond = week * 6.048e+14
         self.microsecond = week * 6.048e+11
         self.millisecond = week * 6.048e+8
         self.second = week * 604800
         self.minute = week * 10080
         self.hour = week * 168
         self.day = week * 7
         self.week = week
         self.month = week / 4.345
         self.calendar_year = week / 52.143
         self.decade = week / 521
         self.century = week / 5214
     elif not is_none(month):
         self.nanosecond = month * 2.628e+15
         self.microsecond = month * 2.628e+12
         self.millisecond = month * 2.628e+9
         self.second = month * 2.628e+6
         self.minute = month * 43800
         self.hour = month * 730
         self.day = month * 30.417
         self.week = month * 4.345
         self.month = month
         self.calendar_year = month / 12
         self.decade = month / 120
         self.century = month / 1200
     elif not is_none(calendar_year):
         self.nanosecond = calendar_year * 3.154e+16
         self.microsecond = calendar_year * 3.154e+13
         self.millisecond = calendar_year * 3.154e+10
         self.second = calendar_year * 3.154e+7
         self.minute = calendar_year * 525600
         self.hour = calendar_year * 8760
         self.day = calendar_year * 365
         self.week = calendar_year * 52.143
         self.month = calendar_year * 12
         self.calendar_year = calendar_year
         self.decade = calendar_year / 10
         self.century = calendar_year / 100
     elif not is_none(decade):
         self.nanosecond = decade * 3.154e+17
         self.microsecond = decade * 3.154e+14
         self.millisecond = decade * 3.154e+11
         self.second = decade * 3.154e+8
         self.minute = decade * 5.256e+6
         self.hour = decade * 87600
         self.day = decade * 3650
         self.week = decade * 521
         self.month = decade * 120
         self.calendar_year = decade * 10
         self.decade = decade
         self.century = decade / 10
     elif not is_none(century):
         self.nanosecond = century * 3.154e+18
         self.microsecond = century * 3.154e+15
         self.millisecond = century * 3.154e+12
         self.second = century * 3.154e+9
         self.minute = century * 5.256e+7
         self.hour = century * 876000
         self.day = century * 36500
         self.week = century * 5214
         self.month = century * 1200
         self.calendar_year = century * 100
         self.decade = century * 10
         self.century = century
     else:
         raise TypeError(f"{self.__class__.__name__} expected 1 argument.")
Exemplo n.º 9
0
 def __init__(self,
              bit=None,
              kilobit=None,
              kibibit=None,
              megabit=None,
              mebibit=None,
              gigabit=None,
              gibibit=None,
              terabit=None,
              tebibit=None,
              petabit=None,
              pebibit=None,
              byte=None,
              kilobyte=None,
              kibibyte=None,
              megabyte=None,
              mebibyte=None,
              gigabyte=None,
              gibibyte=None,
              terabyte=None,
              tebibyte=None,
              petabyte=None,
              pebibyte=None):
     if not is_none(bit):
         self.bit = bit
         self.kilobit = bit / 1000
         self.kibibit = bit / 1024
         self.megabit = bit / 1e+6
         self.mebibit = bit / 1.049e+6
         self.gigabit = bit / 1e+9
         self.gibibit = bit / 1.074e+9
         self.terabit = bit / 1e+12
         self.tebibit = bit / 1.1e+12
         self.petabit = bit / 1e+15
         self.pebibit = bit / 1.126e+15
         self.byte = bit / 8
         self.kilobyte = bit / 8000
         self.kibibyte = bit / 8192
         self.megabyte = bit / 8e+6
         self.mebibyte = bit / 8.389e+6
         self.gigabyte = bit / 8e+9
         self.gibibyte = bit / 8.59e+9
         self.terabyte = bit / 8e+12
         self.tebibyte = bit / 8.796e+12
         self.petabyte = bit / 8e+15
         self.pebibyte = bit / 9.007e+15
     elif not is_none(kilobit):
         self.bit = kilobit * 1000
         self.kilobit = kilobit
         self.kibibit = kilobit / 1.024
         self.megabit = kilobit / 1000
         self.mebibit = kilobit / 1049
         self.gigabit = kilobit / 1e+6
         self.gibibit = kilobit / 1.074e+6
         self.terabit = kilobit / 1e+9
         self.tebibit = kilobit / 1.1e+9
         self.petabit = kilobit / 1e+12
         self.pebibit = kilobit / 1.126e+12
         self.byte = kilobit * 125
         self.kilobyte = kilobit / 8
         self.kibibyte = kilobit / 8.192
         self.megabyte = kilobit / 8000
         self.mebibyte = kilobit / 8389
         self.gigabyte = kilobit / 8e+6
         self.gibibyte = kilobit / 8.59e+6
         self.terabyte = kilobit / 8e+9
         self.tebibyte = kilobit / 8.796e+9
         self.petabyte = kilobit / 8e+12
         self.pebibyte = kilobit / 9.007e+12
     elif not is_none(kibibit):
         self.bit = kibibit * 1024
         self.kilobit = kibibit * 1.024
         self.kibibit = kibibit
         self.megabit = kibibit / 977
         self.mebibit = kibibit / 1024
         self.gigabit = kibibit / 976562
         self.gibibit = kibibit / 1.049e+6
         self.terabit = kibibit / 9.766e+8
         self.tebibit = kibibit / 1.074e+9
         self.petabit = kibibit / 9.766e+11
         self.pebibit = kibibit / 1.1e+12
         self.byte = kibibit * 128
         self.kilobyte = kibibit / 7.812
         self.kibibyte = kibibit / 8
         self.megabyte = kibibit / 7813
         self.mebibyte = kibibit / 8192
         self.gigabyte = kibibit / 7.812e+6
         self.gibibyte = kibibit / 8.389e+6
         self.terabyte = kibibit / 7.812e+9
         self.tebibyte = kibibit / 8.59e+9
         self.petabyte = kibibit / 7.812e+12
         self.pebibyte = kibibit / 8.796e+12
     elif not is_none(megabit):
         self.bit = megabit * 1e+6
         self.kilobit = megabit * 1000
         self.kibibit = megabit * 977
         self.megabit = megabit
         self.mebibit = megabit / 1.049
         self.gigabit = megabit / 1000
         self.gibibit = megabit / 1074
         self.terabit = megabit / 1e+6
         self.tebibit = megabit / 1.1e+6
         self.petabit = megabit / 1e+9
         self.pebibit = megabit / 1.126e+9
         self.byte = megabit * 125000
         self.kilobyte = megabit * 125
         self.kibibyte = megabit * 122
         self.megabyte = megabit / 8
         self.mebibyte = megabit / 8.389
         self.gigabyte = megabit / 8000
         self.gibibyte = megabit / 8590
         self.terabyte = megabit / 8e+6
         self.tebibyte = megabit / 8.796e+6
         self.petabyte = megabit / 8e+9
         self.pebibyte = megabit / 9.007e+9
     elif not is_none(mebibit):
         self.bit = mebibit * 1.049e+6
         self.kilobit = mebibit * 1049
         self.kibibit = mebibit * 1024
         self.megabit = mebibit * 1.049
         self.mebibit = mebibit
         self.gigabit = mebibit / 954
         self.gibibit = mebibit / 1024
         self.terabit = mebibit / 953674
         self.tebibit = mebibit / 1.049e+6
         self.petabit = mebibit / 9.537e+8
         self.pebibit = mebibit / 1.074e+9
         self.byte = mebibit * 131072
         self.kilobyte = mebibit * 131
         self.kibibyte = mebibit * 128
         self.megabyte = mebibit / 7.629
         self.mebibyte = mebibit / 8
         self.gigabyte = mebibit / 7629
         self.gibibyte = mebibit / 8192
         self.terabyte = mebibit / 7.629e+6
         self.tebibyte = mebibit / 8.389e+6
         self.petabyte = mebibit / 7.629e+9
         self.pebibyte = mebibit / 8.59e+9
     elif not is_none(gigabit):
         self.bit = gigabit * 1e+9
         self.kilobit = gigabit * 1e+6
         self.kibibit = gigabit * 976563
         self.megabit = gigabit * 1000
         self.mebibit = gigabit * 954
         self.gigabit = gigabit
         self.gibibit = gigabit / 1.074
         self.terabit = gigabit / 1000
         self.tebibit = gigabit / 1100
         self.petabit = gigabit / 1e+6
         self.pebibit = gigabit / 1.126e+6
         self.byte = gigabit * 1.25e+8
         self.kilobyte = gigabit * 125000
         self.kibibyte = gigabit * 122070
         self.megabyte = gigabit * 125
         self.mebibyte = gigabit * 119
         self.gigabyte = gigabit / 8
         self.gibibyte = gigabit / 8.59
         self.terabyte = gigabit / 8000
         self.tebibyte = gigabit / 8796
         self.petabyte = gigabit / 8e+6
         self.pebibyte = gigabit / 9.007e+6
     elif not is_none(gibibit):
         self.bit = gibibit * 1.074e+9
         self.kilobit = gibibit * 1.074e+6
         self.kibibit = gibibit * 1.049e+6
         self.megabit = gibibit * 1074
         self.mebibit = gibibit * 1024
         self.gigabit = gibibit * 1.074
         self.gibibit = gibibit
         self.terabit = gibibit / 931
         self.tebibit = gibibit / 1024
         self.petabit = gibibit / 931323
         self.pebibit = gibibit / 1.049e+6
         self.byte = gibibit * 1.342e+8
         self.kilobyte = gibibit * 134218
         self.kibibyte = gibibit * 131072
         self.megabyte = gibibit * 134
         self.mebibyte = gibibit * 128
         self.gigabyte = gibibit / 7.451
         self.gibibyte = gibibit / 8
         self.terabyte = gibibit / 7451
         self.tebibyte = gibibit / 8192
         self.petabyte = gibibit / 7.451e+6
         self.pebibyte = gibibit / 8.389e+6
     elif not is_none(terabit):
         self.bit = terabit * 1e+12
         self.kilobit = terabit * 1e+9
         self.kibibit = terabit * 9.766e+8
         self.megabit = terabit * 1e+6
         self.mebibit = terabit * 953674
         self.gigabit = terabit * 1000
         self.gibibit = terabit * 931
         self.terabit = terabit
         self.tebibit = terabit / 1.1
         self.petabit = terabit / 1000
         self.pebibit = terabit / 1126
         self.byte = terabit * 1.25e+11
         self.kilobyte = terabit * 1.25e+8
         self.kibibyte = terabit * 1.221e+8
         self.megabyte = terabit * 125000
         self.mebibyte = terabit * 119209
         self.gigabyte = terabit * 125
         self.gibibyte = terabit * 116
         self.terabyte = terabit / 8
         self.tebibyte = terabit / 8.796
         self.petabyte = terabit / 8000
         self.pebibyte = terabit / 9007
     elif not is_none(tebibit):
         self.bit = tebibit * 1.1e+12
         self.kilobit = tebibit * 1.1e+9
         self.kibibit = tebibit * 1.074e+9
         self.megabit = tebibit * 1.1e+6
         self.mebibit = tebibit * 1.049e+6
         self.gigabit = tebibit * 1100
         self.gibibit = tebibit * 1024
         self.terabit = tebibit * 1.1
         self.tebibit = tebibit
         self.petabit = tebibit / 909
         self.pebibit = tebibit / 1024
         self.byte = tebibit * 1.374e+11
         self.kilobyte = tebibit * 1.374e+8
         self.kibibyte = tebibit * 1.342e+8
         self.megabyte = tebibit * 137439
         self.mebibyte = tebibit * 131072
         self.gigabyte = tebibit * 137
         self.gibibyte = tebibit * 128
         self.terabyte = tebibit / 7.276
         self.tebibyte = tebibit / 8
         self.petabyte = tebibit / 7276
         self.pebibyte = tebibit / 8192
     elif not is_none(petabit):
         self.bit = petabit * 1e+15
         self.kilobit = petabit * 1e+12
         self.kibibit = petabit * 9.766e+11
         self.megabit = petabit * 1e+9
         self.mebibit = petabit * 9.537e+8
         self.gigabit = petabit * 1e+6
         self.gibibit = petabit * 931323
         self.terabit = petabit * 1000
         self.tebibit = petabit * 909
         self.petabit = petabit
         self.pebibit = petabit / 1.126
         self.byte = petabit * 1.25e+14
         self.kilobyte = petabit * 1.25e+11
         self.kibibyte = petabit * 1.221e+11
         self.megabyte = petabit * 1.25e+8
         self.mebibyte = petabit * 1.192e+8
         self.gigabyte = petabit * 125000
         self.gibibyte = petabit * 116415
         self.terabyte = petabit * 125
         self.tebibyte = petabit * 114
         self.petabyte = petabit / 8
         self.pebibyte = petabit / 9.007
     elif not is_none(pebibit):
         self.bit = pebibit * 1.126e+15
         self.kilobit = pebibit * 1.126e+12
         self.kibibit = pebibit * 1.1e+12
         self.megabit = pebibit * 1.126e+9
         self.mebibit = pebibit * 1.074e+9
         self.gigabit = pebibit * 1.126e+6
         self.gibibit = pebibit * 1.049e+6
         self.terabit = pebibit * 1126
         self.tebibit = pebibit * 1024
         self.petabit = pebibit * 1.126
         self.pebibit = pebibit
         self.byte = pebibit * 1.407e+14
         self.kilobyte = pebibit * 1.407e+11
         self.kibibyte = pebibit * 1.374e+11
         self.megabyte = pebibit * 1.407e+8
         self.mebibyte = pebibit * 1.342e+8
         self.gigabyte = pebibit * 140737
         self.gibibyte = pebibit * 131072
         self.terabyte = pebibit * 141
         self.tebibyte = pebibit * 128
         self.petabyte = pebibit / 7.105
         self.pebibyte = pebibit / 8
     elif not is_none(byte):
         self.bit = byte * 8
         self.kilobit = byte / 125
         self.kibibit = byte / 128
         self.megabit = byte / 125000
         self.mebibit = byte / 131072
         self.gigabit = byte / 1.25e+8
         self.gibibit = byte / 1.342e+8
         self.terabit = byte / 1.25e+11
         self.tebibit = byte / 1.374e+11
         self.petabit = byte / 1.25e+14
         self.pebibit = byte / 1.407e+14
         self.byte = byte
         self.kilobyte = byte / 1000
         self.kibibyte = byte / 1024
         self.megabyte = byte / 1e+6
         self.mebibyte = byte / 1.049e+6
         self.gigabyte = byte / 1e+9
         self.gibibyte = byte / 1.074e+9
         self.terabyte = byte / 1e+12
         self.tebibyte = byte / 1.1e+12
         self.petabyte = byte / 1e+15
         self.pebibyte = byte / 1.126e+15
     elif not is_none(kilobyte):
         self.bit = kilobyte * 8000
         self.kilobit = kilobyte * 8
         self.kibibit = kilobyte * 7.812
         self.megabit = kilobyte / 125
         self.mebibit = kilobyte / 131
         self.gigabit = kilobyte / 125000
         self.gibibit = kilobyte / 134218
         self.terabit = kilobyte / 1.25e+8
         self.tebibit = kilobyte / 1.374e+8
         self.petabit = kilobyte / 1.25e+11
         self.pebibit = kilobyte / 1.407e+11
         self.byte = kilobyte * 1000
         self.kilobyte = kilobyte
         self.kibibyte = kilobyte / 1.024
         self.megabyte = kilobyte / 1000
         self.mebibyte = kilobyte / 1049
         self.gigabyte = kilobyte / 1e+6
         self.gibibyte = kilobyte / 1.074e+6
         self.terabyte = kilobyte / 1e+9
         self.tebibyte = kilobyte / 1.1e+9
         self.petabyte = kilobyte / 1e+12
         self.pebibyte = kilobyte / 1.126e+12
     elif not is_none(kibibyte):
         self.bit = kibibyte * 8192
         self.kilobit = kibibyte * 8.192
         self.kibibit = kibibyte * 8
         self.megabit = kibibyte / 122
         self.mebibit = kibibyte / 128
         self.gigabit = kibibyte / 122070
         self.gibibit = kibibyte / 131072
         self.terabit = kibibyte / 1.221e+8
         self.tebibit = kibibyte / 1.342e+8
         self.petabit = kibibyte / 1.221e+11
         self.pebibit = kibibyte / 1.374e+11
         self.byte = kibibyte * 1024
         self.kilobyte = kibibyte * 1.024
         self.kibibyte = kibibyte
         self.megabyte = kibibyte / 977
         self.mebibyte = kibibyte / 1024
         self.gigabyte = kibibyte / 976562
         self.gibibyte = kibibyte / 1.049e+6
         self.terabyte = kibibyte / 9.766e+8
         self.tebibyte = kibibyte / 1.074e+9
         self.petabyte = kibibyte / 9.766e+11
         self.pebibyte = kibibyte / 1.1e+12
     elif not is_none(megabyte):
         self.bit = megabyte * 8e+6
         self.kilobit = megabyte * 8000
         self.kibibit = megabyte * 7813
         self.megabit = megabyte * 8
         self.mebibit = megabyte * 7.629
         self.gigabit = megabyte / 125
         self.gibibit = megabyte / 134
         self.terabit = megabyte / 125000
         self.tebibit = megabyte / 137439
         self.petabit = megabyte / 1.25e+8
         self.pebibit = megabyte / 1.407e+8
         self.byte = megabyte * 1e+6
         self.kilobyte = megabyte * 1000
         self.kibibyte = megabyte * 977
         self.megabyte = megabyte
         self.mebibyte = megabyte / 1.049
         self.gigabyte = megabyte / 1000
         self.gibibyte = megabyte / 1074
         self.terabyte = megabyte / 1e+6
         self.tebibyte = megabyte / 1.1e+6
         self.petabyte = megabyte / 1e+9
         self.pebibyte = megabyte / 1.126e+9
     elif not is_none(mebibyte):
         self.bit = mebibyte * 8.389e+6
         self.kilobit = mebibyte * 8389
         self.kibibit = mebibyte * 8192
         self.megabit = mebibyte * 8.389
         self.mebibit = mebibyte * 8
         self.gigabit = mebibyte / 119
         self.gibibit = mebibyte / 128
         self.terabit = mebibyte / 119209
         self.tebibit = mebibyte / 131072
         self.petabit = mebibyte / 1.192e+8
         self.pebibit = mebibyte / 1.342e+8
         self.byte = mebibyte * 1.049e+6
         self.kilobyte = mebibyte * 1049
         self.kibibyte = mebibyte * 1024
         self.megabyte = mebibyte * 1.049
         self.mebibyte = mebibyte
         self.gigabyte = mebibyte / 954
         self.gibibyte = mebibyte / 1024
         self.terabyte = mebibyte / 953674
         self.tebibyte = mebibyte / 1.049e+6
         self.petabyte = mebibyte / 9.537e+8
         self.pebibyte = mebibyte / 1.074e+9
     elif not is_none(gigabyte):
         self.bit = gigabyte * 8e+9
         self.kilobit = gigabyte * 8e+6
         self.kibibit = gigabyte * 7.812e+6
         self.megabit = gigabyte * 8000
         self.mebibit = gigabyte * 7629
         self.gigabit = gigabyte * 8
         self.gibibit = gigabyte * 7.451
         self.terabit = gigabyte / 125
         self.tebibit = gigabyte / 137
         self.petabit = gigabyte / 125000
         self.pebibit = gigabyte / 140737
         self.byte = gigabyte * 1e+9
         self.kilobyte = gigabyte * 1e+6
         self.kibibyte = gigabyte * 976563
         self.megabyte = gigabyte * 1000
         self.mebibyte = gigabyte * 954
         self.gigabyte = gigabyte
         self.gibibyte = gigabyte / 1.074
         self.terabyte = gigabyte / 1000
         self.tebibyte = gigabyte / 1100
         self.petabyte = gigabyte / 1e+6
         self.pebibyte = gigabyte / 1.126e+6
     elif not is_none(gibibyte):
         self.bit = gibibyte * 8.59e+9
         self.kilobit = gibibyte * 8.59e+6
         self.kibibit = gibibyte * 8.389e+6
         self.megabit = gibibyte * 8590
         self.mebibit = gibibyte * 8192
         self.gigabit = gibibyte * 8.59
         self.gibibit = gibibyte * 8
         self.terabit = gibibyte / 116
         self.tebibit = gibibyte / 128
         self.petabit = gibibyte / 116415
         self.pebibit = gibibyte / 131072
         self.byte = gibibyte * 1.074e+9
         self.kilobyte = gibibyte * 1.074e+6
         self.kibibyte = gibibyte * 1.049e+6
         self.megabyte = gibibyte * 1074
         self.mebibyte = gibibyte * 1024
         self.gigabyte = gibibyte * 1.074
         self.gibibyte = gibibyte
         self.terabyte = gibibyte / 931
         self.tebibyte = gibibyte / 1024
         self.petabyte = gibibyte / 931323
         self.pebibyte = gibibyte / 1.049e+6
     elif not is_none(terabyte):
         self.bit = terabyte * 8e+12
         self.kilobit = terabyte * 8e+9
         self.kibibit = terabyte * 7.812e+9
         self.megabit = terabyte * 8e+6
         self.mebibit = terabyte * 7.629e+6
         self.gigabit = terabyte * 8000
         self.gibibit = terabyte * 7451
         self.terabit = terabyte * 8
         self.tebibit = terabyte * 7.276
         self.petabit = terabyte / 125
         self.pebibit = terabyte / 141
         self.byte = terabyte * 1e+12
         self.kilobyte = terabyte * 1e+9
         self.kibibyte = terabyte * 9.766e+8
         self.megabyte = terabyte * 1e+6
         self.mebibyte = terabyte * 953674
         self.gigabyte = terabyte * 1000
         self.gibibyte = terabyte * 931
         self.terabyte = terabyte
         self.tebibyte = terabyte / 1.1
         self.petabyte = terabyte / 1000
         self.pebibyte = terabyte / 1126
     elif not is_none(tebibyte):
         self.bit = tebibyte * 8.796e+12
         self.kilobit = tebibyte * 8.796e+9
         self.kibibit = tebibyte * 8.59e+9
         self.megabit = tebibyte * 8.796e+6
         self.mebibit = tebibyte * 8.389e+6
         self.gigabit = tebibyte * 8796
         self.gibibit = tebibyte * 8192
         self.terabit = tebibyte * 8.796
         self.tebibit = tebibyte * 8
         self.petabit = tebibyte / 114
         self.pebibit = tebibyte / 128
         self.byte = tebibyte * 1.1e+12
         self.kilobyte = tebibyte * 1.1e+9
         self.kibibyte = tebibyte * 1.074e+9
         self.megabyte = tebibyte * 1.1e+6
         self.mebibyte = tebibyte * 1.049e+6
         self.gigabyte = tebibyte * 1100
         self.gibibyte = tebibyte * 1024
         self.terabyte = tebibyte * 1.1
         self.tebibyte = tebibyte
         self.petabyte = tebibyte / 909
         self.pebibyte = tebibyte / 1024
     elif not is_none(petabyte):
         self.bit = petabyte * 8e+15
         self.kilobit = petabyte * 8e+12
         self.kibibit = petabyte * 7.812e+12
         self.megabit = petabyte * 8e+9
         self.mebibit = petabyte * 7.629e+9
         self.gigabit = petabyte * 8e+6
         self.gibibit = petabyte * 7.451e+6
         self.terabit = petabyte * 8000
         self.tebibit = petabyte * 7276
         self.petabit = petabyte * 8
         self.pebibit = petabyte * 7.105
         self.byte = petabyte * 1e+15
         self.kilobyte = petabyte * 1e+12
         self.kibibyte = petabyte * 9.766e+11
         self.megabyte = petabyte * 1e+9
         self.mebibyte = petabyte * 9.537e+8
         self.gigabyte = petabyte * 1e+6
         self.gibibyte = petabyte * 931323
         self.terabyte = petabyte * 1000
         self.tebibyte = petabyte * 909
         self.petabyte = petabyte
         self.pebibyte = petabyte / 1.126
     elif not is_none(pebibyte):
         self.bit = pebibyte * 9.007e+15
         self.kilobit = pebibyte * 9.007e+12
         self.kibibit = pebibyte * 8.796e+12
         self.megabit = pebibyte * 9.007e+9
         self.mebibit = pebibyte * 8.59e+9
         self.gigabit = pebibyte * 9.007e+6
         self.gibibit = pebibyte * 8.389e+6
         self.terabit = pebibyte * 9007
         self.tebibit = pebibyte * 8192
         self.petabit = pebibyte * 9.007
         self.pebibit = pebibyte * 8
         self.byte = pebibyte * 1.126e+15
         self.kilobyte = pebibyte * 1.126e+12
         self.kibibyte = pebibyte * 1.1e+12
         self.megabyte = pebibyte * 1.126e+9
         self.mebibyte = pebibyte * 1.074e+9
         self.gigabyte = pebibyte * 1.126e+6
         self.gibibyte = pebibyte * 1.049e+6
         self.terabyte = pebibyte * 1126
         self.tebibyte = pebibyte * 1024
         self.petabyte = pebibyte * 1.126
         self.pebibyte = pebibyte
     else:
         raise TypeError(f"{self.__class__.__name__} expected 1 argument.")
Exemplo n.º 10
0
 def __init__(self,
              joule=None,
              kilojoule=None,
              gram_calorie=None,
              kilocalorie=None,
              watt_hour=None,
              kilowatt_hour=None,
              electronvolt=None,
              british_thermal_unit=None,
              us_therm=None,
              foot_pound=None):
     if not is_none(joule):
         self.joule = joule
         self.kilojoule = joule / 1000
         self.gram_calorie = joule / 4.184
         self.kilocalorie = joule / 4184
         self.watt_hour = joule / 3600
         self.kilowatt_hour = joule / 3.6e+6
         self.electronvolt = joule * 6.242e+18
         self.british_thermal_unit = joule / 1055
         self.us_therm = joule / 1.055e+8
         self.foot_pound = joule / 1.356
     elif not is_none(kilojoule):
         self.joule = kilojoule * 1000
         self.kilojoule = kilojoule
         self.gram_calorie = kilojoule * 239
         self.kilocalorie = kilojoule / 4.184
         self.watt_hour = kilojoule / 3.6
         self.kilowatt_hour = kilojoule / 3600
         self.electronvolt = kilojoule * 9.223e+18
         self.british_thermal_unit = kilojoule / 1.055
         self.us_therm = kilojoule / 105480
         self.foot_pound = kilojoule * 738
     elif not is_none(gram_calorie):
         self.joule = gram_calorie * 4.184
         self.kilojoule = gram_calorie / 239
         self.gram_calorie = gram_calorie
         self.kilocalorie = gram_calorie / 1000
         self.watt_hour = gram_calorie / 860
         self.kilowatt_hour = gram_calorie / 860421
         self.electronvolt = gram_calorie * 9.223e+18
         self.british_thermal_unit = gram_calorie / 252
         self.us_therm = gram_calorie / 2.521e+7
         self.foot_pound = gram_calorie * 3.086
     elif not is_none(kilocalorie):
         self.joule = kilocalorie * 4184
         self.kilojoule = kilocalorie * 4.184
         self.gram_calorie = kilocalorie * 1000
         self.kilocalorie = kilocalorie
         self.watt_hour = kilocalorie * 1.162
         self.kilowatt_hour = kilocalorie / 860
         self.electronvolt = kilocalorie * 9.223e+18
         self.british_thermal_unit = kilocalorie * 3.966
         self.us_therm = kilocalorie / 25210
         self.foot_pound = kilocalorie * 3086
     elif not is_none(watt_hour):
         self.joule = watt_hour * 3600
         self.kilojoule = watt_hour * 3.6
         self.gram_calorie = watt_hour * 860
         self.kilocalorie = watt_hour / 1.162
         self.watt_hour = watt_hour
         self.kilowatt_hour = watt_hour / 1000
         self.electronvolt = watt_hour * 9.223e+18
         self.british_thermal_unit = watt_hour * 3.412
         self.us_therm = watt_hour / 29300
         self.foot_pound = watt_hour * 2655
     elif not is_none(kilowatt_hour):
         self.joule = kilowatt_hour * 3.6e+6
         self.kilojoule = kilowatt_hour * 3600
         self.gram_calorie = kilowatt_hour * 860421
         self.kilocalorie = kilowatt_hour * 860
         self.watt_hour = kilowatt_hour * 1000
         self.kilowatt_hour = kilowatt_hour
         self.electronvolt = kilowatt_hour * 9.223e+18
         self.british_thermal_unit = kilowatt_hour * 3412
         self.us_therm = kilowatt_hour / 29.3
         self.foot_pound = kilowatt_hour * 2.655e+6
     elif not is_none(electronvolt):
         self.joule = electronvolt / 6.242e+18
         self.kilojoule = electronvolt / 9.223e+18
         self.gram_calorie = electronvolt / 9.223e+18
         self.kilocalorie = electronvolt / 9.223e+18
         self.watt_hour = electronvolt / 9.223e+18
         self.kilowatt_hour = electronvolt / 9.223e+18
         self.electronvolt = electronvolt
         self.british_thermal_unit = electronvolt / 9.223e+18
         self.us_therm = electronvolt / 9.223e+18
         self.foot_pound = electronvolt / 8.462e+18
     elif not is_none(british_thermal_unit):
         self.joule = british_thermal_unit * 1055
         self.kilojoule = british_thermal_unit * 1.055
         self.gram_calorie = british_thermal_unit * 252
         self.kilocalorie = british_thermal_unit / 3.966
         self.watt_hour = british_thermal_unit / 3.412
         self.kilowatt_hour = british_thermal_unit / 3412
         self.electronvolt = british_thermal_unit * 9.223e+18
         self.british_thermal_unit = british_thermal_unit
         self.us_therm = british_thermal_unit / 99976
         self.foot_pound = british_thermal_unit * 778
     elif not is_none(us_therm):
         self.joule = us_therm * 1.055e+8
         self.kilojoule = us_therm * 105480
         self.gram_calorie = us_therm * 2.521e+7
         self.kilocalorie = us_therm * 25210
         self.watt_hour = us_therm * 29300
         self.kilowatt_hour = us_therm * 29.3
         self.electronvolt = us_therm * 9.223e+18
         self.british_thermal_unit = us_therm * 99976
         self.us_therm = us_therm
         self.foot_pound = us_therm * 7.78e+7
     elif not is_none(foot_pound):
         self.joule = foot_pound * 1.356
         self.kilojoule = foot_pound / 738
         self.gram_calorie = foot_pound / 3.086
         self.kilocalorie = foot_pound / 3086
         self.watt_hour = foot_pound / 2655
         self.kilowatt_hour = foot_pound / 2.655e+6
         self.electronvolt = foot_pound * 8.462e+18
         self.british_thermal_unit = foot_pound / 778
         self.us_therm = foot_pound / 7.78e+7
         self.foot_pound = foot_pound
     else:
         raise TypeError(f"{self.__class__.__name__} expected 1 argument.")
Exemplo n.º 11
0
 def __init__(self, us_liquid_gallon = None, us_liquid_quart = None, us_liquid_pint = None, us_legal_cup = None, us_fluid_ounce = None, us_tablespoon = None, us_teaspoon = None, cubic_meter = None, liter = None, milliliter = None, imperial_gallon = None, imperial_quart = None, imperial_pint = None, imperial_cup = None, imperial_fluid_ounce = None, imperial_tablespoon = None, imperial_teaspoon = None, cubic_foot = None, cubic_inch = None):
     if not is_none(us_liquid_gallon):
         self.us_liquid_gallon = us_liquid_gallon
         self.us_liquid_quart = us_liquid_gallon * 4
         self.us_liquid_pint = us_liquid_gallon * 8
         self.us_legal_cup = us_liquid_gallon * 15.773
         self.us_fluid_ounce = us_liquid_gallon * 128
         self.us_tablespoon = us_liquid_gallon * 256
         self.us_teaspoon = us_liquid_gallon * 768
         self.cubic_meter = us_liquid_gallon / 264
         self.liter = us_liquid_gallon * 3.785
         self.milliliter = us_liquid_gallon * 3785
         self.imperial_gallon = us_liquid_gallon / 1.201
         self.imperial_quart = us_liquid_gallon * 3.331
         self.imperial_pint = us_liquid_gallon * 6.661
         self.imperial_cup = us_liquid_gallon * 13.323
         self.imperial_fluid_ounce = us_liquid_gallon * 133
         self.imperial_tablespoon = us_liquid_gallon * 213
         self.imperial_teaspoon = us_liquid_gallon * 639
         self.cubic_foot = us_liquid_gallon / 7.481
         self.cubic_inch = us_liquid_gallon * 231
     elif not is_none(us_liquid_quart):
         self.us_liquid_gallon = us_liquid_quart / 4
         self.us_liquid_quart = us_liquid_quart
         self.us_liquid_pint = us_liquid_quart * 2
         self.us_legal_cup = us_liquid_quart * 3.943
         self.us_fluid_ounce = us_liquid_quart * 32
         self.us_tablespoon = us_liquid_quart * 64
         self.us_teaspoon = us_liquid_quart * 192
         self.cubic_meter = us_liquid_quart / 1057
         self.liter = us_liquid_quart / 1.057
         self.milliliter = us_liquid_quart * 946
         self.imperial_gallon = us_liquid_quart / 4.804
         self.imperial_quart = us_liquid_quart / 1.201
         self.imperial_pint = us_liquid_quart * 1.665
         self.imperial_cup = us_liquid_quart * 3.331
         self.imperial_fluid_ounce = us_liquid_quart * 33.307
         self.imperial_tablespoon = us_liquid_quart * 53.291
         self.imperial_teaspoon = us_liquid_quart * 160
         self.cubic_foot = us_liquid_quart / 29.922
         self.cubic_inch = us_liquid_quart * 57.75
     elif not is_none(us_liquid_pint):
         self.us_liquid_gallon = us_liquid_pint / 8
         self.us_liquid_quart = us_liquid_pint / 2
         self.us_liquid_pint = us_liquid_pint
         self.us_legal_cup = us_liquid_pint * 1.972
         self.us_fluid_ounce = us_liquid_pint * 16
         self.us_tablespoon = us_liquid_pint * 32
         self.us_teaspoon = us_liquid_pint * 96
         self.cubic_meter = us_liquid_pint / 2113
         self.liter = us_liquid_pint / 2.113
         self.milliliter = us_liquid_pint * 473
         self.imperial_gallon = us_liquid_pint / 9.608
         self.imperial_quart = us_liquid_pint / 2.402
         self.imperial_pint = us_liquid_pint / 1.201
         self.imperial_cup = us_liquid_pint * 1.665
         self.imperial_fluid_ounce = us_liquid_pint * 16.653
         self.imperial_tablespoon = us_liquid_pint * 26.646
         self.imperial_teaspoon = us_liquid_pint * 79.937
         self.cubic_foot = us_liquid_pint / 59.844
         self.cubic_inch = us_liquid_pint * 28.875
     elif not is_none(us_legal_cup):
         self.us_liquid_gallon = us_legal_cup / 15.773
         self.us_liquid_quart = us_legal_cup / 3.943
         self.us_liquid_pint = us_legal_cup / 1.972
         self.us_legal_cup = us_legal_cup
         self.us_fluid_ounce = us_legal_cup * 8.115
         self.us_tablespoon = us_legal_cup * 16.231
         self.us_teaspoon = us_legal_cup * 48.692
         self.cubic_meter = us_legal_cup / 4167
         self.liter = us_legal_cup / 4.167
         self.milliliter = us_legal_cup * 240
         self.imperial_gallon = us_legal_cup / 18.942
         self.imperial_quart = us_legal_cup / 4.736
         self.imperial_pint = us_legal_cup / 2.368
         self.imperial_cup = us_legal_cup / 1.184
         self.imperial_fluid_ounce = us_legal_cup * 8.447
         self.imperial_tablespoon = us_legal_cup * 13.515
         self.imperial_teaspoon = us_legal_cup * 40.545
         self.cubic_foot = us_legal_cup / 118
         self.cubic_inch = us_legal_cup * 14.646
     elif not is_none(us_fluid_ounce):
         self.us_liquid_gallon = us_fluid_ounce / 128
         self.us_liquid_quart = us_fluid_ounce / 32
         self.us_liquid_pint = us_fluid_ounce / 16
         self.us_legal_cup = us_fluid_ounce / 8.115
         self.us_fluid_ounce = us_fluid_ounce
         self.us_tablespoon = us_fluid_ounce * 2
         self.us_teaspoon = us_fluid_ounce * 6
         self.cubic_meter = us_fluid_ounce / 33814
         self.liter = us_fluid_ounce / 33.814
         self.milliliter = us_fluid_ounce * 29.574
         self.imperial_gallon = us_fluid_ounce / 154
         self.imperial_quart = us_fluid_ounce / 38.43
         self.imperial_pint = us_fluid_ounce / 19.215
         self.imperial_cup = us_fluid_ounce / 9.608
         self.imperial_fluid_ounce = us_fluid_ounce * 1.041
         self.imperial_tablespoon = us_fluid_ounce * 1.665
         self.imperial_teaspoon = us_fluid_ounce * 4.996
         self.cubic_foot = us_fluid_ounce / 958
         self.cubic_inch = us_fluid_ounce * 1.805
     elif not is_none(us_tablespoon):
         self.us_liquid_gallon = us_tablespoon / 256
         self.us_liquid_quart = us_tablespoon / 64
         self.us_liquid_pint = us_tablespoon / 32
         self.us_legal_cup = us_tablespoon / 16.231
         self.us_fluid_ounce = us_tablespoon / 2
         self.us_tablespoon = us_tablespoon
         self.us_teaspoon = us_tablespoon * 3
         self.cubic_meter = us_tablespoon / 67628
         self.liter = us_tablespoon / 67.628
         self.milliliter = us_tablespoon * 14.787
         self.imperial_gallon = us_tablespoon / 307
         self.imperial_quart = us_tablespoon / 76.861
         self.imperial_pint = us_tablespoon / 38.43
         self.imperial_cup = us_tablespoon / 19.215
         self.imperial_fluid_ounce = us_tablespoon / 1.922
         self.imperial_tablespoon = us_tablespoon / 1.201
         self.imperial_teaspoon = us_tablespoon * 2.498
         self.cubic_foot = us_tablespoon / 1915
         self.cubic_inch = us_tablespoon / 1.108
     elif not is_none(us_teaspoon):
         self.us_liquid_gallon = us_teaspoon / 768
         self.us_liquid_quart = us_teaspoon / 192
         self.us_liquid_pint = us_teaspoon / 96
         self.us_legal_cup = us_teaspoon / 48.692
         self.us_fluid_ounce = us_teaspoon / 6
         self.us_tablespoon = us_teaspoon / 3
         self.us_teaspoon = us_teaspoon
         self.cubic_meter = us_teaspoon / 202884
         self.liter = us_teaspoon / 203
         self.milliliter = us_teaspoon * 4.929
         self.imperial_gallon = us_teaspoon / 922
         self.imperial_quart = us_teaspoon / 231
         self.imperial_pint = us_teaspoon / 115
         self.imperial_cup = us_teaspoon / 57.646
         self.imperial_fluid_ounce = us_teaspoon / 5.765
         self.imperial_tablespoon = us_teaspoon / 3.603
         self.imperial_teaspoon = us_teaspoon / 1.201
         self.cubic_foot = us_teaspoon / 5745
         self.cubic_inch = us_teaspoon / 3.325
     elif not is_none(cubic_meter):
         self.us_liquid_gallon = cubic_meter * 264
         self.us_liquid_quart = cubic_meter * 1057
         self.us_liquid_pint = cubic_meter * 2113
         self.us_legal_cup = cubic_meter * 4167
         self.us_fluid_ounce = cubic_meter * 33814
         self.us_tablespoon = cubic_meter * 67628
         self.us_teaspoon = cubic_meter * 202884
         self.cubic_meter = cubic_meter
         self.liter = cubic_meter * 1000
         self.milliliter = cubic_meter * 1e+6
         self.imperial_gallon = cubic_meter * 220
         self.imperial_quart = cubic_meter * 880
         self.imperial_pint = cubic_meter * 1760
         self.imperial_cup = cubic_meter * 3520
         self.imperial_fluid_ounce = cubic_meter * 35195
         self.imperial_tablespoon = cubic_meter * 56312
         self.imperial_teaspoon = cubic_meter * 168936
         self.cubic_foot = cubic_meter * 35.315
         self.cubic_inch = cubic_meter * 61024
     elif not is_none(liter):
         self.us_liquid_gallon = liter / 3.785
         self.us_liquid_quart = liter * 1.057
         self.us_liquid_pint = liter * 2.113
         self.us_legal_cup = liter * 4.167
         self.us_fluid_ounce = liter * 33.814
         self.us_tablespoon = liter * 67.628
         self.us_teaspoon = liter * 203
         self.cubic_meter = liter / 1000
         self.liter = liter
         self.milliliter = liter * 1000
         self.imperial_gallon = liter / 4.546
         self.imperial_quart = liter / 1.137
         self.imperial_pint = liter * 1.76
         self.imperial_cup = liter * 3.52
         self.imperial_fluid_ounce = liter * 35.195
         self.imperial_tablespoon = liter * 56.312
         self.imperial_teaspoon = liter * 169
         self.cubic_foot = liter / 28.317
         self.cubic_inch = liter * 61.024
     elif not is_none(milliliter):
         self.us_liquid_gallon = milliliter / 3785
         self.us_liquid_quart = milliliter / 946
         self.us_liquid_pint = milliliter / 473
         self.us_legal_cup = milliliter / 240
         self.us_fluid_ounce = milliliter / 29.574
         self.us_tablespoon = milliliter / 14.787
         self.us_teaspoon = milliliter / 4.929
         self.cubic_meter = milliliter / 1e+6
         self.liter = milliliter / 1000
         self.milliliter = milliliter
         self.imperial_gallon = milliliter / 4546
         self.imperial_quart = milliliter / 1137
         self.imperial_pint = milliliter / 568
         self.imperial_cup = milliliter / 284
         self.imperial_fluid_ounce = milliliter / 28.413
         self.imperial_tablespoon = milliliter / 17.758
         self.imperial_teaspoon = milliliter / 5.919
         self.cubic_foot = milliliter / 28317
         self.cubic_inch = milliliter / 16.387
     elif not is_none(imperial_gallon):
         self.us_liquid_gallon = imperial_gallon * 1.201
         self.us_liquid_quart = imperial_gallon * 4.804
         self.us_liquid_pint = imperial_gallon * 9.608
         self.us_legal_cup = imperial_gallon * 18.942
         self.us_fluid_ounce = imperial_gallon * 154
         self.us_tablespoon = imperial_gallon * 307
         self.us_teaspoon = imperial_gallon * 922
         self.cubic_meter = imperial_gallon / 220
         self.liter = imperial_gallon * 4.546
         self.milliliter = imperial_gallon * 4546
         self.imperial_gallon = imperial_gallon
         self.imperial_quart = imperial_gallon * 4
         self.imperial_pint = imperial_gallon * 8
         self.imperial_cup = imperial_gallon * 16
         self.imperial_fluid_ounce = imperial_gallon * 160
         self.imperial_tablespoon = imperial_gallon * 256
         self.imperial_teaspoon = imperial_gallon * 768
         self.cubic_foot = imperial_gallon / 6.229
         self.cubic_inch = imperial_gallon * 277
     elif not is_none(imperial_quart):
         self.us_liquid_gallon = imperial_quart / 3.331
         self.us_liquid_quart = imperial_quart * 1.201
         self.us_liquid_pint = imperial_quart * 2.402
         self.us_legal_cup = imperial_quart * 4.736
         self.us_fluid_ounce = imperial_quart * 38.43
         self.us_tablespoon = imperial_quart * 76.861
         self.us_teaspoon = imperial_quart * 231
         self.cubic_meter = imperial_quart / 880
         self.liter = imperial_quart * 1.137
         self.milliliter = imperial_quart * 1137
         self.imperial_gallon = imperial_quart / 4
         self.imperial_quart = imperial_quart
         self.imperial_pint = imperial_quart * 2
         self.imperial_cup = imperial_quart * 4
         self.imperial_fluid_ounce = imperial_quart * 40
         self.imperial_tablespoon = imperial_quart * 64
         self.imperial_teaspoon = imperial_quart * 192
         self.cubic_foot = imperial_quart / 24.915
         self.cubic_inch = imperial_quart * 69.355
     elif not is_none(imperial_pint):
         self.us_liquid_gallon = imperial_pint / 6.661
         self.us_liquid_quart = imperial_pint / 1.665
         self.us_liquid_pint = imperial_pint * 1.201
         self.us_legal_cup = imperial_pint * 2.368
         self.us_fluid_ounce = imperial_pint * 19.215
         self.us_tablespoon = imperial_pint * 38.43
         self.us_teaspoon = imperial_pint * 115
         self.cubic_meter = imperial_pint / 1760
         self.liter = imperial_pint / 1.76
         self.milliliter = imperial_pint * 568
         self.imperial_gallon = imperial_pint / 8
         self.imperial_quart = imperial_pint / 2
         self.imperial_pint = imperial_pint
         self.imperial_cup = imperial_pint * 2
         self.imperial_fluid_ounce = imperial_pint * 20
         self.imperial_tablespoon = imperial_pint * 32
         self.imperial_teaspoon = imperial_pint * 96
         self.cubic_foot = imperial_pint / 49.831
         self.cubic_inch = imperial_pint * 34.677
     elif not is_none(imperial_cup):
         self.us_liquid_gallon = imperial_cup / 13.323
         self.us_liquid_quart = imperial_cup / 3.331
         self.us_liquid_pint = imperial_cup / 1.665
         self.us_legal_cup = imperial_cup * 1.184
         self.us_fluid_ounce = imperial_cup * 9.608
         self.us_tablespoon = imperial_cup * 19.215
         self.us_teaspoon = imperial_cup * 57.646
         self.cubic_meter = imperial_cup / 3520
         self.liter = imperial_cup / 3.52
         self.milliliter = imperial_cup * 284
         self.imperial_gallon = imperial_cup / 16
         self.imperial_quart = imperial_cup / 4
         self.imperial_pint = imperial_cup / 2
         self.imperial_cup = imperial_cup
         self.imperial_fluid_ounce = imperial_cup * 10
         self.imperial_tablespoon = imperial_cup * 16
         self.imperial_teaspoon = imperial_cup * 48
         self.cubic_foot = imperial_cup / 99.661
         self.cubic_inch = imperial_cup * 17.339
     elif not is_none(imperial_fluid_ounce):
         self.us_liquid_gallon = imperial_fluid_ounce / 133
         self.us_liquid_quart = imperial_fluid_ounce / 33.307
         self.us_liquid_pint = imperial_fluid_ounce / 16.653
         self.us_legal_cup = imperial_fluid_ounce / 8.447
         self.us_fluid_ounce = imperial_fluid_ounce / 1.041
         self.us_tablespoon = imperial_fluid_ounce * 1.922
         self.us_teaspoon = imperial_fluid_ounce * 5.765
         self.cubic_meter = imperial_fluid_ounce / 35195
         self.liter = imperial_fluid_ounce / 35.195
         self.milliliter = imperial_fluid_ounce * 28.413
         self.imperial_gallon = imperial_fluid_ounce / 160
         self.imperial_quart = imperial_fluid_ounce / 40
         self.imperial_pint = imperial_fluid_ounce / 20
         self.imperial_cup = imperial_fluid_ounce / 10
         self.imperial_fluid_ounce = imperial_fluid_ounce
         self.imperial_tablespoon = imperial_fluid_ounce * 1.6
         self.imperial_teaspoon = imperial_fluid_ounce * 4.8
         self.cubic_foot = imperial_fluid_ounce / 997
         self.cubic_inch = imperial_fluid_ounce * 1.734
     elif not is_none(imperial_tablespoon):
         self.us_liquid_gallon = imperial_tablespoon / 213
         self.us_liquid_quart = imperial_tablespoon / 53.291
         self.us_liquid_pint = imperial_tablespoon / 26.646
         self.us_legal_cup = imperial_tablespoon / 13.515
         self.us_fluid_ounce = imperial_tablespoon / 1.665
         self.us_tablespoon = imperial_tablespoon * 1.201
         self.us_teaspoon = imperial_tablespoon * 3.603
         self.cubic_meter = imperial_tablespoon / 56312
         self.liter = imperial_tablespoon / 56.312
         self.milliliter = imperial_tablespoon * 17.758
         self.imperial_gallon = imperial_tablespoon / 256
         self.imperial_quart = imperial_tablespoon / 64
         self.imperial_pint = imperial_tablespoon / 32
         self.imperial_cup = imperial_tablespoon / 16
         self.imperial_fluid_ounce = imperial_tablespoon / 1.6
         self.imperial_tablespoon = imperial_tablespoon
         self.imperial_teaspoon = imperial_tablespoon * 3
         self.cubic_foot = imperial_tablespoon / 1595
         self.cubic_inch = imperial_tablespoon * 1.084
     elif not is_none(imperial_teaspoon):
         self.us_liquid_gallon = imperial_teaspoon / 639
         self.us_liquid_quart = imperial_teaspoon / 160
         self.us_liquid_pint = imperial_teaspoon / 79.937
         self.us_legal_cup = imperial_teaspoon / 40.545
         self.us_fluid_ounce = imperial_teaspoon / 4.996
         self.us_tablespoon = imperial_teaspoon / 2.498
         self.us_teaspoon = imperial_teaspoon * 1.201
         self.cubic_meter = imperial_teaspoon / 168936
         self.liter = imperial_teaspoon / 169
         self.milliliter = imperial_teaspoon * 5.919
         self.imperial_gallon = imperial_teaspoon / 768
         self.imperial_quart = imperial_teaspoon / 192
         self.imperial_pint = imperial_teaspoon / 96
         self.imperial_cup = imperial_teaspoon / 48
         self.imperial_fluid_ounce = imperial_teaspoon / 4.8
         self.imperial_tablespoon = imperial_teaspoon / 3
         self.imperial_teaspoon = imperial_teaspoon
         self.cubic_foot = imperial_teaspoon / 4784
         self.cubic_inch = imperial_teaspoon / 2.768
     elif not is_none(cubic_foot):
         self.us_liquid_gallon = cubic_foot * 7.481
         self.us_liquid_quart = cubic_foot * 29.922
         self.us_liquid_pint = cubic_foot * 59.844
         self.us_legal_cup = cubic_foot * 118
         self.us_fluid_ounce = cubic_foot * 958
         self.us_tablespoon = cubic_foot * 1915
         self.us_teaspoon = cubic_foot * 5745
         self.cubic_meter = cubic_foot / 35.315
         self.liter = cubic_foot * 28.317
         self.milliliter = cubic_foot * 28317
         self.imperial_gallon = cubic_foot * 6.229
         self.imperial_quart = cubic_foot * 24.915
         self.imperial_pint = cubic_foot * 49.831
         self.imperial_cup = cubic_foot * 99.661
         self.imperial_fluid_ounce = cubic_foot * 997
         self.imperial_tablespoon = cubic_foot * 1595
         self.imperial_teaspoon = cubic_foot * 4784
         self.cubic_foot = cubic_foot
         self.cubic_inch = cubic_foot * 1728
     elif not is_none(cubic_inch):
         self.us_liquid_gallon = cubic_inch / 231
         self.us_liquid_quart = cubic_inch / 57.75
         self.us_liquid_pint = cubic_inch / 28.875
         self.us_legal_cup = cubic_inch / 14.646
         self.us_fluid_ounce = cubic_inch / 1.805
         self.us_tablespoon = cubic_inch * 1.108
         self.us_teaspoon = cubic_inch * 3.325
         self.cubic_meter = cubic_inch / 61024
         self.liter = cubic_inch / 61.024
         self.milliliter = cubic_inch * 16.387
         self.imperial_gallon = cubic_inch / 277
         self.imperial_quart = cubic_inch / 69.355
         self.imperial_pint = cubic_inch / 34.677
         self.imperial_cup = cubic_inch / 17.339
         self.imperial_fluid_ounce = cubic_inch / 1.734
         self.imperial_tablespoon = cubic_inch / 1.084
         self.imperial_teaspoon = cubic_inch * 2.768
         self.cubic_foot = cubic_inch / 1728
         self.cubic_inch = cubic_inch
     else:
         raise TypeError(f"{self.__class__.__name__} expected 1 argument.")
Exemplo n.º 12
0
 def __init__(self, metric_ton = None, kilogram = None, gram = None, milligram = None, microgram = None, imperial_ton = None, us_ton = None, stone = None, pound = None, ounce = None):
     if not is_none(metric_ton):
         self.metric_ton = metric_ton
         self.kilogram = metric_ton * 1000
         self.gram = metric_ton * 1e+6
         self.milligram = metric_ton * 1e+9
         self.microgram = metric_ton * 1e+12
         self.imperial_ton = metric_ton / 1.016
         self.us_ton = metric_ton * 1.102
         self.stone = metric_ton * 157
         self.pound = metric_ton * 2205
         self.ounce = metric_ton * 35274
     elif not is_none(kilogram):
         self.metric_ton = kilogram / 1000
         self.kilogram = kilogram
         self.gram = kilogram * 1000
         self.milligram = kilogram * 1e+6
         self.microgram = kilogram * 1e+9
         self.imperial_ton = kilogram / 1016
         self.us_ton = kilogram / 907
         self.stone = kilogram / 6.35
         self.pound = kilogram * 2.205
         self.ounce = kilogram * 35.274
     elif not is_none(gram):
         self.metric_ton = gram / 1e+6
         self.kilogram = gram / 1000
         self.gram = gram
         self.milligram = gram * 1000
         self.microgram = gram * 1e+6
         self.imperial_ton = gram / 1.016e+6
         self.us_ton = gram / 907185
         self.stone = gram / 6350
         self.pound = gram / 454
         self.ounce = gram / 28.35
     elif not is_none(milligram):
         self.metric_ton = milligram / 1e+9
         self.kilogram = milligram / 1e+6
         self.gram = milligram / 1000
         self.milligram = milligram
         self.microgram = milligram * 1000
         self.imperial_ton = milligram / 1.016e+9
         self.us_ton = milligram / 9.072e+8
         self.stone = milligram / 6.35e+6
         self.pound = milligram / 453592
         self.ounce = milligram / 28350
     elif not is_none(microgram):
         self.metric_ton = microgram / 1e+12
         self.kilogram = microgram / 1e+9
         self.gram = microgram / 1e+6
         self.milligram = microgram / 1000
         self.microgram = microgram
         self.imperial_ton = microgram / 1.016e+12
         self.us_ton = microgram / 9.072e+11
         self.stone = microgram / 6.35e+9
         self.pound = microgram / 4.536e+8
         self.ounce = microgram / 2.835e+7
     elif not is_none(imperial_ton):
         self.metric_ton = imperial_ton * 1.016
         self.kilogram = imperial_ton * 1016
         self.gram = imperial_ton * 1.016e+6
         self.milligram = imperial_ton * 1.016e+9
         self.microgram = imperial_ton * 1.016e+12
         self.imperial_ton = imperial_ton
         self.us_ton = imperial_ton * 1.12
         self.stone = imperial_ton * 160
         self.pound = imperial_ton * 2240
         self.ounce = imperial_ton * 35840
     elif not is_none(us_ton):
         self.metric_ton = us_ton / 1.102
         self.kilogram = us_ton * 907
         self.gram = us_ton * 907185
         self.milligram = us_ton * 9.072e+8
         self.microgram = us_ton * 9.072e+11
         self.imperial_ton = us_ton / 1.12
         self.us_ton = us_ton
         self.stone = us_ton * 143
         self.pound = us_ton * 2000
         self.ounce = us_ton * 32000
     elif not is_none(stone):
         self.metric_ton = stone / 157
         self.kilogram = stone * 6.35
         self.gram = stone * 6350
         self.milligram = stone * 6.35e+6
         self.microgram = stone * 6.35e+9
         self.imperial_ton = stone / 160
         self.us_ton = stone / 143
         self.stone = stone
         self.pound = stone * 14
         self.ounce = stone * 224
     elif not is_none(pound):
         self.metric_ton = pound / 2205
         self.kilogram = pound / 2.205
         self.gram = pound * 454
         self.milligram = pound * 453592
         self.microgram = pound * 4.536e+8
         self.imperial_ton = pound / 2240
         self.us_ton = pound / 2000
         self.stone = pound / 14
         self.pound = pound
         self.ounce = pound * 16
     elif not is_none(ounce):
         self.metric_ton = ounce / 35274
         self.kilogram = ounce / 35.274
         self.gram = ounce * 28.35
         self.milligram = ounce * 28350
         self.microgram = ounce * 2.835e+7
         self.imperial_ton = ounce / 35840
         self.us_ton = ounce / 32000
         self.stone = ounce / 224
         self.pound = ounce / 16
         self.ounce = ounce
     else:
         raise TypeError(f"{self.__class__.__name__} expected 1 argument.")
Exemplo n.º 13
0
 def __init__(self,
              square_kilometer=None,
              square_meter=None,
              square_mile=None,
              square_yard=None,
              square_foot=None,
              square_inch=None,
              hectare=None,
              acre=None):
     if not is_none(square_kilometer):
         self.square_kilometer = square_kilometer
         self.square_meter = square_kilometer * 1e+6
         self.square_mile = square_kilometer / 2.59
         self.square_yard = square_kilometer * 1.196e+6
         self.square_foot = square_kilometer * 1.076e+7
         self.square_inch = square_kilometer * 1.55e+9
         self.hectare = square_kilometer * 100
         self.acre = square_kilometer * 247
     elif not is_none(square_meter):
         self.square_kilometer = square_meter / 1e+6
         self.square_meter = square_meter
         self.square_mile = square_meter / 2.59e+6
         self.square_yard = square_meter * 1.196
         self.square_foot = square_meter * 10.764
         self.square_inch = square_meter * 1550
         self.hectare = square_meter / 10000
         self.acre = square_meter / 4047
     elif not is_none(square_mile):
         self.square_kilometer = square_mile * 2.59
         self.square_meter = square_mile * 2.59e+6
         self.square_mile = square_mile
         self.square_yard = square_mile * 3.098e+6
         self.square_foot = square_mile * 2.788e+7
         self.square_inch = square_mile * 4.014e+9
         self.hectare = square_mile * 259
         self.acre = square_mile * 640
     elif not is_none(square_yard):
         self.square_kilometer = square_yard / 1.196e+6
         self.square_meter = square_yard / 1.196
         self.square_mile = square_yard / 3.098e+6
         self.square_yard = square_yard
         self.square_foot = square_yard * 9
         self.square_inch = square_yard * 1296
         self.hectare = square_yard / 11960
         self.acre = square_yard / 4840
     elif not is_none(square_foot):
         self.square_kilometer = square_foot / 1.076e+7
         self.square_meter = square_foot / 10.764
         self.square_mile = square_foot / 2.788e+7
         self.square_yard = square_foot / 9
         self.square_foot = square_foot
         self.square_inch = square_foot * 144
         self.hectare = square_foot / 107639
         self.acre = square_foot / 43560
     elif not is_none(square_inch):
         self.square_kilometer = square_inch / 1.55e+9
         self.square_meter = square_inch / 1550
         self.square_mile = square_inch / 4.014e+9
         self.square_yard = square_inch / 1296
         self.square_foot = square_inch / 144
         self.square_inch = square_inch
         self.hectare = square_inch / 1.55e+7
         self.acre = square_inch / 6.273e+6
     elif not is_none(hectare):
         self.square_kilometer = hectare / 100
         self.square_meter = hectare * 10000
         self.square_mile = hectare / 259
         self.square_yard = hectare * 11960
         self.square_foot = hectare * 107639
         self.square_inch = hectare * 1.55e+7
         self.hectare = hectare
         self.acre = hectare * 2.471
     elif not is_none(acre):
         self.square_kilometer = acre / 247
         self.square_meter = acre * 4047
         self.square_mile = acre / 640
         self.square_yard = acre * 4840
         self.square_foot = acre * 43560
         self.square_inch = acre * 6.273e+6
         self.hectare = acre / 2.471
         self.acre = acre
     else:
         raise TypeError(f"{self.__class__.__name__} expected 1 argument.")