Math: sync convertcore unit data with ConvertAll 0.7.2

Also add in a special case for handling the new unitless unit ("!!")
This commit is contained in:
James Lu 2017-09-29 16:02:36 -07:00
parent b5f53fb22f
commit b6c75a70d3
1 changed files with 257 additions and 195 deletions

View File

@ -16,38 +16,40 @@ import copy
unitData = \ unitData = \
""" """
#***************************************************************************** #*****************************************************************************
# units.dat, the units data file, version 0.3.1 #units.dat, the units data file, version 0.6.2
# #
# ConvertAll, a units conversion program # ConvertAll, a units conversion program
# Copyright (C) 2005, Douglas W. Bell # Copyright (C) 2016, Douglas W. Bell
# #
# This is free software; you can redistribute it and/or modify it under the # This is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License, Version 2. This program is # terms of the GNU General Public License, Version 2. This program is
# distributed in the hope that it will be useful, but WITTHOUT ANY WARRANTY. # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.
#***************************************************************************** #*****************************************************************************
# #
# Units are defined by an optional quantity and an equivalent unit or unit # Units are defined by an optional quantity and an equivalent unit or unit
# combination. A python expression may be used for the quantity, but is # combination. A Python expression may be used for the quantity, but is
# resticted to using only the following operators: *, /, +, -, **, (, ). # restricted to using only the following operators: *, /, +, -.
# Beware of integer division truncation: be sure to use a float for at # Beware of integer division truncation: be sure to use a float for at least
# least one of the values. # one of the values.
# #
# The unit type must be placed in square brackets before a set of units. # The unit type must be placed in square brackets before a set of units. The
# The first comment after the equivalent unit will be put in parenthesis after # first comment after the equivalent unit will be put in parenthesis after the
# the unit name (usually used to give the full name of an abbreviated unit). # unit name (usually used to give the full name of an abbreviated unit). The
# The next comment will be used in the program list's comment column; # next comment will be used in the program list's comment column; later
# later comments and full line comments are ignored. # comments and full line comments are ignored.
# #
# Non-linear units are indicated with an equivalent unit in square brackets, # Non-linear units are indicated with an equivalent unit in square brackets,
# followed by either equations or equivalency lists for the definition. # followed by either equations or equivalency lists for the definition. For
# For equations, two are given, separated by a ';'. Both are functions of # equations, two are given, separated by a ';'. Both are functions of "x", the
# "x", the first going from the unit to the equivalent unit and the second # first going from the unit to the equivalent unit and the second one in
# one in reverse. Any valid Python expression returning a float (including # reverse. Any valid Python expression returning a float (including the
# the functions in the math module) should work. The equivalency list is a # functions in the math module) should work. The equivalency list is a Python
# python list of tuples giving points for linear interpolation. # list of tuples giving points for linear interpolation.
# #
# All units must reduce to primitive units, which are indicated by an '!' # All units must reduce to primitive units, which are indicated by an
# as the equivalent unit. Circular refernces must also be avoided. # equivalent unit starting with '!'. A special "unitless" primitve unit
# (usualty called "unit") has '!!' for an equivalent unit. Circular references
# must also be avoided.
# #
# Primitive units: kg, m, s, K, A, mol, cd, rad, sr, bit, unit # Primitive units: kg, m, s, K, A, mol, cd, rad, sr, bit, unit
# #
@ -57,127 +59,152 @@ unitData = \
# mass units # mass units
# #
[mass] [mass]
kg = ! # kilogram kg = ! # kilogram
kilogram = kg kilogram = kg
key = kg # # drug slang key = kg # # drug slang
hectogram = 100 gram hectogram = 100 gram
dekagram = 10 gram dekagram = 10 gram
gram = 0.001 kg gram = 0.001 kg
g = gram # gram g = gram # gram
decigram = 0.1 gram decigram = 0.1 gram
centigram = 0.01 gram centigram = 0.01 gram
milligram = 0.001 gram milligram = 0.001 gram
mg = milligram # milligram mg = milligram # milligram
microgram = 0.001 mg microgram = 0.001 mg
tonne = 1000 kg # # metric tonne = 1000 kg # # metric
metric ton = tonne metric ton = tonne
megagram = tonne megagram = tonne
kilotonne = 1000 tonne # # metric kilotonne = 1000 tonne # # metric
gigagram = 1e9 gram gigagram = 1e9 gram
teragram = 1e12 gram teragram = 1e12 gram
carat = 0.2 gram carat = 0.2 gram
ct = carat # carat ct = carat # carat
amu = 1.66053873e-27 kg # atomic mass amu = 1.66053873e-27 kg # atomic mass
atomic mass unit = amu atomic mass unit = amu
pound = 0.45359237 kg pound = 0.45359237 kg # # avoirdupois
lb = pound # pound lb = pound # pound # avoirdupois
lbm = pound # pound lbm = pound # pound # avoirdupois
ounce = 1/16.0 pound ounce = 1/16.0 pound # # avoirdupois
oz = ounce # ounce oz = ounce # ounce # avoirdupois
lid = ounce # # drug slang lid = ounce # # drug slang
pound troy = 5760 grain dram = 1/16.0 ounce # # avoirdupois
lb troy = pound troy # pound troy pound troy = 5760 grain
ounce troy = 1/12.0 lb troy lb troy = pound troy # pound troy
oz troy = ounce troy # ounce troy ounce troy = 1/12.0 lb troy
ton = 2000 lb # # non-metric oz troy = ounce troy # ounce troy
kiloton = 1000 ton # # non-metric ton = 2000 lb # # non-metric
slug = lbf*s^2/ft kiloton = 1000 ton # # non-metric
stone = 14 lb long ton = 2240 lb # # Imperial
grain = 1/7000.0 lb ton imperial = long ton
slug = lbf*s^2/ft
stone = 14 lb
grain = 1/7000.0 lb
pennyweight = 24 grain
hundredweight long = 112 lb # # Imperial
hundredweight short = 100 lb # # US & Canada
solar mass = 1.9891e30 kg
# #
# length / distance units # length / distance units
# #
[length] [length]
m = ! # meter m = ! # meter
meter = m meter = m
metre = m metre = m
decimeter = 0.1 m dm = 0.1 m # decimeter
cm = 0.01 m # centimeter decimeter = dm
centimeter = cm cm = 0.01 m # centimeter
mm = 0.001 m # millimeter centimeter = cm
millimeter = mm mm = 0.001 m # millimeter
micrometer = 1e-6 m millimeter = mm
micron = micrometer micrometer = 1e-6 m
nanometer = 1e-9 m micron = micrometer
nm = nanometer # nanometer nanometer = 1e-9 m
dekameter = 10 m nm = nanometer # nanometer
hectometer = 100 m dekameter = 10 m
km = 1000 m # kilometer hectometer = 100 m
kilometer = km km = 1000 m # kilometer
megameter = 1000 km kilometer = km
angstrom = 1e-10 m megameter = 1000 km
fermi = 1e-15 m # # nuclear sizes angstrom = 1e-10 m
inch = 2.54 cm fermi = 1e-15 m # # nuclear sizes
in = inch # inch inch = 2.54 cm
inches = inch in = inch # inch
mil = 0.001 inch inches = inch
microinch = 1e-6 inch mil = 0.001 inch
microinches = microinch microinch = 1e-6 inch
foot = 12 inch microinches = microinch
ft = foot # foot foot = 12 inch
feet = foot ft = foot # foot
yard = 3 ft feet = foot
yd = yard # yard foot US survey = 1200/3937.0 m
mile = 5280 ft Cape foot = 1.033 foot
mi = mile # mile yard = 3 ft
nautical mile = 1852 m yd = yard # yard
nmi = nautical mile # nautical mile mile = 5280 ft # # statute mile
league = 3 mile mi = mile # mile # statute mile
chain = 66 ft nautical mile = 1852 m
fathom = 6 ft nmi = nautical mile # nautical mile
rod = 5.5 yard mile US survey = 5280 foot US survey
furlong = 40 rod league = 3 mile
hand = 4 inch chain = 66 ft
cubit = 21.8 inch # # biblical unit chain US survey = 66 foot US survey
point = 1/72.27 inch link = 0.01 chain
pica = 12 point fathom = 6 ft
caliber = 0.01 inch # # bullet sizes cable = 0.1 nautical mile
football field = 100 yd rod = 5.5 yard
marathon = 46145 yd furlong = 40 rod
mil Swedish = 10 km hand = 4 inch
au = 1.49597870691e11 m # astronomical unit cubit = 21.8 inch # # biblical unit
astronomical unit = au point = 1/72.0 inch # # desktop publishing point
light year = 365.25 light speed * day pica = 12 point
light minute = light speed * min caliber = 1.0 inch # # bullet sizes
light second = light speed * s rack unit = 1.75 in # # computing
parsec = 3.0856775813e16 m smoot = 67 inch
kiloparsec = 1000 parsec football field = 100 yd
megaparsec = 1000 kiloparsec marathon = 46145 yd
screw size = [in] 0.013*x + 0.06 ; (x - 0.06) / 0.013 \ mil Swedish = 10 km
# # Unified diameters, non-linear versta = 3500 ft # # Russian unit
AWG = [in] 92.0**((36-x)/39.0)/200.0 ; \ au = 1.49597870691e11 m # astronomical unit
36 - 39.0*log(200.0*x)/log(92.0) \ astronomical unit = au
# American Wire Gauge \ LD = 384400 km # lunar distance # astronomical
# use -1, -2 for 00, 000; non-linear lunar distance = LD # # astronomical distance
American Wire Gauge = [in] 92.0**((36-x)/39.0)/200.0 ; \ light year = 365.25 light speed * day
36 - 39.0*log(200.0*x)/log(92.0) \ light minute = light speed * min
# # use -1, -2 for 00, 000; non-linear light second = light speed * s
standard gauge = [in] [(-5, .448350), (1, .269010), (14, .0747250), \ parsec = 3.0856775813e16 m
(16, .0597800), (17, .0538020), (20, .0358680), \ kiloparsec = 1000 parsec
(26, .0179340), (31, .0104615), (36, .00672525), \ megaparsec = 1000 kiloparsec
(38, .00597800)] # steel \ screw size = [in] 0.013*x + 0.06 ; (x - 0.06) / 0.013 \
# Manufacturers Std. Gauge, non-linear # # Unified diameters, non-linear
zinc gauge = [in] [(1, .002), (10, .02), (15, .04), (19, .06), \ AWG Dia = [in] pow(92.0,(36-x)/39.0)/200.0 ; \
(23, .1), (24, .125), (27, .5), (28, 1)] \ 36 - 39.0*log(200.0*x)/log(92.0) \
# # sheet metal thickness, non-linear # American Wire Gauge \
ring size = [in] 0.1018*x + 1.4216 ; (x - 1.4216) / 0.1018 \ # use -1, -2 for 00, 000; non-linear
# # US size, circum., non-linear American Wire Gauge Dia = [in] pow(92.0,(36-x)/39.0)/200.0 ; \
shoe size mens = [in] x/3.0 + 7 + 1/3.0 ; (x - 7 - 1/3.0) * 3 \ 36 - 39.0*log(200.0*x)/log(92.0) \
# # US sizes, non-linear # # use -1, -2 for 00, 000; non-linear
shoe size womens = [in] x/3.0 + 6 + 5/6.0 ; (x - 6 - 5/6.0) * 3 \ British Std Wire Gauge = [in] [(-6, .500), (-5, .464), (-3, .400), \
# # US sizes, non-linear (-2, .372), (3, .252), (6, .192), (10, .128), \
(14, .080), (19, .040), (23, .024), (26, .018), \
(28, .0148), (30, .0124), (39, .0052), \
(49, .0012), (50, .001)] \
# # use -1, -2 for 2/0, 3/0; non-linear
standard gauge = [in] [(-5, .448350), (1, .269010), (14, .0747250), \
(16, .0597800), (17, .0538020), (20, .0358680), \
(26, .0179340), (31, .0104615), (36, .00672525), \
(38, .00597800)] # steel \
# Manufacturers Std. Gauge, non-linear
zinc gauge = [in] [(1, .002), (10, .02), (15, .04), (19, .06), \
(23, .1), (24, .125), (27, .5), (28, 1)] \
# # sheet metal thickness, non-linear
ring size = [in] 0.1018*x + 1.4216 ; (x - 1.4216) / 0.1018 \
# # US size, circum., non-linear
shoe size mens = [in] x/3.0 + 7 + 1/3.0 ; (x - 7 - 1/3.0) * 3 \
# # US sizes, non-linear
shoe size womens = [in] x/3.0 + 6 + 5/6.0 ; (x - 6 - 5/6.0) * 3 \
# # US sizes, non-linear
# #
@ -289,6 +316,7 @@ picofarad = 1e-12 farad
[magn. flux] [magn. flux]
weber = V*s weber = V*s
Wb = weber # weber Wb = weber # weber
maxwell = 1e-8 Wb
[inductance] [inductance]
henry = Wb/A henry = Wb/A
H = henry # henry H = henry # henry
@ -298,6 +326,7 @@ microhenry = 0.001 mH
[flux density] [flux density]
tesla = Wb/m^2 tesla = Wb/m^2
T = tesla # tesla T = tesla # tesla
gauss = maxwell/cm^2
# #
@ -312,7 +341,7 @@ kmol = kilomole # kilomole
pound mole = mol*lbm/gram pound mole = mol*lbm/gram
lbmol = pound mole # pound mole lbmol = pound mole # pound mole
[size of a mol] [size of a mol]
avogadro = gram/amu*mol avogadro = gram/(amu*mol)
# #
@ -332,9 +361,9 @@ footcandle = lumen/ft^2
metercandle = lumen/m^2 metercandle = lumen/m^2
[luminance] [luminance]
lambert = cd/pi*cm^2 lambert = cd/(pi*cm^2)
millilambert = 0.001 lambert millilambert = 0.001 lambert
footlambert = cd/pi*ft^2 footlambert = cd/(pi*ft^2)
# #
@ -423,7 +452,7 @@ kbps = 1000 bps # kilobits / sec. # based on power of 10
# Unitless numbers # Unitless numbers
# #
[quantity] [quantity]
unit = ! unit = !!
1 = unit # unit 1 = unit # unit
pi = 3.14159265358979323846 unit pi = 3.14159265358979323846 unit
pair = 2 unit pair = 2 unit
@ -458,41 +487,56 @@ carat gold = karat # # gold purity
# #
[force] [force]
newton = kg*m/s^2 newton = kg*m/s^2
N = newton # newton N = newton # newton
dekanewton = 10 newton dekanewton = 10 newton
kilonewton = 1000 N kilonewton = 1000 N
kN = kilonewton # kilonewton kN = kilonewton # kilonewton
meganewton = 1000 kN meganewton = 1000 kN
millinewton = 0.001 N millinewton = 0.001 N
dyne = cm*g/s^2 dyne = cm*g/s^2
kg force = kg * gravity # kilogram f kg force = kg * gravity # kilogram f
kgf = kg force # kilogram force kgf = kg force # kilogram force
kilogram force = kg force kilogram force = kg force
kp = kg force # kilopond
kilopond = kg force
gram force = g * gravity gram force = g * gravity
pound force = lbm * gravity pound force = lbm * gravity # # avoirdupois
lbf = pound force # pound force lbf = pound force # pound force # avoirdupois
ton force = ton * gravity ton force = ton * gravity
ounce force = ounce * gravity ounce force = ounce * gravity
ozf = ounce force # ounce force ozf = ounce force # ounce force
tonne force = tonne * gravity # # metric
pdl = lbm * ft / sec^2 # poundal # Imperial force
poundal = pdl # # Imperial force
# #
# area units # area units
# #
[area] [area]
barn = 1e-28 m^2 # # particle physics barn = 1e-28 m^2 # # particle physics
are = 100 m^2 are = 100 m^2
decare = 10 are decare = 10 are
dekare = 10 are dekare = 10 are
hectare = 100 are hectare = 100 are
acre = 10 chain^2 stremma = 1000 m^2
section = mile^2 acre = 10 chain^2
township = 36 section section = mile^2
homestead = 160 acre township = 36 section
rai = 1600 m^2 # # Thai homestead = 160 acre
ngaan = 400 m^2 # # Thai square perch = 30.25 yd^2
circular inch = 1/4.0 pi*in^2 # # area of 1 inch circle rood = 0.25 acre
circular mil = 1/4.0 pi*mil^2 # # area of 1 mil circle rai = 1600 m^2 # # Thai
ngaan = 400 m^2 # # Thai
circular inch = 1/4.0 pi*in^2 # # area of 1 inch circle
circular mil = 1/4.0 pi*mil^2 # # area of 1 mil circle
AWG Area = [in^2] pi/4*pow(pow(92.0,(36-x)/39.0)/200.0,2) ; \
36 - 39.0*log(200.0*sqrt(x*4.0/pi))/log(92.0) \
# American Wire Gauge \
# use -1, -2 for 00, 000; non-linear
American Wire Gauge Area = [in^2] pi/4*pow(pow(92.0,(36-x)/39.0)/200.0,2) ; \
36 - 39.0*log(200.0*sqrt(x*4.0/pi))/log(92.0) \
# # use -1, -2 for 00, 000; non-linear
# #
@ -508,6 +552,7 @@ deciliter = 0.1 liter
centiliter = 0.01 liter centiliter = 0.01 liter
milliliter = cc milliliter = cc
ml = milliliter # milliliter ml = milliliter # milliliter
microliter = 1e-6 liter
dekaliter = 10 liter dekaliter = 10 liter
hectoliter = 100 liter hectoliter = 100 liter
kiloliter = 1000 liter kiloliter = 1000 liter
@ -522,6 +567,8 @@ pt = pint # pint # US liquid
fluid ounce = 1/16.0 pint # # US fluid ounce = 1/16.0 pint # # US
fl oz = fluid ounce # fluid ounce # US fl oz = fluid ounce # fluid ounce # US
ounce fluid = fluid ounce # # US ounce fluid = fluid ounce # # US
fluid dram = 1/8.0 fluid ounce # # US
minim = 1/480.0 fluid ounce # # US
imperial gallon = 4.54609 liter imperial gallon = 4.54609 liter
imp gal = imperial gallon # imperial gallon imp gal = imperial gallon # imperial gallon
gallon imperial = imperial gallon gallon imperial = imperial gallon
@ -533,6 +580,8 @@ imp pt = imperial pint # imperial pint
pint imperial = imperial pint pint imperial = imperial pint
imperial fluid ounce = 1/160.0 imp gal imperial fluid ounce = 1/160.0 imp gal
imp fl oz = imperial fluid ounce # imperial fluid ounce imp fl oz = imperial fluid ounce # imperial fluid ounce
imperial fluid dram = 1/8.0 imp fl oz
imperial minim = 1/480.0 imp fl oz
cup = 8 fl oz cup = 8 fl oz
tablespoon = 1/16.0 cup tablespoon = 1/16.0 cup
tbsp = tablespoon # tablespoon tbsp = tablespoon # tablespoon
@ -613,19 +662,20 @@ megabar = 1000 kilobar
mm Hg = mm*density Hg*gravity mm Hg = mm*density Hg*gravity
millimeter of Hg = mm Hg millimeter of Hg = mm Hg
torr = mm Hg torr = mm Hg
micron of Hg = micron*density Hg*gravity
in Hg = in*density Hg*gravity # inch of Hg in Hg = in*density Hg*gravity # inch of Hg
inch of Hg = in Hg inch of Hg = in Hg
m water = m*density water*gravity # meter of H2O m water = m*density water*gravity # meter of H2O # fresh water
m H2O = m water # meter of H2O m H2O = m water # meter of H2O # fresh water
meter of water = m water meter of water = m water # # fresh water
in water = in*density water*gravity # inch of H2O in water = in*density water*gravity # inch of H2O # fresh water
in H2O = in water # inch of H2O in H2O = in water # inch of H2O # fresh water
inch of water = in water inch of water = in water # # fresh water
ft water = ft*density water*gravity # feet of H2O ft water = ft*density water*gravity # feet of H2O # fresh water
ft H2O = ft water # feet of H20 ft H2O = ft water # feet of H20 # fresh water
feet of water = ft water feet of water = ft water # # fresh water
foot of head = ft water foot of head = ft water # # fresh water
ft hd = ft water # foot of head ft hd = ft water # foot of head # fresh water
psi = lbf/in^2 # pound / sq inch psi = lbf/in^2 # pound / sq inch
pound per sq inch = psi pound per sq inch = psi
ksi = 1000 psi # 1000 lb / sq inch ksi = 1000 psi # 1000 lb / sq inch
@ -657,27 +707,31 @@ density polycarbonate = 0.045 lb/in^3
# energy units # energy units
# #
[energy] [energy]
joule = N*m joule = N*m
J = joule # joule J = joule # joule
kilojoule = 1000 joule kilojoule = 1000 joule
kJ = kilojoule # kilojoule kJ = kilojoule # kilojoule
megajoule = 1000 kilojoule megajoule = 1000 kilojoule
gigajoule = 1000 megajoule gigajoule = 1000 megajoule
millijoule = 0.001 joule millijoule = 0.001 joule
mJ = millijoule # millijoule mJ = millijoule # millijoule
calorie = 4.1868 J calorie = 4.1868 J
cal = calorie # calorie cal = calorie # calorie
kilocalorie = 1000 cal kilocalorie = 1000 cal
kcal = kilocalorie # kilocalorie kcal = kilocalorie # kilocalorie
calorie food = kilocalorie calorie food = kilocalorie
Btu = cal*lb*R/g*K # British thermal unit thermie = 1000 kcal
British thermal unit = Btu Btu = cal*lb*R/(g*K) # British thermal unit
erg = cm*dyne British thermal unit = Btu
electronvolt = 1.602176462e-19 J therm = 100000 Btu
eV = electronvolt # electronvolt erg = cm*dyne
kWh = kW*hour # kilowatt-hour electronvolt = 1.602176462e-19 J
kilowatt hour = kWh eV = electronvolt # electronvolt
ton TNT = 4.184e9 J kWh = kW*hour # kilowatt-hour
kilowatt hour = kWh
ton TNT = 4.184e9 J
tonne oil equivalent = 41.868 gigajoule
tonne coal equivalent = 7000000 kcal
# #
@ -696,6 +750,8 @@ milliwatt = 0.001 W
horsepower = 550 ft*lbf/sec horsepower = 550 ft*lbf/sec
hp = horsepower # horsepower hp = horsepower # horsepower
metric horsepower = 75 kgf*m/s metric horsepower = 75 kgf*m/s
ton refrigeration = 12000 Btu/hr
MBH = 1000 Btu/hr # 1000 Btu/hr
# #
@ -725,7 +781,8 @@ roentgen = 2.58e-4 coulomb/kg
[radiation dose] [radiation dose]
gray = J/kg gray = J/kg
Gy = gray # gray Gy = gray # gray
rad. abs. dose = 0.001 Gy # # commonly rad centigray = 0.01 Gy
rad. abs. dose = 0.01 Gy # # commonly rad
sievert = J/kg # # equiv. dose sievert = J/kg # # equiv. dose
millisievert = 0.001 sievert # # equiv. dose millisievert = 0.001 sievert # # equiv. dose
Sv = sievert # sievert # equiv. dose Sv = sievert # sievert # equiv. dose
@ -737,7 +794,7 @@ millirem = 0.001 rem # # roentgen equiv mammal
# viscosity # viscosity
# #
[dyn viscosity] [dyn viscosity]
poise = g/cm*s poise = g/(cm*s)
P = poise # poise P = poise # poise
centipoise = 0.01 poise centipoise = 0.01 poise
cP = centipoise # centipoise cP = centipoise # centipoise
@ -754,13 +811,18 @@ cSt = centistokes # centistokes
# #
[acceleration] [acceleration]
gravity = 9.80665 m/s^2 gravity = 9.80665 m/s^2
galileo = cm/s^2
[constant] [constant]
gravity constant = 6.673e-11 N*m^2/kg^2 gravity constant = 6.673e-11 N*m^2/kg^2
gas constant = 8.314472 J/mol*K # R gas constant = 8.314472 J/(mol*K) # R
[fuel consumpt.] [fuel consumpt.]
mpg = mi/gal # miles/gallon mpg = mi/gal # miles/gallon
mpg imp = mi/gallon imperial # miles/gallon imp
liter per 100 km = [mpg] 3.785411784 / (x * 0.01609344) ; \ liter per 100 km = [mpg] 3.785411784 / (x * 0.01609344) ; \
3.785411784 / (x * 0.01609344) # # non-linear 3.785411784 / (x * 0.01609344) # # non-linear
[permeability]
darcy = 1 cm^2*centipoise/atm/s
millidarcy = 0.001 darcy
""" """
@ -937,7 +999,7 @@ class UnitGroup:
if count > 5000: if count > 5000:
raise UnitDataError('Circular unit definition') raise UnitDataError('Circular unit definition')
unit = tmpList.pop(0) unit = tmpList.pop(0)
if unit.equiv == '!': if unit.equiv in ('!', '!!'):
self.reducedList.append(copy.copy(unit)) self.reducedList.append(copy.copy(unit))
elif not unit.equiv: elif not unit.equiv:
raise UnitDataError('Invalid conversion for "%s"' % unit.name) raise UnitDataError('Invalid conversion for "%s"' % unit.name)