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


Python xml_tools.PutGetXML类代码示例

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


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

示例1: 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:{0:}, Delay:{1:}".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:{0:}, Delay:{1:}'.format(self.m_external_url, self.m_external_delay))
     return p_house_obj.Internet
开发者ID:,项目名称:,代码行数:34,代码来源:

示例2: _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:,项目名称:,代码行数:7,代码来源:

示例3: 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:,项目名称:,代码行数:7,代码来源:

示例4: _read_one_interface_xml

 def _read_one_interface_xml(p_interface_element):
     l_interface_obj = NodeInterfaceData()
     XmlConfigTools.read_base_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')
     return l_interface_obj
开发者ID:,项目名称:,代码行数:7,代码来源:

示例5: 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 - {0:}'.format(e_err))
     return l_usb
开发者ID:,项目名称:,代码行数:8,代码来源:

示例6: read_one_room

 def read_one_room(p_room_element):
     l_room_obj = RoomData()
     XmlConfigTools.read_base_object_xml(l_room_obj, p_room_element)
     l_room_obj.Comment = PutGetXML.get_text_from_xml(p_room_element, 'Comment')
     l_room_obj.Corner = PutGetXML.get_text_from_xml(p_room_element, 'Corner')
     l_room_obj.Floor = PutGetXML.get_text_from_xml(p_room_element, 'Floor', '1')
     l_room_obj.Size = PutGetXML.get_text_from_xml(p_room_element, 'Size')
     return l_room_obj
开发者ID:,项目名称:,代码行数:8,代码来源:

示例7: _read_controller_data

 def _read_controller_data(p_obj, p_xml, p_version):
     """
     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:,项目名称:,代码行数:8,代码来源:

示例8: 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:{0:}, UpdateInterval:{1:}, UpdateUrl:{2:};".format(
                         l_dyndns_obj.Name, l_dyndns_obj.UpdateInterval, l_dyndns_obj.UpdateUrl))
     return l_dyndns_obj
开发者ID:,项目名称:,代码行数:9,代码来源:

示例9: _read_derived

 def _read_derived(p_internet_sect_xml):
     l_icd = InternetConnectionData()
     try:
         l_icd.ExternalIPv4 = PutGetXML.get_ip_from_xml(p_internet_sect_xml, 'ExternalIPv4')
         l_icd.ExternalIPv6 = PutGetXML.get_ip_from_xml(p_internet_sect_xml, 'ExternalIPv6')
         l_icd.LastChanged = PutGetXML.get_date_time_from_xml(p_internet_sect_xml, 'LastChanged')
     except:
         pass
     return l_icd
开发者ID:,项目名称:,代码行数:9,代码来源:

示例10: _write_one_zone

 def _write_one_zone(p_obj):
     """
     @param p_obj: is one zone object
     @return the XML for one Zone
     """
     l_xml = XmlConfigTools.write_base_object_xml('Zone', p_obj)
     PutGetXML.put_text_element(l_xml, 'Comment', p_obj.Comment)
     PutGetXML.put_int_element(l_xml, 'Duration', p_obj.Duration)
     return l_xml
开发者ID:,项目名称:,代码行数:9,代码来源:

示例11: _read_one_lighting_schedule

 def _read_one_lighting_schedule(p_schedule_element):
     """Extract schedule information from a schedule xml element.
     """
     l_obj = ScheduleLightData()
     l_obj.Level = PutGetXML.get_int_from_xml(p_schedule_element, 'Level')
     l_obj.LightName = PutGetXML.get_text_from_xml(p_schedule_element, 'LightName')
     l_obj.Rate = PutGetXML.get_int_from_xml(p_schedule_element, 'Rate')
     l_obj.RoomName = PutGetXML.get_text_from_xml(p_schedule_element, 'RoomName')
     return l_obj  # for testing
开发者ID:,项目名称:,代码行数:9,代码来源:

示例12: _read_one_login

 def _read_one_login(p_xml):
     """
     @param p_xml: is the element of one login
     """
     l_obj = LoginData()
     XmlConfigTools.read_base_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')
     return l_obj
开发者ID:,项目名称:,代码行数:10,代码来源:

示例13: _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_object_xml('IrrigationSystem', p_obj)
     PutGetXML.put_text_element(l_xml, 'Comment', p_obj.Comment)
     for l_obj in p_obj.Zones.itervalues():
         l_zone = Xml._write_one_zone(l_obj)
         l_xml.append(l_zone)
     return l_xml
开发者ID:,项目名称:,代码行数:11,代码来源:

示例14: _read_thermostat_data

 def _read_thermostat_data(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:,项目名称:,代码行数:11,代码来源:

示例15: _read_one_zone

 def _read_one_zone(p_xml):
     """
     @param p_xml: XML information for one Zone.
     @return: an IrrigationZone object filled in with data from the XML passed in
     """
     l_obj = IrrigationZoneData()
     XmlConfigTools.read_base_object_xml(l_obj, p_xml)
     l_obj.Comment = PutGetXML.get_text_from_xml(p_xml, 'Comment')
     l_obj.Duration = PutGetXML.get_int_from_xml(p_xml, 'Duration', 0)
     # Expand with much more control data
     return l_obj
开发者ID:,项目名称:,代码行数:11,代码来源:


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