Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def gds_parse_date(self, input_data, node, input_name=''):
tz = None
if input_data[-1] == 'Z':
tz = GeneratedsSuper._FixedOffsetTZ(0, 'GMT')
input_data = input_data[:-1]
else:
results = GeneratedsSuper.tzoff_pattern.search(input_data)
if results is not None:
tzoff_parts = results.group(2).split(':')
tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1])
if results.group(1) == '-':
tzoff *= -1
tz = GeneratedsSuper._FixedOffsetTZ(
tzoff, results.group(0))
input_data = input_data[:-6]
return datetime.strptime(input_data,
'%Y-%m-%d').replace(tzinfo = tz)
def gds_str_lower(self, instring):
def gds_parse_date(self, input_data, node, input_name=''):
tz = None
if input_data[-1] == 'Z':
tz = GeneratedsSuper._FixedOffsetTZ(0, 'GMT')
input_data = input_data[:-1]
else:
results = GeneratedsSuper.tzoff_pattern.search(input_data)
if results is not None:
tzoff_parts = results.group(2).split(':')
tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1])
if results.group(1) == '-':
tzoff *= -1
tz = GeneratedsSuper._FixedOffsetTZ(
tzoff, results.group(0))
input_data = input_data[:-6]
return datetime.strptime(input_data,
'%Y-%m-%d').replace(tzinfo = tz)
def gds_str_lower(self, instring):
return 'xs:string'
else:
return self.data_type
def set_container(self, container): self.container = container
def get_container(self): return self.container
def _cast(typ, value):
if typ is None or value is None:
return value
return typ(value)
#
# Data representation classes.
#
class root(GeneratedsSuper):
subclass = None
superclass = None
def __init__(self, specVersion=None, URLBase=None, device=None):
self.specVersion = specVersion
self.URLBase = URLBase
self.device = device
self.anyAttributes_ = {}
def factory(*args_, **kwargs_):
if root.subclass:
return root.subclass(*args_, **kwargs_)
else:
return root(*args_, **kwargs_)
factory = staticmethod(factory)
def get_specVersion(self): return self.specVersion
def set_specVersion(self, specVersion): self.specVersion = specVersion
def get_URLBase(self): return self.URLBase
def build(self, node):
self.buildAttributes(node, node.attrib, [])
for child in node:
nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
self.buildChildren(child, node, nodeName_)
def buildAttributes(self, node, attrs, already_processed):
pass
def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
if nodeName_ == 'icon':
obj_ = iconType.factory()
obj_.build(child_)
self.icon.append(obj_)
# end class IconListType
class ServiceListType(GeneratedsSuper):
subclass = None
superclass = None
def __init__(self, service=None):
if service is None:
self.service = []
else:
self.service = service
def factory(*args_, **kwargs_):
if ServiceListType.subclass:
return ServiceListType.subclass(*args_, **kwargs_)
else:
return ServiceListType(*args_, **kwargs_)
factory = staticmethod(factory)
def get_service(self): return self.service
def set_service(self, service): self.service = service
def add_service(self, value): self.service.append(value)
elif nodeName_ == 'depth':
sval_ = child_.text
try:
ival_ = int(sval_)
except (TypeError, ValueError) as exp:
raise_parse_error(child_, 'requires integer: %s' % exp)
ival_ = self.gds_validate_integer(ival_, node, 'depth')
self.depth = ival_
elif nodeName_ == 'url':
url_ = child_.text
url_ = self.gds_validate_string(url_, node, 'url')
self.url = url_
# end class iconType
class serviceType(GeneratedsSuper):
subclass = None
superclass = None
def __init__(self, serviceType=None, serviceId=None, SCPDURL=None, controlURL=None, eventSubURL=None):
self.serviceType = serviceType
self.serviceId = serviceId
self.SCPDURL = SCPDURL
self.controlURL = controlURL
self.eventSubURL = eventSubURL
def factory(*args_, **kwargs_):
if serviceType.subclass:
return serviceType.subclass(*args_, **kwargs_)
else:
return serviceType(*args_, **kwargs_)
factory = staticmethod(factory)
def get_serviceType(self): return self.serviceType
def set_serviceType(self, serviceType): self.serviceType = serviceType
def get_path_list_(self, node, path_list):
if node is None:
return
tag = GeneratedsSuper.Tag_strip_pattern_.sub('', node.tag)
if tag:
path_list.append(tag)
self.get_path_list_(node.getparent(), path_list)
def get_class_obj_(self, node, default_class=None):
if nodeName_ == 'specVersion':
obj_ = SpecVersionType.factory()
obj_.build(child_)
self.set_specVersion(obj_)
elif nodeName_ == 'URLBase':
URLBase_ = child_.text
URLBase_ = self.gds_validate_string(URLBase_, node, 'URLBase')
self.URLBase = URLBase_
elif nodeName_ == 'device':
obj_ = DeviceType.factory()
obj_.build(child_)
self.set_device(obj_)
# end class root
class SpecVersionType(GeneratedsSuper):
subclass = None
superclass = None
def __init__(self, major=None, minor=None):
self.major = major
self.minor = minor
def factory(*args_, **kwargs_):
if SpecVersionType.subclass:
return SpecVersionType.subclass(*args_, **kwargs_)
else:
return SpecVersionType(*args_, **kwargs_)
factory = staticmethod(factory)
def get_major(self): return self.major
def set_major(self, major): self.major = major
def get_minor(self): return self.minor
def set_minor(self, minor): self.minor = minor
def export(self, outfile, level, namespace_='tns:', name_='SpecVersionType', namespacedef_='', pretty_print=True):
def build(self, node):
self.buildAttributes(node, node.attrib, [])
for child in node:
nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
self.buildChildren(child, node, nodeName_)
def buildAttributes(self, node, attrs, already_processed):
pass
def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
if nodeName_ == 'service':
obj_ = serviceType.factory()
obj_.build(child_)
self.service.append(obj_)
# end class ServiceListType
class DeviceListType(GeneratedsSuper):
subclass = None
superclass = None
def __init__(self, device=None):
if device is None:
self.device = []
else:
self.device = device
def factory(*args_, **kwargs_):
if DeviceListType.subclass:
return DeviceListType.subclass(*args_, **kwargs_)
else:
return DeviceListType(*args_, **kwargs_)
factory = staticmethod(factory)
def get_device(self): return self.device
def set_device(self, device): self.device = device
def add_device(self, value): self.device.append(value)
elif nodeName_ == 'deviceList':
obj_ = DeviceListType.factory()
obj_.build(child_)
self.set_deviceList(obj_)
elif nodeName_ == 'presentationURL':
presentationURL_ = child_.text
presentationURL_ = self.gds_validate_string(presentationURL_, node, 'presentationURL')
self.presentationURL = presentationURL_
else:
obj_ = self.gds_build_any(child_, 'DeviceType')
if obj_ is not None:
self.add_anytypeobjs_(obj_)
# end class DeviceType
class IconListType(GeneratedsSuper):
subclass = None
superclass = None
def __init__(self, icon=None):
if icon is None:
self.icon = []
else:
self.icon = icon
def factory(*args_, **kwargs_):
if IconListType.subclass:
return IconListType.subclass(*args_, **kwargs_)
else:
return IconListType(*args_, **kwargs_)
factory = staticmethod(factory)
def get_icon(self): return self.icon
def set_icon(self, icon): self.icon = icon
def add_icon(self, value): self.icon.append(value)
def build(self, node):
self.buildAttributes(node, node.attrib, [])
for child in node:
nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
self.buildChildren(child, node, nodeName_)
def buildAttributes(self, node, attrs, already_processed):
pass
def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
if nodeName_ == 'device':
obj_ = DeviceType.factory()
obj_.build(child_)
self.device.append(obj_)
# end class DeviceListType
class iconType(GeneratedsSuper):
subclass = None
superclass = None
def __init__(self, mimetype=None, width=None, height=None, depth=None, url=None):
self.mimetype = mimetype
self.width = width
self.height = height
self.depth = depth
self.url = url
def factory(*args_, **kwargs_):
if iconType.subclass:
return iconType.subclass(*args_, **kwargs_)
else:
return iconType(*args_, **kwargs_)
factory = staticmethod(factory)
def get_mimetype(self): return self.mimetype
def set_mimetype(self, mimetype): self.mimetype = mimetype