Resolve the rpn string into calulated float number

        USAGE: rpn2val(rdict)
            :param rdict: json like dict
339352
def rpn2val(self, rdict):
        

        kw_name = list(rdict.keys())[0]  # b11
        kw_val = rdict[kw_name]
        try:
            kw_type = list(kw_val.keys())[0]  # csrcsben
            kw_param = list(kw_val.values())[0]
            if kw_type != 'beamline':
                for k, v in kw_param.items():
                    v = self.scanStoVars(v)
                    rpnval = rpn.Rpn.solve_rpn(v)
                    if rpnval is not None:
                        kw_param[k] = rpnval  # update rpn string to float if not None
        except:
            pass
616135
def get_prep_value(self, value):
		
		if value is None or value == "":
			return None
		if isinstance(value, six.string_types):
			value = _hex_string_to_unsigned_integer(value)
		if _using_signed_storage():
			value = _unsigned_to_signed_integer(value)
		return value
764752
def crval(self):
        
        try:
            return self.wcs.crval1, self.wcs.crval2
        except Exception as ex:
            logging.debug("Couldn't get CRVAL from WCS: {}".format(ex))
            logging.debug("Trying RA/DEC values")

        try:
            return (float(self['RA-DEG']),
                    float(self['DEC-DEG']))
        except KeyError as ke:
            KeyError("Can't build CRVAL1/2 missing keyword: {}".format(ke.args[0]))
1240468
def get_numeric_value(string_value):
    
    num_chars = ['.', '+', '-']
    number = ''
    for c in string_value:
        if c.isdigit() or c in num_chars:
            number += c
    return number
666057
def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
        
        if value_count == 1:
            numerator = stream_rdr.read_long(value_offset)
            denominator = stream_rdr.read_long(value_offset, 4)
            return numerator / denominator
        else:  # pragma: no cover
            return 'Multi-value Rational NOT IMPLEMENTED'
430581
def try_number(value):
    

    for cast_function in [int, float]:
        try:
            return cast_function(value)
        except ValueError:
            pass

    raise ValueError("Unable to use value as int or float: {0!r}"
                     .format(value))
1031619
def pprint_value_string(self, value):
        
        unit = '' if self.unit is None else ' ' + bytes_to_unicode(self.unit)
        value = self.pprint_value(value)
        return title_format.format(name=bytes_to_unicode(self.label), val=value, unit=unit)
720953
def resolvePrefix(self):
        
        tmpstrlist = []
        tmpstodict = {}
        for line in self.file_lines:
            if line.startswith('%'):
                stolist = line.replace('%', '').split('sto')
                rpnexp = stolist[0].strip()  # rpn expression
                rpnvar = stolist[1].strip()  # rpn variable
                tmpstodict[rpnvar] = rpnexp
                # bug: rpnval in rpnexp
                # raises error when converting string convert to float
                # Found: 2016-06-08 22:29:25 PM CST
                # Fixed: 2016-06-12 11:51:01 AM CST
                # e.g.
                # a sto 0.1
                # a sto b
                # then b should be 0.1,
                # i.e. b -> a -> 0.1
                # solve the 'sto chain' assignment issue.

        self.stodict = self.resolve_rpn(tmpstodict)
        for k, v in self.stodict.items():
            stostr = '% {val} sto {var}'.format(val=v, var=k)
            tmpstrlist.append(stostr)
        self.prestrdict['_prefixstr'] = tmpstrlist
181528
def parse_float_literal(ast, _variables=None):
    """"""
    if isinstance(ast, (FloatValueNode, IntValueNode)):
        return float(ast.value)
    return INVALID
660838
def resolve_str(name_or_func, module, default):
    
    assert isinstance(name_or_func, str)
    resolved = resolve(name_or_func, module=module)

    if isinstance(resolved, ModuleType):
        if not hasattr(resolved, default):
            raise ImportError("{}.{}".format(resolved.__name__, default))

        resolved = getattr(resolved, default)

    if not callable(resolved):
        raise TypeError("{!r} is not callable"
                        "".format(resolved))

    return resolved
581329
def _convert_value(val):
    
    def _is_number(x, op):
        try:
            op(x)
            return True
        except ValueError:
            return False
    if isinstance(val, (list, tuple)):
        return [_convert_value(x) for x in val]
    elif val is None:
        return val
    elif _is_number(val, int):
        return int(val)
    elif _is_number(val, float):
        return float(val)
    elif val.find(";;") >= 0:
        return [_convert_value(v) for v in val.split(";;")]
    elif val.startswith(("{", "[")):
        # Can get ugly JSON output from CWL with unicode and ' instead of "
        # This tries to fix it so parsed correctly by json loader
        return json.loads(val.replace("u'", "'").replace("'", '"'))
    elif val.lower() == "true":
        return True
    elif val.lower() == "false":
        return False
    else:
        return val
470042
def get(self, r):
        
        if r is None:
            return None

        if r.lower() == '(sp)' and self.stack:
            return self.stack[-1]

        if r[:1] == '(':
            return self.mem[r[1:-1]]

        r = r.lower()
        if is_number(r):
            return str(valnum(r))

        if not is_register(r):
            return None

        return self.regs[r]
886281
def rl(self, r):
        
        if self.C is None or not is_number(self.regs[r]):
            self.set(r, None)
            self.set_flag(None)
            return

        self.rlc(r)
        tmp = self.C
        v_ = self.getv(self.regs[r])
        self.C = v_ & 1
        self.regs[r] = str((v_ & 0xFE) | tmp)
1068621
def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
        
        if value_count == 1:
            return stream_rdr.read_short(offset, 8)
        else:  # pragma: no cover
            return 'Multi-value short integer NOT IMPLEMENTED'
1028200
def str2ints(self, str_value):
    """"""
    if not self._encoder:
      raise ValueError(
          "Text.str2ints is not available because encoder hasn't been defined.")
    return self._encoder.encode(str_value)
175592
def txn2data(self, txn: dict) -> str:
        

        rv_json = json.dumps({})
        if self == Protocol.V_13:
            rv_json = json.dumps(txn['result'].get('data', {}))
        else:
            rv_json = json.dumps((txn['result'].get('data', {}) or {}).get('txn', {}))  # "data": null for no such txn

        return rv_json
1174775
def _value_formatter(self, float_format=None, threshold=None):
        

        # the float_format parameter supersedes self.float_format
        if float_format is None:
            float_format = self.float_format

        # we are going to compose different functions, to first convert to
        # a string, then replace the decimal symbol, and finally chop according
        # to the threshold

        # when there is no float_format, we use str instead of '%g'
        # because str(0.0) = '0.0' while '%g' % 0.0 = '0'
        if float_format:
            def base_formatter(v):
                return float_format(value=v) if notna(v) else self.na_rep
        else:
            def base_formatter(v):
                return str(v) if notna(v) else self.na_rep

        if self.decimal != '.':
            def decimal_formatter(v):
                return base_formatter(v).replace('.', self.decimal, 1)
        else:
            decimal_formatter = base_formatter

        if threshold is None:
            return decimal_formatter

        def formatter(value):
            if notna(value):
                if abs(value) > threshold:
                    return decimal_formatter(value)
                else:
                    return decimal_formatter(0.0)
            else:
                return self.na_rep

        return formatter