本文整理汇总了Python中Modules.Core.Utilities.xml_tools.PutGetXML.get_float_from_xml方法的典型用法代码示例。如果您正苦于以下问题:Python PutGetXML.get_float_from_xml方法的具体用法?Python PutGetXML.get_float_from_xml怎么用?Python PutGetXML.get_float_from_xml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Modules.Core.Utilities.xml_tools.PutGetXML
的用法示例。
在下文中一共展示了PutGetXML.get_float_from_xml方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: read_location_xml
# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_float_from_xml [as 别名]
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
示例2: _read_thermostat_data
# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_float_from_xml [as 别名]
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
示例3: read_interface_xml
# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_float_from_xml [as 别名]
def read_interface_xml(p_controller_entry):
l_serial = SerialControllerData()
l_serial.BaudRate = PutGetXML.get_int_from_xml(p_controller_entry, 'BaudRate', 19200)
l_serial.ByteSize = PutGetXML.get_int_from_xml(p_controller_entry, 'ByteSize', 8)
l_serial.DsrDtr = PutGetXML.get_bool_from_xml(p_controller_entry, 'DsrDtr', False)
l_serial.Parity = PutGetXML.get_text_from_xml(p_controller_entry, 'Parity', 'N')
l_serial.RtsCts = PutGetXML.get_bool_from_xml(p_controller_entry, 'RtsCts', False)
l_serial.StopBits = PutGetXML.get_float_from_xml(p_controller_entry, 'StopBits', 1.0)
l_serial.Timeout = PutGetXML.get_float_from_xml(p_controller_entry, 'Timeout', 1.0)
l_serial.XonXoff = PutGetXML.get_bool_from_xml(p_controller_entry, 'XonXoff', False)
return l_serial
示例4: _read_one_zone
# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_float_from_xml [as 别名]
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) # Name, Key, Active
l_obj.Comment = PutGetXML.get_text_from_xml(p_xml, 'Comment')
l_obj.Duration = PutGetXML.get_time_from_xml(p_xml, 'Duration')
l_obj.EmitterCount = PutGetXML.get_int_from_xml(p_xml, 'EmitterCount', 0)
l_obj.EmitterType = PutGetXML.get_text_from_xml(p_xml, 'EmitterType')
l_obj.Next = PutGetXML.get_int_from_xml(p_xml, 'NextZone', 0)
l_obj.Previous = PutGetXML.get_int_from_xml(p_xml, 'PrevZone', 0)
l_obj.Rate = PutGetXML.get_float_from_xml(p_xml, 'Rate', 0.0)
l_obj.StartTime = PutGetXML.get_time_from_xml(p_xml, 'StartTime')
# Expand with much more control data
return l_obj