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

Python xml_tools.PutGetXML类代码示例

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

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



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

示例1: _write_thermostat_data

 def _write_thermostat_data(p_out_xml, p_obj):
     PutGetXML.put_float_element(p_out_xml, 'CoolSetPoint', p_obj.CoolSetPoint)
     PutGetXML.put_float_element(p_out_xml, 'HeatSetPoint', p_obj.HeatSetPoint)
     PutGetXML.put_text_element(p_out_xml, 'ThermostatMode', p_obj.ThermostatMode)
     PutGetXML.put_text_element(p_out_xml, 'ThermostatScale', p_obj.ThermostatScale)
     PutGetXML.put_float_element(p_out_xml, 'CurrentTemperature', p_obj.CurrentTemperature)
     return p_out_xml
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:7,代码来源:hvac_xml.py


示例2: read_location_xml

 def read_location_xml(p_pyhouse_obj):
     """
     @param p_house_xml: is the config file xml for a house.
     """
     l_obj = LocationData()
     l_obj.RiseSet = RiseSetData()
     p_pyhouse_obj.House.Location = l_obj
     try:
         l_xml = p_pyhouse_obj.Xml.XmlRoot.find('HouseDivision')
         if l_xml is None:
             return l_obj
         l_xml = l_xml.find('LocationSection')
         if l_xml is None:
             return l_obj
         l_obj.Street = PutGetXML.get_text_from_xml(l_xml, 'Street', 'Main')
         l_obj.City = PutGetXML.get_text_from_xml(l_xml, 'City', 'Gotham')
         l_obj.State = PutGetXML.get_text_from_xml(l_xml, 'State', 'Confusion')
         l_obj.ZipCode = PutGetXML.get_text_from_xml(l_xml, 'ZipCode', '99999')
         l_obj.Region = PutGetXML.get_text_from_xml(l_xml, 'Region', 'America')
         l_obj.Phone = PutGetXML.get_text_from_xml(l_xml, 'Phone', '800-555-1212')
         l_obj.Latitude = PutGetXML.get_float_from_xml(l_xml, 'Latitude', 40.0)
         l_obj.Longitude = PutGetXML.get_float_from_xml(l_xml, 'Longitude', 100.0)
         l_obj.Elevation = PutGetXML.get_float_from_xml(l_xml, 'Elevation', 10.0)
         l_obj.TimeZoneName = PutGetXML.get_text_from_xml(l_xml, 'TimeZoneName', 'America/New_York')
     except AttributeError as e_err:
         LOG.error('ERROR getting location Data - {}'.format(e_err))
     p_pyhouse_obj.House.Location = l_obj
     LOG.info('Loaded location information.')
     return l_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:29,代码来源:location.py


示例3: write_interface_xml

 def write_interface_xml(p_xml, p_controller_obj):
     try:
         PutGetXML.put_int_element(p_xml, 'PortNumber', p_controller_obj.PortNumber)
         PutGetXML.put_text_element(p_xml, 'Protocol', p_controller_obj.Protocol)
     except Exception:
         pass
     return p_xml
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:7,代码来源:Ethernet_xml.py


示例4: read_internet_xml

 def read_internet_xml(self, p_house_obj, p_house_xml):
     """
     """
     p_house_obj.Internet = InternetData()
     l_sect = p_house_xml.find('Internet')
     try:
         self.m_external_ip = PutGetXML.get_text_from_xml(p_house_xml, 'ExternalIP')
         self.m_external_delay = PutGetXML.get_int_from_xml(l_sect, 'ExternalDelay')
     except AttributeError:
         LOG.error('internet section missing - using defaults.')
         self.m_external_ip = None
         self.m_external_url = None
         self.m_external_delay = 600
     # Design change - one of these two should work
     try:
         self.m_external_url = PutGetXML.get_text_from_xml(l_sect, 'ExternalUrl')
     except:
         self.m_external_url = PutGetXML.get_text_from_xml(l_sect, 'UrlExternalIP')
     p_house_obj.Internet.ExternalIP = self.m_external_ip
     p_house_obj.Internet.ExternalUrl = self.m_external_url
     p_house_obj.Internet.ExternalDelay = self.m_external_delay
     LOG.debug("Got external IP params.  URL:{}, Delay:{}".format(self.m_external_url, self.m_external_delay))
     try:
         l_list = l_sect.iterfind('DynamicDNS')
     except AttributeError:
         l_list = []
     l_count = 0
     for l_entry in l_list:
         l_dyndns = self.extract_dyn_dns(l_entry)
         l_dyndns.Key = l_count  # Renumber
         p_house_obj.Internet.DynDns[l_count] = l_dyndns
         l_count += 1
     LOG.info('Loaded UpdateUrl:{}, Delay:{}'.format(self.m_external_url, self.m_external_delay))
     return p_house_obj.Internet
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:34,代码来源:upnp.py


示例5: write_interface_xml

 def write_interface_xml(p_xml, p_controller_obj):
     try:
         PutGetXML.put_int_element(p_xml, 'Product', p_controller_obj.Product)
         PutGetXML.put_int_element(p_xml, 'Vendor', p_controller_obj.Vendor)
     except Exception:
         pass
     return p_xml
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:7,代码来源:USB_xml.py


示例6: read_pandora_section_xml

    def read_pandora_section_xml(p_pyhouse_obj):
        """
        This has to:
            Fill in an entry in Entertainment Plugins

        @param p_pyhouse_obj: containing an XML Element for the <PandoraSection>
        @return: a EntertainmentPluginData object filled in.
        """
        l_plugin_obj = p_pyhouse_obj.House.Entertainment.Plugins[SECTION]
        l_plugin_obj.Name = SECTION
        l_xml = XmlConfigTools.find_section(p_pyhouse_obj, 'HouseDivision/EntertainmentSection/PandoraSection')
        if l_xml is None:
            return l_plugin_obj
        l_count = 0
        try:
            l_plugin_obj.Active = PutGetXML.get_bool_from_xml(l_xml, 'Active')
            l_plugin_obj.Type = PutGetXML.get_text_from_xml(l_xml, 'Type')
            for l_device_xml in l_xml.iterfind('Device'):
                l_device_obj = XML._read_device(l_device_xml)
                l_device_obj.Key = l_count
                l_plugin_obj.Devices[l_count] = l_device_obj
                LOG.info('Loaded {} Device {}'.format(SECTION, l_plugin_obj.Name))
                l_count += 1
                l_plugin_obj.Count = l_count
        except AttributeError as e_err:
            LOG.error('ERROR if getting {} Device Data - {}'.format(SECTION, e_err))
        p_pyhouse_obj.House.Entertainment.Plugins[SECTION] = l_plugin_obj
        LOG.info('Loaded {} {} Devices.'.format(l_count, SECTION))
        return l_plugin_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:29,代码来源:pandora.py


示例7: _read_one_interface_xml

 def _read_one_interface_xml(p_interface_element):
     l_interface_obj = NodeInterfaceData()
     XmlConfigTools.read_base_UUID_object_xml(l_interface_obj, p_interface_element)
     l_interface_obj.MacAddress = PutGetXML.get_text_from_xml(p_interface_element, 'MacAddress')
     l_interface_obj.V4Address = PutGetXML.get_text_from_xml(p_interface_element, 'IPv4Address')
     l_interface_obj.V6Address = PutGetXML.get_text_from_xml(p_interface_element, 'IPv6Address')
     l_interface_obj.NodeInterfaceType = PutGetXML.get_text_from_xml(p_interface_element, 'InterfaceType')
     return l_interface_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:8,代码来源:nodes_xml.py


示例8: _read_controller_data

 def _read_controller_data(_p_pyhouse_obj, p_obj, p_xml):
     """
     There are extra fields for controllers - get them.
     See ControllerData()
     """
     p_obj.InterfaceType = PutGetXML.get_text_from_xml(p_xml, 'InterfaceType')
     p_obj.Port = PutGetXML.get_text_from_xml(p_xml, 'Port')
     return p_obj  # for testing
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:8,代码来源:lighting_controllers.py


示例9: read_interface_xml

 def read_interface_xml(p_controller_xml):
     l_usb = USBControllerData()
     try:
         l_usb.Product = PutGetXML.get_int_from_xml(p_controller_xml, 'Product')
         l_usb.Vendor = PutGetXML.get_int_from_xml(p_controller_xml, 'Vendor')
     except Exception as e_err:
         LOG.error('Read Interface - {}'.format(e_err))
     return l_usb
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:8,代码来源:USB_xml.py


示例10: _read_one_irrigation_schedule

 def _read_one_irrigation_schedule(p_schedule_element):
     """Extract schedule information from a schedule xml element.
     """
     l_obj = ScheduleIrrigationData()
     l_obj.System = PutGetXML.get_text_from_xml(p_schedule_element, 'System')
     l_obj.SystemUUID = None
     l_obj.Duration = PutGetXML.get_int_from_xml(p_schedule_element, 'Duration')
     return l_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:8,代码来源:schedule_xml.py


示例11: _read_ports

 def _read_ports(p_xml):
     """
     @param p_xml: is the web section
     @return: the Port Number
     """
     l_port = PutGetXML.get_int_from_xml(p_xml, 'WebPort', 8580)
     l_secure = PutGetXML.get_int_from_xml(p_xml, 'SecurePort', 8580)
     l_socket = PutGetXML.get_int_from_xml(p_xml, 'SocketPort', 8580)
     return l_port, l_secure, l_socket
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:9,代码来源:web_xml.py


示例12: extract_dyn_dns

 def extract_dyn_dns(self, p_internet_xml):
     l_dyndns_obj = DynDnsData()
     self.read_base_object_xml(l_dyndns_obj, p_internet_xml)
     l_dyndns_obj.UpdateInterval = PutGetXML.get_int_from_xml(p_internet_xml, 'UpdateInterval')
     l_dyndns_obj.UpdateUrl = PutGetXML.get_text_from_xml(p_internet_xml, 'UpdateUrl')
     if g_debug >= 1:
         LOG.debug("internet.extract_dyn_dns() - Name:{}, UpdateInterval:{}, UpdateUrl:{};".format(
                         l_dyndns_obj.Name, l_dyndns_obj.UpdateInterval, l_dyndns_obj.UpdateUrl))
     return l_dyndns_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:9,代码来源:upnp.py


示例13: read_room_reference_xml

def read_room_reference_xml(p_obj, p_xml):
    """ Since many different XML routines need this - it is factored out here.
    It will use the XML in a configuration file to gather the room information.
    @param p_obj: is the object that will have the room information from the XML added.
    @param p_xml: is the XML that has the room information as sub elements
    """
    p_obj.RoomCoords = PutGetXML.get_coords_from_xml(p_xml, 'RoomCoords')
    p_obj.RoomName = PutGetXML.get_text_from_xml(p_xml, 'RoomName')
    p_obj.RoomUUID = PutGetXML.get_uuid_from_xml(p_xml, 'RoomUUID')
    return p_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:10,代码来源:utils.py


示例14: _read_one_login

 def _read_one_login(p_xml):
     """
     @param p_xml: is the element of one login
     """
     l_obj = LoginData()
     XmlConfigTools.read_base_UUID_object_xml(l_obj, p_xml)
     l_obj.LoginFullName = PutGetXML.get_text_from_xml(p_xml, 'FullName')
     l_obj.LoginPasswordCurrent = PutGetXML.get_text_from_xml(p_xml, 'Password')
     l_obj.LoginRole = PutGetXML.get_text_from_xml(p_xml, 'Role')
     LOG.info('Loaded login "{}"'.format(l_obj.LoginFullName))
     return l_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:11,代码来源:web_xml.py


示例15: _read_thermostat_data

 def _read_thermostat_data(_p_pyhouse_obj, p_obj, p_xml):
     """
     @return: a ThermostatData object.
     """
     p_obj.CoolSetPoint = PutGetXML.get_float_from_xml(p_xml, 'CoolSetPoint', p_default=76.0)
     p_obj.HeatSetPoint = PutGetXML.get_float_from_xml(p_xml, 'HeatSetPoint', 68.0)
     p_obj.ThermostatMode = PutGetXML.get_text_from_xml(p_xml, 'ThermostatMode', 'Cool')
     p_obj.ThermostatScale = PutGetXML.get_text_from_xml(p_xml, 'ThermostatScale', 'F')
     #
     p_obj.CurrentTemperature = PutGetXML.get_float_from_xml(p_xml, 'CurrentTemperature')
     return p_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:11,代码来源:hvac_xml.py


示例16: _write_one_system

 def _write_one_system(p_obj):
     """
     @param p_obj: is one irrigation system object.
     @return: the XML for one complete IrrigationSystem
     """
     l_xml = XmlConfigTools.write_base_UUID_object_xml('IrrigationSystem', p_obj)
     PutGetXML.put_text_element(l_xml, 'Comment', p_obj.Comment)
     for l_obj in p_obj.Zones.values():
         l_zone = Xml._write_one_zone(l_obj)
         l_xml.append(l_zone)
     return l_xml
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:11,代码来源:irrigation_xml.py


示例17: ReadXml

 def ReadXml(p_device_obj, p_in_xml):
     """
     @param p_in_xml: is the e-tree XML house object
     @param p_house: is the text name of the House.
     @return: a dict of the entry to be attached to a house object.
     """
     l_obj = UPBData()
     l_obj.UPBAddress = PutGetXML.get_int_from_xml(p_in_xml, 'UPBAddress', 255)
     l_obj.UPBNetworkID = PutGetXML.get_int_from_xml(p_in_xml, 'UPBNetworkID')
     l_obj.UPBPassword = PutGetXML.get_int_from_xml(p_in_xml, 'UPBPassword')
     stuff_new_attrs(p_device_obj, l_obj)
     return l_obj  # for testing
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:12,代码来源:UPB_xml.py


示例18: _write_one_interface_xml

 def _write_one_interface_xml(p_interface_obj):
     l_entry = XmlConfigTools.write_base_UUID_object_xml('Interface', p_interface_obj)
     PutGetXML.put_text_element(l_entry, 'MacAddress', p_interface_obj.MacAddress)
     PutGetXML.put_text_element(l_entry, 'IPv4Address', p_interface_obj.V4Address)
     PutGetXML.put_text_element(l_entry, 'IPv6Address', p_interface_obj.V6Address)
     PutGetXML.put_text_element(l_entry, 'InterfaceType', p_interface_obj.NodeInterfaceType)
     return l_entry
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:7,代码来源:nodes_xml.py


示例19: _read_one_base_schedule

    def _read_one_base_schedule(p_schedule_element):
        """Extract schedule information from a Base schedule xml element.

        ScheduleBaseData()
        """
        l_obj = ScheduleBaseData()
        XmlConfigTools.read_base_UUID_object_xml(l_obj, p_schedule_element)
        l_obj.DOW = PutGetXML.get_int_from_xml(p_schedule_element, 'DayOfWeek', '127')
        l_obj.ScheduleMode = PutGetXML.get_text_from_xml(p_schedule_element, 'ScheduleMode', 'Default Mode')
        l_obj.ScheduleType = PutGetXML.get_text_from_xml(p_schedule_element, 'ScheduleType')
        l_obj.Time = PutGetXML.get_text_from_xml(p_schedule_element, 'Time')
        # if l_obj.ScheduleType == 'LightingDevice':
        #    l_obj.ScheduleType = 'Lighting'
        return l_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:14,代码来源:schedule_xml.py


示例20: _write_one_node_xml

 def _write_one_node_xml(p_node_obj):
     l_entry = XmlConfigTools.write_base_UUID_object_xml(NODE_ATTR, p_node_obj)
     PutGetXML.put_text_element(l_entry, 'ConnectionAddressV4', p_node_obj.ConnectionAddr_IPv4)
     PutGetXML.put_text_element(l_entry, 'ConnectionAddressV6', p_node_obj.ConnectionAddr_IPv6)
     PutGetXML.put_int_element(l_entry, 'NodeRole', p_node_obj.NodeRole)
     PutGetXML.put_date_time_element(l_entry, 'LastUpdate', p_node_obj.LastUpdate)
     l_entry.append(Xml._write_interfaces_xml(p_node_obj.NodeInterfaces))
     return l_entry
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:8,代码来源:nodes_xml.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python commonBits.sampleDir函数代码示例发布时间:2022-05-24
下一篇:
Python debug_tools.PrettyFormatAny类代码示例发布时间: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