# Path: hftools/utils.py
# def to_numeric(value, error=True):
#     """Translate string *value* to numeric type if possible
#     """
#     try:
#         return value + 0
#     except TypeError:
#         pass
#     try:
#         return int(value)
#     except ValueError:
#         try:
#             return float(value)
#         except ValueError:
#             try:
#                 if dateregexp.match(value):
#                     return np.datetime64(value)
#                 else:
#                     raise ValueError
#             except (ValueError, TypeError):
#                 if error:
#                     raise
#     return value
# 
# def isrealnumber(x):
#     return isinstance(x, (int, float))


import imp
import re
import numpy as np
import hftools.dataset
from hftools.utils import to_numeric, isrealnumber

for u in siunit_names:
    for p, val in siprefixes.items():
        setattr(siunits, p + u, val)


def unit_to_multiplier(unit):
    """Convert a unit to multiplier with baseunit
    """
    unit = unit.strip()
    if len(unit) == 1:
        if unit == "%":
            return .01, None
        if unit == "#":
            return 1, None
        else:
            return 1, unit
    elif len(unit) >= 2 and unit[0] in siprefixes:
        if unit[1:] in siunit_names:
            return siprefixes[unit[0]], unit[1:]
        else:
            return 1, unit
    else:
        return 1, unit

reg_value = re.compile(r"[-+0-9.]+[eE]?[-+0-9]?")
reg_unit = re.compile(r"\s*[[]?([a-zA-Z%]+)[]]?")


def string_number_with_unit_to_value(string_number):

# Path: hftools/utils.py
# def to_numeric(value, error=True):
#     """Translate string *value* to numeric type if possible
#     """
#     try:
#         return value + 0
#     except TypeError:
#         pass
#     try:
#         return int(value)
#     except ValueError:
#         try:
#             return float(value)
#         except ValueError:
#             try:
#                 if dateregexp.match(value):
#                     return np.datetime64(value)
#                 else:
#                     raise ValueError
#             except (ValueError, TypeError):
#                 if error:
#                     raise
#     return value
# 
# def isrealnumber(x):
#     return isinstance(x, (int, float))


# Path: hftools/constants/si_units.py
import imp
import re
import numpy as np
import hftools.dataset
from hftools.utils import to_numeric, isrealnumber


for u in siunit_names:
    for p, val in siprefixes.items():
        setattr(siunits, p + u, val)


def unit_to_multiplier(unit):
    """Convert a unit to multiplier with baseunit
    """
    unit = unit.strip()
    if len(unit) == 1:
        if unit == "%":
            return .01, None
        if unit == "#":
            return 1, None
        else:
            return 1, unit
    elif len(unit) >= 2 and unit[0] in siprefixes:
        if unit[1:] in siunit_names:
            return siprefixes[unit[0]], unit[1:]
        else:
            return 1, unit
    else:
        return 1, unit

reg_value = re.compile(r"[-+0-9.]+[eE]?[-+0-9]?")
reg_unit = re.compile(r"\s*[[]?([a-zA-Z%]+)[]]?")


def string_number_with_unit_to_value(string_number):

    if isrealnumber(string_number):