当前位置: 首页>>代码示例>>Python>>正文


Python debug_tools.PrettyFormatAny类代码示例

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


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


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