本文整理汇总了Python中Modules.Utilities.xml_tools.PutGetXML.get_int_from_xml方法的典型用法代码示例。如果您正苦于以下问题:Python PutGetXML.get_int_from_xml方法的具体用法?Python PutGetXML.get_int_from_xml怎么用?Python PutGetXML.get_int_from_xml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Modules.Utilities.xml_tools.PutGetXML
的用法示例。
在下文中一共展示了PutGetXML.get_int_from_xml方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: read_interface_xml
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_int_from_xml [as 别名]
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
示例2: _read_one_lighting_schedule
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_int_from_xml [as 别名]
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
示例3: _read_device_latest
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_int_from_xml [as 别名]
def _read_device_latest(p_device_obj, p_entry_xml):
"""
"""
p_device_obj.Comment = PutGetXML.get_text_from_xml(p_entry_xml, 'Comment')
p_device_obj.DeviceFamily = PutGetXML.get_text_from_xml(p_entry_xml, 'DeviceFamily')
p_device_obj.DeviceType = PutGetXML.get_int_from_xml(p_entry_xml, 'DeviceType')
p_device_obj.DeviceSubType = PutGetXML.get_int_from_xml(p_entry_xml, 'DeviceSubType')
p_device_obj.LightingType = PutGetXML.get_text_from_xml(p_entry_xml, 'LightingType')
p_device_obj.RoomCoords = PutGetXML.get_coords_from_xml(p_entry_xml, 'RoomCoords')
p_device_obj.RoomName = PutGetXML.get_text_from_xml(p_entry_xml, 'RoomName')
return p_device_obj
示例4: ReadXml
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_int_from_xml [as 别名]
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
示例5: _read_insteon
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_int_from_xml [as 别名]
def _read_insteon(p_in_xml):
l_insteon_obj = InsteonData()
try:
l_insteon_obj.InsteonAddress = conversions.dotted_hex2int(PutGetXML.get_text_from_xml(p_in_xml, 'InsteonAddress', '99.88.77'))
except AttributeError:
l_insteon_obj.InsteonAddress = conversions.dotted_hex2int(PutGetXML.get_text_from_xml(p_in_xml, 'Address', '99.88.77'))
try:
l_insteon_obj.DevCat = conversions.dotted_hex2int(PutGetXML.get_text_from_xml(p_in_xml, 'DevCat', 'A1.B2'))
l_insteon_obj.GroupList = PutGetXML.get_text_from_xml(p_in_xml, 'GroupList')
l_insteon_obj.GroupNumber = PutGetXML.get_int_from_xml(p_in_xml, 'GroupNumber', 0)
l_insteon_obj.ProductKey = Xml._read_product_key(p_in_xml)
l_insteon_obj.Version = PutGetXML.get_int_from_xml(p_in_xml, 'Version', 1)
except Exception as e_err:
LOG.error('ERROR: {}'.format(e_err))
return l_insteon_obj
示例6: read_internet_xml
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_int_from_xml [as 别名]
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
示例7: _read_port
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_int_from_xml [as 别名]
def _read_port(p_xml):
"""
@param p_xml: is the web section
@return: the Port Number
"""
l_port = PutGetXML.get_int_from_xml(p_xml, 'WebPort', 8580)
return l_port
示例8: extract_dyn_dns
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_int_from_xml [as 别名]
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
示例9: _read_one_base_schedule
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_int_from_xml [as 别名]
def _read_one_base_schedule(p_schedule_element):
"""Extract schedule information from a schedule xml element.
"""
l_obj = ScheduleBaseData()
XmlConfigTools.read_base_object_xml(l_obj, p_schedule_element)
l_obj.Time = PutGetXML.get_text_from_xml(p_schedule_element, 'Time')
l_obj.ScheduleType = PutGetXML.get_text_from_xml(p_schedule_element, 'ScheduleType')
if l_obj.ScheduleType == 'LightingDevice':
l_obj.ScheduleType = 'Lighting'
try:
l_obj.DOW = PutGetXML.get_int_from_xml(l_obj, 'DayOfWeek', 0x7F)
except:
l_obj.DOW = 0x7F
try:
l_obj.Mode = PutGetXML.get_int_from_xml(l_obj, 'Mode', 0)
except:
l_obj.Mode = 0
return l_obj
示例10: _read_one_zone
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_int_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)
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
示例11: read_base_device_object_xml
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_int_from_xml [as 别名]
def read_base_device_object_xml(p_obj, p_xml):
"""
Get the BaseObject entries from the XML element.
@param p_obj: is the object we wish to populate with data
@param p_xml: is the element we will extract data from (including children).
"""
try:
p_obj.Name = PutGetXML.get_text_from_xml(p_xml, "Name", "Missing Name")
p_obj.Key = PutGetXML.get_int_from_xml(p_xml, "Key", 0)
p_obj.Active = PutGetXML.get_bool_from_xml(p_xml, "Active", False)
p_obj.Comment = PutGetXML.get_text_from_xml(p_xml, "Comment")
p_obj.DeviceFamily = PutGetXML.get_text_from_xml(p_xml, "DeviceFamily")
p_obj.DeviceType = PutGetXML.get_int_from_xml(p_xml, "DeviceType")
p_obj.DeviceSubType = PutGetXML.get_int_from_xml(p_xml, "DeviceSubType")
p_obj.RoomCoords = PutGetXML.get_coords_from_xml(p_xml, "RoomCoords")
p_obj.RoomName = PutGetXML.get_text_from_xml(p_xml, "RoomName")
p_obj.UUID = PutGetXML.get_uuid_from_xml(p_xml, "UUID")
except Exception as e_err:
LOG.warn("ERROR in xml_tools.read_base_obj_xml() - {}".format(e_err))
print(e_err)
return p_obj
示例12: _read_one_node_xml
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_int_from_xml [as 别名]
def _read_one_node_xml(p_node_xml):
"""
Read the existing XML file (if it exists) and get the node info.
"""
l_node_obj = NodeData()
XmlConfigTools.read_base_object_xml(l_node_obj, p_node_xml)
l_node_obj.ConnectionAddr_IPv4 = PutGetXML.get_text_from_xml(p_node_xml, 'ConnectionAddressV4')
l_node_obj.ConnectionAddr_IPv6 = PutGetXML.get_text_from_xml(p_node_xml, 'ConnectionAddressV6')
l_node_obj.NodeRole = PutGetXML.get_int_from_xml(p_node_xml, 'NodeRole')
try:
l_node_obj.NodeInterfaces = Xml._read_interfaces_xml(p_node_xml.find('InterfaceSection'))
except AttributeError as e_err:
LOG.error('ERROR OneNodeRead error {}'.format(e_err))
return l_node_obj
示例13: _read_one_broker
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_int_from_xml [as 别名]
def _read_one_broker(p_xml):
"""
@param p_xml: XML information for one Broker.
@return: an IrrigationZone object filled in with data from the XML passed in
"""
l_obj = MqttBrokerData()
try:
XmlConfigTools.read_base_object_xml(l_obj, p_xml)
l_obj.BrokerAddress = PutGetXML.get_text_from_xml(p_xml, 'BrokerAddress')
l_obj.BrokerPort = PutGetXML.get_int_from_xml(p_xml, 'BrokerPort')
l_obj.UserName = PutGetXML.get_text_from_xml(p_xml, 'BrokerUser')
l_obj.Password = PutGetXML.get_text_from_xml(p_xml, 'BrokerPassword')
except Exception:
pass
return l_obj
示例14: _read_light_data
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_int_from_xml [as 别名]
def _read_light_data(p_obj, p_xml, p_version):
p_obj.CurLevel = PutGetXML.get_int_from_xml(p_xml, 'CurLevel', 0)
p_obj.IsDimmable = PutGetXML.get_bool_from_xml(p_xml, 'IsDimmable', False)
return p_obj # for testing