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

Python debug_tools.PrettyFormatAny类代码示例

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

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



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

示例1: test_02_Decode

 def test_02_Decode(self):
     # l_json = json_tools.encode_json(self.m_pyhouse_obj.Computer)
     l_json = json_tools.encode_json(MSG_DICT)
     print(PrettyFormatAny.form(l_json, 'A1-02-A - Encoded Info'))
     l_dict = json_tools.decode_json_unicode(l_json)
     print(l_dict)
     print(PrettyFormatAny.form(l_dict, 'A1-02-B - Decoded Info'))
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:7,代码来源:test_json_tools.py


示例2: decode

 def decode(self, p_topic, p_message):
     """ Decode the computer specific portions of the message and append them to the log string.
     @param p-logmsg: is the partially decoded Mqtt message json
     @param p_topic: is a list of topic part strings ( pyhouse, housename have been dropped
     @param p_message: is the payload that is JSON
     """
     l_logmsg = '\tComputer:\n'
     #  computer/browser/***
     if p_topic[1] == 'browser':
         _l_name = 'unknown'
         l_logmsg += '\tBrowser: Message {}'.format(PrettyFormatAny.form(p_message, 'Computer msg', 160))
     #  computer/ip
     elif p_topic[1] == 'ip':
         l_ip = self._get_field(p_message, 'ExternalIPv4Address')
         l_logmsg += '\tIPv4: {}'.format(l_ip)
     #  computer/startup
     elif p_topic[1] == 'startup':
         self._extract_node(p_message)
         l_logmsg += '\tStartup {}'.format(PrettyFormatAny.form(p_message, 'Computer msg', 160))
         if self.m_myname == self.m_sender:
             l_logmsg += '\tMy own startup of PyHouse\n'
         else:
             l_logmsg += '\tAnother computer started up: {}'.format(self.m_sender)
     #  computer/shutdown
     elif p_topic[1] == 'shutdown':
         del self.m_pyhouse_obj.Computer.Nodes[self.m_name]
         l_logmsg += '\tSelf Shutdown {}'.format(PrettyFormatAny.form(p_message, 'Computer msg', 160))
     #  computer/node/???
     elif p_topic[1] == 'node':
         l_logmsg += syncAPI(self.m_pyhouse_obj).DecodeMqttMessage(p_topic, p_message)
     #  computer/***
     else:
         l_logmsg += '\tUnknown sub-topic {}'.format(PrettyFormatAny.form(p_message, 'Computer msg', 160))
     return l_logmsg
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:34,代码来源:computer.py


示例3: test_01_All

 def test_01_All(self):
     """ Be sure that the XML contains the right stuff.
     """
     l_controllers = self.m_ctlr_api.read_all_controllers_xml(self.m_pyhouse_obj)
     self.m_pyhouse_obj.House.Lighting.Controllers = l_controllers
     print(PrettyFormatAny.form(l_controllers[0], 'R1-01-A - Controller Obj'))
     print(PrettyFormatAny.form(self.m_xml.controller, 'R1-01-B - Controller Xml'))
     interfaceXml.read_interface_xml(l_controllers[0], self.m_xml.controller)
     print(PrettyFormatAny.form(l_controllers[0], 'R1-01-C - Controller Obj'))
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:9,代码来源:test_interface.py


示例4: test_01_Family

 def test_01_Family(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light_sect[0]
     print(PrettyFormatAny.form(l_xml, 'C3-01-A - XML'))
     l_device = self.m_device_obj
     l_light = FamUtil.read_family_data(self.m_pyhouse_obj, l_device, l_xml)
     print(PrettyFormatAny.form(l_light, 'C3-01-B - Light'))
     self.assertEqual(l_device.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:10,代码来源:test_family_utils.py


示例5: test_04_All

 def test_04_All(self):
     """ test reading of entire device set.
     """
     l_obj = panasonicXML.read_panasonic_section_xml(self.m_pyhouse_obj)
     print(PrettyFormatAny.form(l_obj, 'C1-04-A - Plugins.'))
     print(PrettyFormatAny.form(l_obj.Devices, 'C1-04-B - Devices'))
     print(PrettyFormatAny.form(l_obj.Devices[0], 'C1-04-C - Device 0'))
     self.assertEqual(l_obj.Active, True)
     self.assertEqual(l_obj.Count, 2)
     self.assertEqual(str(l_obj.Devices[0].Name), TESTING_PANASONIC_DEVICE_NAME_0)
     self.assertEqual(str(l_obj.Devices[1].Name), TESTING_PANASONIC_DEVICE_NAME_1)
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:11,代码来源:test_panasonic.py


示例6: test_02_Light

 def test_02_Light(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light_sect[1]
     print(PrettyFormatAny.form(l_xml, 'C3-02-A - XML'))
     l_device = self.m_device_obj
     l_light = deviceXML.read_base_device_object_xml(self.m_pyhouse_obj, l_device, l_xml)
     print(PrettyFormatAny.form(l_light, 'C3-02-B - Light'))
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_1)
     self.assertEqual(l_device.RoomName, TESTING_LIGHT_ROOM_NAME_1)
     self.assertEqual(l_light.UPBAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:11,代码来源:test_family_utils.py


示例7: test_05_Data

 def test_05_Data(self):
     """ test that the data structure is correct.
     """
     l_obj = panasonicXML.read_panasonic_section_xml(self.m_pyhouse_obj)
     print(PrettyFormatAny.form(l_obj, 'C1-05-A - Read'))
     l_base = self.m_pyhouse_obj.House.Entertainment
     print(PrettyFormatAny.form(l_base, 'C1-05-B1 - Base'))
     print(PrettyFormatAny.form(l_base.Plugins, 'C1-05-B2 - Plugins'))
     print(PrettyFormatAny.form(l_base.Plugins[SECTION], 'C1-05-B2 - Plugins[SECTION]'))
     self.assertEqual(l_obj.Type, TESTING_PANASONIC_TYPE)
     self.assertEqual(l_base.Plugins[SECTION].Name, SECTION)
     self.assertEqual(l_base.Plugins[SECTION].Devices[0].Name, TESTING_PANASONIC_DEVICE_NAME_0)
     self.assertEqual(l_base.Plugins[SECTION].Devices[1].Name, TESTING_PANASONIC_DEVICE_NAME_1)
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:13,代码来源:test_panasonic.py


示例8: test_04_Add

 def test_04_Add(self):
     l_obj_0 = UuidData()
     l_obj_0.UUID = '12345678-dead-beef-dead-fedcba987654'
     l_obj_0.UuidType = 'House'
     Uuid.add_uuid(self.m_pyhouse_obj, l_obj_0)
     print(PrettyFormatAny.form(self.m_pyhouse_obj.Uuids, 'B2-04-A - one'))
     self.assertEqual(self.m_pyhouse_obj.Uuids.All[l_obj_0.UUID].UuidType, l_obj_0.UuidType)
     #
     l_obj_1 = UuidData()
     l_obj_1.UUID = '01234567-dead-beef-dead-fedcba987654'
     l_obj_1.UuidType = 'Room'
     Uuid.add_uuid(self.m_pyhouse_obj, l_obj_1)
     print(PrettyFormatAny.form(self.m_pyhouse_obj.Uuids.All, 'B2-04-B - two'))
     self.assertEqual(self.m_pyhouse_obj.Uuids.All[l_obj_1.UUID].UuidType, l_obj_1.UuidType)
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:14,代码来源:test_uuid_tools.py


示例9: _save_light

 def _save_light(self, p_obj, p_json):
     LOG.info(PrettyFormatAny.form(p_json, 'JSON'))
     p_obj.Level = int(p_json['Level'])
     p_obj.LightName = p_json['LightName']
     p_obj.Rate = p_json['Rate']
     p_obj.RoomName = p_json['RoomName']
     return p_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:7,代码来源:web_schedules.py


示例10: test_03_AllDevices

 def test_03_AllDevices(self):
     """ Write the entire PandoraSection XML
     """
     l_xml = pandoraXml.write_pandora_section_xml(self.m_pyhouse_obj)
     print(PrettyFormatAny.form(l_xml, 'D1-03-A - All Devices'))
     self.assertEqual(l_xml.attrib['Active'], TESTING_PANDORA_ACTIVE)
     self.assertEqual(l_xml.find('Type').text, TESTING_PANDORA_DEVICE_TYPE_0)
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:7,代码来源:test_pandora.py


示例11: test_02_Xml1

 def test_02_Xml1(self):
     """ Did we get the XML correctly
     """
     l_xml = self.m_xml.light_sect[1]
     print(PrettyFormatAny.form(l_xml, 'C1-02-A - XML'))
     self.assertEqual(l_xml.attrib['Name'], TESTING_LIGHT_NAME_1)
     self.assertEqual(l_xml.find('DeviceFamily').text, TESTING_DEVICE_FAMILY_UPB)
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:7,代码来源:test_family_utils.py


示例12: test_01_House

 def test_01_House(self):
     l_house_obj = houseXml.read_house_xml(self.m_pyhouse_obj)
     self.m_pyhouse_obj.House = l_house_obj
     l_xml = houseXml.write_house_xml(self.m_pyhouse_obj)
     print(PrettyFormatAny.form(l_xml, 'C3-01-A - XML'))
     self.assertEqual(l_xml.tag, 'HouseDivision')
     self.assertEqual(l_xml.attrib['Name'], TESTING_HOUSE_NAME)
     self.assertEqual(l_xml.find('UUID').text, TESTING_HOUSE_UUID)
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:8,代码来源:test_house.py


示例13: test_01_Init

 def test_01_Init(self):
     """ Test that the data structure is correct.
     """
     self.m_pyhouse_obj.House.Entertainment.Plugins[SECTION] = EntertainmentPluginData()
     print(PrettyFormatAny.form(self.m_pyhouse_obj.House.Entertainment.Plugins[SECTION], 'E1-01-D - Section', 180))
     l_base = self.m_pyhouse_obj.House.Entertainment.Plugins[SECTION]
     self.assertIsNone(l_base._API)
     self.assertEqual(l_base.Active, False)
     self.assertEqual(l_base.Count, 0)
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:9,代码来源:test_pandora.py


示例14: test_01_Data

 def test_01_Data(self):
     """ test that the data structure is correct.
     """
     l_base = self.m_pyhouse_obj.House.Entertainment.Plugins[SECTION]
     print(PrettyFormatAny.form(l_base, 'C1-05-B1 - Base'))
     self.assertEqual(l_base.Type, TESTING_PANASONIC_TYPE)
     self.assertEqual(l_base.Name, SECTION)
     self.assertEqual(l_base.Devices[0].Name, TESTING_PANASONIC_DEVICE_NAME_0)
     self.assertEqual(l_base.Devices[1].Name, TESTING_PANASONIC_DEVICE_NAME_1)
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:9,代码来源:test_panasonic.py


示例15: _open_find_device

 def _open_find_device(p_USB_obj):
     """First step in opening a USB device.
     @return:  None if no such device or a pyusb device object
     """
     l_vpn = Utility.format_names(p_USB_obj)
     l_device = None
     try:
         l_device = usb.core.find(idVendor=p_USB_obj.Vendor, idProduct=p_USB_obj.Product)
     except (usb.USBError, ValueError):
         LOG.error("ERROR no such USB device for {}".format(l_vpn))
         return None
     if l_device == None:
         LOG.error('ERROR - USB device not found  {}'.format(l_vpn))
         return None
     LOG.debug(PrettyFormatAny.form(l_device, 'Device'))
     LOG.debug(PrettyFormatAny.form(p_USB_obj, 'pUSB_obj'))
     p_USB_obj.UsbDevice = API._save_find_device(p_USB_obj, l_device)
     LOG.info('Found a device - HID: {}'.format(l_vpn))
     return l_device
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:19,代码来源:USB_open.py


示例16: test_03_Pool1

 def test_03_Pool1(self):
     """ Write one entire pool XML
     """
     l_xml = poolXml._write_one_pool(self.m_pools[1])
     print(PrettyFormatAny.form(l_xml, 'W1-03-A - Pool 1'))
     self.assertEqual(l_xml.attrib['Name'], TESTING_POOL_NAME_1)
     self.assertEqual(l_xml.attrib['Key'], TESTING_POOL_KEY_1)
     self.assertEqual(l_xml.attrib['Active'], TESTING_POOL_ACTIVE_1)
     self.assertEqual(l_xml.find('Comment').text, TESTING_POOL_COMMENT_1)
     self.assertEqual(l_xml.find('PoolType').text, TESTING_POOL_TYPE_1)
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:10,代码来源:test_pool.py


示例17: decode

 def decode(self, p_topic, p_message):
     """ Decode the Mqtt message
     ==> pyhouse/<house name>/hvac/<type>/<Name>/...
     <type> = thermostat, ...
     """
     l_logmsg = '\tHVAC:\n'
     if p_topic[1] == 'Thermostat':
         l_logmsg += '\tThermostat: {}\n'.format(self._get_field(p_message, 'Name'))
     else:
         l_logmsg += '\tUnknown sub-topic {}'.format(PrettyFormatAny.form(p_message, 'Security msg', 160))
     return l_logmsg
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:11,代码来源:hvac.py


示例18: test_02_Line

 def test_02_Line(self):
     """ Test that the data structure is correct.
     """
     l_obj = PandoraStatusData()
     l_res = PianoBarProcessControl(self.m_pyhouse_obj)._extract_nowplaying(l_obj, PLAY_LN)
     print(PrettyFormatAny.form(l_obj, 'F2-02-A - Status', 180))
     self.assertEqual(l_res.Album, 'Greatest Hits')
     self.assertEqual(l_res.Artist, 'Dave Koz')
     self.assertEqual(l_res.Likability, '3')
     self.assertEqual(l_res.Song, 'Love Is On The Way')
     self.assertEqual(l_res.Station, 'Smooth Jazz Radio')
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:11,代码来源:test_pandora.py


示例19: _initilaize_pim

 def _initilaize_pim(p_controller_obj):
     """Initialize a new UPBData object.
     """
     l_pim = UPBData()
     l_pim.InterfaceType = p_controller_obj.InterfaceType
     l_pim.Name = p_controller_obj.Name
     l_pim.UPBAddress = p_controller_obj.UPBAddress
     l_pim.UPBPassword = p_controller_obj.UPBPassword
     l_pim.UPBNetworkID = p_controller_obj.UPBNetworkID
     LOG.info('Initializing UPB PIM named: {}, Type={}'.format(l_pim.Name, l_pim.InterfaceType))
     LOG.debug(PrettyFormatAny.form(l_pim, 'PIM data'))
     return l_pim
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:12,代码来源:UPB_Pim.py


示例20: test_04_AllPools

 def test_04_AllPools(self):
     """ Write Pool Section with all pools.
     """
     l_xml, l_count = poolXml.write_all_pools_xml(self.m_pyhouse_obj)
     print(PrettyFormatAny.form(l_xml, 'W1-04-A - Pool'))
     # l_xml1 = l_xml.find('Pool')
     l_xml2 = l_xml[0]
     self.assertEqual(l_xml2.attrib['Name'], TESTING_POOL_NAME_0)
     self.assertEqual(l_xml2.attrib['Key'], TESTING_POOL_KEY_0)
     self.assertEqual(l_xml2.attrib['Active'], TESTING_POOL_ACTIVE_0)
     self.assertEqual(l_xml2.find('Comment').text, TESTING_POOL_COMMENT_0)
     self.assertEqual(l_xml2.find('PoolType').text, TESTING_POOL_TYPE_0)
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:12,代码来源:test_pool.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python xml_tools.PutGetXML类代码示例发布时间:2022-05-24
下一篇:
Python logging_pyh.getLogger函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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