本文整理汇总了Python中Modules.Core.Utilities.xml_tools.PutGetXML类的典型用法代码示例。如果您正苦于以下问题:Python PutGetXML类的具体用法?Python PutGetXML怎么用?Python PutGetXML使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PutGetXML类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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