Skip to content

Commit

Permalink
units.py: Add importing regexps
Browse files Browse the repository at this point in the history
  • Loading branch information
Pekka Nikander committed Jun 4, 2012
1 parent 0cbd472 commit bb602ad
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions units.py
@@ -1,5 +1,7 @@
"""Helper routine to parse numbers with units."""

import re

def parse_unit(s, expected_unit=None, unit_required=False):
muls = { None: 1.0, 'k': 1000.0, 'm': 1.0/1000, 'u': 1.0/1000000, 'n': 1.0/1000000000 }
m = re.match(r'([0-9\.eE+-]+) *(k|m|u|n)?(s|discharger_clocks|cycles|Hz|%|V)?', s)
Expand Down

0 comments on commit bb602ad

Please sign in to comment.