• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.walk_json_dict函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sbp.utils.walk_json_dict函数的典型用法代码示例。如果您正苦于以下问题:Python walk_json_dict函数的具体用法?Python walk_json_dict怎么用?Python walk_json_dict使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了walk_json_dict函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: mk_readable_msg

def mk_readable_msg(msg):
  """
  Produces a unit test case from a parsed SBP message. The case
  includes the raw output, the SBP message with unparsed payload, and
  the parsed SBP message

  Parameters
  ----------
  msg : Subclass of :class: `SBP`.
    Parsed SBP message.
  keys : list
    List of keys to remove from the rendered

  Returns
  ----------
  A dict formatted for a unit test case.

  """
  f = walk_json_dict(dict([(k, getattr(msg, k)) for k in msg.__slots__]))
  # Message includes fields from the SBP message it inherits from, so
  # remove those.
  i = {'raw_packet' : base64.standard_b64encode(msg.pack()),
       'raw_json'   : msg.to_json(),
       'msg_type'   : hex(msg.msg_type),
       'sbp'        : _to_readable_dict(msg),
       'msg'        : { 'module' : msg.__class__.__module__,
                        'name' : msg.__class__.__name__,
                        'fields' : f if f else None}}
  return i
开发者ID:SenteraLLC,项目名称:libsbp,代码行数:29,代码来源:build_test_data.py


示例2: to_json

  def to_json(self):
    """Produce a JSON-encoded SBP message.

    """
    d = super( MsgIarState, self).to_json_dict()
    j = walk_json_dict(exclude_fields(self))
    d.update(j)
    return json.dumps(d)
开发者ID:yxftju,项目名称:libsbp,代码行数:8,代码来源:piksi.py


示例3: _process_tracking

 def _process_tracking(self, host_offset, host_time, msg):
   if type(msg) is tr.MsgTrackingState:
     m = exclude_fields(msg)
     # Flatten a bit: reindex at the top level by prn and remove the
     # 'states' field from the message.
     for s in msg.states:
       m[s.prn] = walk_json_dict(s)
       m[s.prn].update({'host_offset': host_offset,
                        'host_time': host_time})
     del m['states']
     self.rover_tracking[host_offset] = m
开发者ID:kovach,项目名称:gnss-analysis,代码行数:11,代码来源:records2table.py


示例4: _process_uart_state

 def _process_uart_state(self, host_offset, host_time, msg):
   if type(msg) is piksi.MsgUartState:
     m = exclude_fields(msg)
     for i in ['uart_a', 'uart_b' ,'uart_ftdi']:
       n = walk_json_dict(m[i])
       n['host_offset'] = host_offset
       n['host_time'] = host_time
       # Normalize to percentage from 255.
       n['rx_buffer_level'] = m[i]['rx_buffer_level'] / 255.
       n['tx_buffer_level'] = m[i]['tx_buffer_level'] / 255.
       if i in self.rover_uart_state:
         self.rover_uart_state[i].update({host_offset: n})
       else:
         self.rover_uart_state[i] = {host_offset: n}
     l = walk_json_dict(m['latency'])
     l['host_offset'] = host_offset
     l['host_time'] = host_time
     if 'latency' in self.rover_uart_state:
       self.rover_uart_state['latency'].update({host_offset: l})
     else:
       self.rover_uart_state['latency'] = {host_offset: l}
开发者ID:imh,项目名称:gnss-analysis,代码行数:21,代码来源:records2table.py


示例5: _process_tracking

 def _process_tracking(self, host_offset, host_time, msg):
   if type(msg) in [tr.MsgTrackingState, tr.MsgTrackingStateDepA]:
     m = exclude_fields(msg)
     # Flatten a bit: reindex at the top level by prn and remove the
     # 'states' field from the message.
     for s in msg.states:
       d = walk_json_dict(s)
       prn = s.sid if msg.msg_type is tr.SBP_MSG_TRACKING_STATE else s.prn
       d['host_offset'] = host_offset
       d['host_time'] = host_time
       if prn in self.rover_tracking:
         self.rover_tracking[prn].update({host_offset: d})
       else:
         self.rover_tracking[prn] = {host_offset: d}
     del m['states']
开发者ID:imh,项目名称:gnss-analysis,代码行数:15,代码来源:records2table.py


示例6: to_json_dict

 def to_json_dict(self):
   self.to_binary()
   d = super( MsgAcqSvProfile, self).to_json_dict()
   j = walk_json_dict(exclude_fields(self))
   d.update(j)
   return d
开发者ID:SenteraLLC,项目名称:libsbp,代码行数:6,代码来源:acquisition.py


示例7: to_json_dict

 def to_json_dict(self):
   self.to_binary()
   d = super( MsgSettingsRegister, self).to_json_dict()
   j = walk_json_dict(exclude_fields(self))
   d.update(j)
   return d
开发者ID:wltr,项目名称:libsbp,代码行数:6,代码来源:settings.py


示例8: to_json_dict

 def to_json_dict(self):
   self.to_binary()
   d = super( MsgEphemerisDepA, self).to_json_dict()
   j = walk_json_dict(exclude_fields(self))
   d.update(j)
   return d
开发者ID:axlan,项目名称:libsbp,代码行数:6,代码来源:observation.py


示例9: to_json_dict

 def to_json_dict(self):
   self.to_binary()
   d = super( MsgTrackingIq, self).to_json_dict()
   j = walk_json_dict(exclude_fields(self))
   d.update(j)
   return d
开发者ID:swift-nav,项目名称:libsbp,代码行数:6,代码来源:tracking.py


示例10: to_json_dict

 def to_json_dict(self):
   self.to_binary()
   d = super( MsgStmFlashUnlockSector, self).to_json_dict()
   j = walk_json_dict(exclude_fields(self))
   d.update(j)
   return d
开发者ID:namhh,项目名称:libsbp,代码行数:6,代码来源:flash.py


示例11: to_json_dict

 def to_json_dict(self):
   self.to_binary()
   d = super( MsgSsrPhaseBiases, self).to_json_dict()
   j = walk_json_dict(exclude_fields(self))
   d.update(j)
   return d
开发者ID:swift-nav,项目名称:libsbp,代码行数:6,代码来源:ssr.py


示例12: to_json_dict

 def to_json_dict(self):
   self.to_binary()
   d = super( MsgNetworkStateResp, self).to_json_dict()
   j = walk_json_dict(exclude_fields(self))
   d.update(j)
   return d
开发者ID:wltr,项目名称:libsbp,代码行数:6,代码来源:piksi.py


示例13: to_json_dict

 def to_json_dict(self):
   self.to_binary()
   d = super( MsgCsacTelemetryLabels, self).to_json_dict()
   j = walk_json_dict(exclude_fields(self))
   d.update(j)
   return d
开发者ID:swift-nav,项目名称:libsbp,代码行数:6,代码来源:system.py


示例14: to_json_dict

 def to_json_dict(self):
   self.to_binary()
   d = super( MsgCommandOutput, self).to_json_dict()
   j = walk_json_dict(exclude_fields(self))
   d.update(j)
   return d
开发者ID:SenteraLLC,项目名称:libsbp,代码行数:6,代码来源:piksi.py


示例15: to_json_dict

 def to_json_dict(self):
   self.to_binary()
   d = super( MsgFileioConfigResp, self).to_json_dict()
   j = walk_json_dict(exclude_fields(self))
   d.update(j)
   return d
开发者ID:swift-nav,项目名称:libsbp,代码行数:6,代码来源:file_io.py


示例16: to_json_dict

 def to_json_dict(self):
   self.to_binary()
   d = super( MsgMaskSatellite, self).to_json_dict()
   j = walk_json_dict(exclude_fields(self))
   d.update(j)
   return d
开发者ID:chenyanming,项目名称:ArduMing,代码行数:6,代码来源:piksi.py


示例17: to_json_dict

 def to_json_dict(self):
   self.to_binary()
   d = super( MsgBootloaderJumpToApp, self).to_json_dict()
   j = walk_json_dict(exclude_fields(self))
   d.update(j)
   return d
开发者ID:swift-nav,项目名称:libsbp,代码行数:6,代码来源:bootload.py


示例18: to_json_dict

 def to_json_dict(self):
   self.to_binary()
   d = super( MsgHeartbeat, self).to_json_dict()
   j = walk_json_dict(exclude_fields(self))
   d.update(j)
   return d
开发者ID:MBZIRCUPENNCTU,项目名称:libsbp,代码行数:6,代码来源:system.py


示例19: to_json_dict

 def to_json_dict(self):
   self.to_binary()
   d = super( MsgOrientEuler, self).to_json_dict()
   j = walk_json_dict(exclude_fields(self))
   d.update(j)
   return d
开发者ID:swift-nav,项目名称:libsbp,代码行数:6,代码来源:orientation.py



注:本文中的sbp.utils.walk_json_dict函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sc2reader.load_replay函数代码示例发布时间:2022-05-27
下一篇:
Python utils.exclude_fields函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap