solve dict of rpn expressions to pure var to val dict
        :param rpndict: dict of rpn expressions
        return pure var to val dict
322965
def resolve_rpn(self, rpndict):
        
        if rpndict == {}:
            return {}

        retflag = self.get_rpndict_flag(rpndict)
        cnt = 0
        tmpdict = {k: v for k, v in rpndict.items()}
        while not retflag:
            # update rpndict
            cnt += 1
            tmpdict = self.update_rpndict(tmpdict)
            # and flag
            retflag = self.get_rpndict_flag(tmpdict)
        return tmpdict
334331
def _serialize_argument(rargname, value, varprops):
    """"""
    _argument = '{rargname}: {value}{props}'
    if rargname == CONSTARG_ROLE:
        value = '"{}"'.format(value)
    props = ''
    if value in varprops:
        props = ' [ {} ]'.format(
            ' '.join(
                [var_sort(value)] +
                list(map('{0[0]}: {0[1]}'.format,
                         [(k.upper(), v) for k, v in varprops[value]]))
            )
        )
        del varprops[value]  # only print props once
    return _argument.format(
        rargname=rargname,
        value=str(value),
        props=props
    )
674462
def get_name2value_dict(self):
        """"""
        x = {}
        for val, num in self._values:
            x[val] = num
        return x
1183481
def iflatten_dict_values(node, depth=0):
    
    if isinstance(node, dict):
        _iter = (iflatten_dict_values(value) for value in six.itervalues(node))
        return util_iter.iflatten(_iter)
    else:
        return node
1024568
def as_dict(self):
        
        out = {}
        for prop in self:
            propval = getattr(self, prop)

            if hasattr(propval, 'for_json'):
                out[prop] = propval.for_json()
            elif isinstance(propval, list):
                out[prop] = [getattr(x, 'for_json', lambda:x)() for x in propval]
            elif isinstance(propval, (ProtocolBase, LiteralValue)):
                out[prop] = propval.as_dict()
            elif propval is not None:
                out[prop] = propval

        return out
986070
def _simple_po_to_dict(tokens) -> BaseAbundance:
    
    dsl = FUNC_TO_DSL.get(tokens[FUNCTION])
    if dsl is None:
        raise ValueError('invalid tokens: {}'.format(tokens))

    return dsl(
        namespace=tokens[NAMESPACE],
        name=tokens.get(NAME),
        identifier=tokens.get(IDENTIFIER),
    )
366537
def from_raw(self, rval: RawScalar, jptr: JSONPointer = "") -> ScalarValue:
        """"""
        res = self.type.from_raw(rval)
        if res is None:
            raise RawTypeError(jptr, self.type.yang_type() + " value")
        return res
381189
def to_primitive(self, value, context=None):
        

        if context and context.get('rel_ids'):
            return value.rid
        else:
            return {'rtype': value.rtype, 'rid': value.rid}
1033246
def _parse_var_scalar(self, X: scalar_type) -> dict:
        
        arg_vars = {}
        #there is only one var name, so this will run once and no sorting is required
        for var_name in self.var_names:
            arg_vars[var_name] = X
        return arg_vars
631006
def packetToDict(pkt):
	

	d = {
		'id': pkt[4],
		'instruction': xl320.InstrToStr[pkt[7]],
		'length': (pkt[6] << 8) + pkt[5],
		'params': pkt[8:-2],
		'crc': pkt[-2:]
	}

	return d
903231
def _parse_ret(func, variables, annotations=None):
    
    anno = (annotations or func.__annotations__).get('return')
    if anno is None:
        return None
    elif isinstance(anno, str):
        writeto = variables[anno]
        writeto.notify_will_write()
        return writeto
    elif (isinstance(anno, tuple) and
          all(isinstance(name, str) for name in anno)):
        writeto = tuple(variables[name] for name in anno)
        for var in writeto:
            var.notify_will_write()
        return writeto
    # Be very strict about annotation format for now.
    raise StartupError(
        'cannot parse return annotation %r for %r' % (anno, func))
758020
def dict_fields(obj, parent=[]):
    
    rtn_obj = {}
    for key, value in obj.items():
        new_key = parent + [key]
        new_key = ".".join(new_key)
        if isinstance(value, list):
            if value:
                value = value[0]
        if isinstance(value, dict):
            rtn_obj.update(dict_fields(value, [new_key]))
        else:
            rtn_obj.update({new_key: value})
    return rtn_obj
121039
def resolve_compound_var_object_fields(var, attrs):
    
    attr_list = attrs.split('\t')

    for k in attr_list:
        type, _typeName, resolver = get_type(var)
        var = resolver.resolve(var, k)

    try:
        type, _typeName, resolver = get_type(var)
        return resolver.get_dictionary(var)
    except:
        pydev_log.exception()
202807
def make_parameter_dict(pdict, fixed_par=False, rescale=True,
                        update_bounds=False):
    
    o = copy.deepcopy(pdict)
    o.setdefault('scale', 1.0)

    if rescale:
        value, scale = utils.scale_parameter(o['value'] * o['scale'])
        o['value'] = np.abs(value) * np.sign(o['value'])
        o['scale'] = np.abs(scale) * np.sign(o['scale'])
        if 'error' in o:
            o['error'] /= np.abs(scale)

    if update_bounds:
        o['min'] = o['value'] * 1E-3
        o['max'] = o['value'] * 1E3

    if fixed_par:
        o['min'] = o['value']
        o['max'] = o['value']

    if float(o['min']) > float(o['value']):
        o['min'] = o['value']

    if float(o['max']) < float(o['value']):
        o['max'] = o['value']

    return o
799240
def unpack_hyperopt_vals(vals):
    
    assert isinstance(vals, dict), "Parameter must be given as dict."
    ret = {}
    for k, v in list(vals.items()):
        try:
            ret[k] = v[0]
        except (TypeError, IndexError):
            ret[k] = v
    return ret
1343270
def _get_py_dictionary(self, var, names=None, used___dict__=False):
        '''
        
        '''

        # TODO: Those should be options (would fix https://github.com/Microsoft/ptvsd/issues/66).
        filter_private = False
        filter_special = True
        filter_function = True
        filter_builtin = True

        if not names:
            names, used___dict__ = self.get_names(var)
        d = {}

        # Be aware that the order in which the filters are applied attempts to
        # optimize the operation by removing as many items as possible in the
        # first filters, leaving fewer items for later filters

        if filter_builtin or filter_function:
            for name in names:
                try:
                    name_as_str = name
                    if name_as_str.__class__ != str:
                        name_as_str = '%r' % (name_as_str,)

                    if filter_special:
                        if name_as_str.startswith('__') and name_as_str.endswith('__'):
                            continue

                    if filter_private:
                        if name_as_str.startswith('_') or name_as_str.endswith('__'):
                            continue
                    if not used___dict__:
                        attr = getattr(var, name)
                    else:
                        attr = var.__dict__[name]

                    # filter builtins?
                    if filter_builtin:
                        if inspect.isbuiltin(attr):
                            continue

                    # filter functions?
                    if filter_function:
                        if inspect.isroutine(attr) or isinstance(attr, MethodWrapperType):
                            continue
                except:
                    # if some error occurs getting it, let's put it to the user.
                    strIO = StringIO.StringIO()
                    traceback.print_exc(file=strIO)
                    attr = strIO.getvalue()

                d[name_as_str] = attr

        return d, used___dict__
873613
def _squeeze(self, var_tbl: dict) -> dict:
        
        var_names = var_tbl.copy()
        # squeeze any numpy arrays
        for v in var_tbl:
            val = var_tbl[v]
            if isinstance(val, np.ndarray):
                var_names[v] = val.squeeze()
        return var_names