Skip to content

Commit

Permalink
Fixed lowercase support in prices
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Oct 25, 2014
1 parent 68a4a8e commit 696fe33
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions buildcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ class UnitsAndLevel(object):
splitAtRe = re.compile(r'^(?P<units>\d+)(?P<level>[\?LMH])$', re.IGNORECASE)

def __init__(self, category, reading):
if reading in (None, "unk", "-1L-1", "-1L0", "0L-1"):
ucReading = reading.upper()
if ucReading in (None, "UNK", "-1L-1", "-1L0", "0L-1"):
self.units, self.level = -1, -1
elif reading in ("-", "-L-", "n/a", "0"):
elif ucReading in ("-", "-L-", "N/A", "0"):
self.units, self.level = 0, 0
else:
matches = self.splitLRe.match(reading) or self.splitAtRe.match(reading)
matches = self.splitLRe.match(ucReading) or self.splitAtRe.match(ucReading)
if not matches:
raise ValueError("Invalid {} units/level value. Expected 'unk', <units>L<level> or <units>[\?LMH], got '{}'".format(category, reading))
units, level = matches.group('units', 'level')
Expand Down

0 comments on commit 696fe33

Please sign in to comment.