Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
('union', Unicode),
]
class Attribute(SchemaBase):
use = XmlAttribute(Unicode)
ref = XmlAttribute(Unicode)
name = XmlAttribute(Unicode)
type = XmlAttribute(Unicode)
default = XmlAttribute(Unicode)
simple_type = SimpleType.customize(sub_name='simpleType')
class Restriction(SchemaBase):
_type_info = [
('base', XmlAttribute(Unicode)),
('max_length', IntegerAttribute.customize(sub_name="maxLength")),
('min_length', IntegerAttribute.customize(sub_name="minLength")),
('pattern', StringAttribute),
('enumeration', StringAttribute.customize(max_occurs="unbounded")),
('attributes', Attribute.customize(max_occurs="unbounded",
sub_name="attribute")),
]
SimpleType.append_field('restriction', Restriction)
class Choice(SchemaBase):
elements = Element.customize(max_occurs="unbounded", sub_name="element")
class Sequence(SchemaBase):
__namespace__ = xml.NS_XSD
class Import(SchemaBase):
namespace = XmlAttribute(Unicode)
class Element(SchemaBase):
name = XmlAttribute(Unicode)
type = XmlAttribute(Unicode)
ref = XmlAttribute(Unicode)
# it can be "unbounded", so it should be of type Unicode
max_occurs = XmlAttribute(Unicode(default="1", sub_name="maxOccurs"))
# Also Unicode for consistency with max_occurs
min_occurs = XmlAttribute(Unicode(default="1", sub_name="minOccurs"))
nillable = XmlAttribute(Boolean(default=False))
default = XmlAttribute(Unicode)
class IntegerAttribute(SchemaBase):
value = XmlAttribute(UnsignedInteger)
class StringAttribute(SchemaBase):
value = XmlAttribute(Unicode)
class List(SchemaBase):
_type_info = [
('item_type', XmlAttribute(Unicode(sub_name='itemType'))),
]
type = XmlAttribute(Unicode)
ref = XmlAttribute(Unicode)
# it can be "unbounded", so it should be of type Unicode
max_occurs = XmlAttribute(Unicode(default="1", sub_name="maxOccurs"))
# Also Unicode for consistency with max_occurs
min_occurs = XmlAttribute(Unicode(default="1", sub_name="minOccurs"))
nillable = XmlAttribute(Boolean(default=False))
default = XmlAttribute(Unicode)
class IntegerAttribute(SchemaBase):
value = XmlAttribute(UnsignedInteger)
class StringAttribute(SchemaBase):
value = XmlAttribute(Unicode)
class List(SchemaBase):
_type_info = [
('item_type', XmlAttribute(Unicode(sub_name='itemType'))),
]
class SimpleType(SchemaBase):
_type_info = [
('name', XmlAttribute(Unicode)),
('list', List),
('union', Unicode),
]
a = String
b = Integer
c = Decimal
d = DateTime
class Foo(ComplexModel):
__namespace__ = 'some_other_namespace'
a = String
b = Integer
c = Decimal
d = DateTime
e = XmlAttribute(Integer)
f = XmlAttribute(Unicode, attribute_of='d')
class ProductEdition(ComplexModel):
__namespace__ = 'kickass_namespace'
id = XmlAttribute(Uuid)
name = XmlData(Unicode)
class Product(ComplexModel):
__namespace__ = 'kickass_namespace'
id = XmlAttribute(Uuid)
edition = ProductEdition
class SoapBinding(Soap11Base):
style = XmlAttribute(Unicode)
transport = XmlAttribute(Unicode)
class Binding(Wsdl11Base):
name = XmlAttribute(Unicode)
type = XmlAttribute(Unicode)
location = XmlAttribute(Unicode)
soap_binding = SoapBinding.customize(sub_ns=xml.NS_WSDL11_SOAP,
sub_name="binding")
class PortAddress(Soap11Base):
location = XmlAttribute(Unicode)
class ServicePort(Wsdl11Base):
name = XmlAttribute(Unicode)
binding = XmlAttribute(Unicode)
address = PortAddress.customize(sub_ns=xml.NS_WSDL11_SOAP)
class Service(Wsdl11Base):
port = ServicePort
name = XmlAttribute(Unicode)
class Wsdl11(Wsdl11Base):
_type_info = [
('types', Types),
def __init__(self, cls_name, cls_bases, cls_dict):
type_info = cls_dict['_type_info']
for k,v in type_info.items():
if issubclass(v, SelfReference):
type_info[k] = self
if issubclass(v, XmlAttribute):
a_of = v.attribute_of
if a_of is not None:
type_info.attributes[k] = type_info[a_of]
if issubclass(v, Array):
v2, = v._type_info.values()
while issubclass(v2, Array):
v = v2
v2, = v2._type_info.values()
if issubclass(v2, SelfReference):
v._set_serializer(self)
tn = self.Attributes.table_name
meta = self.Attributes.sqla_metadata
t = self.Attributes.sqla_table
class Types(Wsdl11Base):
schema = XmlSchema10.customize(max_occurs="unbounded")
class MessagePart(Wsdl11Base):
element = XmlAttribute(Unicode)
name = XmlAttribute(Unicode)
class Message(Wsdl11Base):
part = MessagePart
name = XmlAttribute(Unicode)
class SoapBodyDefinition(Wsdl11Base):
use = XmlAttribute(Unicode)
class SoapHeaderDefinition(Wsdl11Base):
use = XmlAttribute(Unicode)
message = XmlAttribute(Unicode)
part = XmlAttribute(Unicode)
class OperationMode(Wsdl11Base):
name = XmlAttribute(Unicode)
message = XmlAttribute(Unicode)
soap_body = SoapBodyDefinition.customize(sub_ns=xml.NS_WSDL11_SOAP,
sub_name="body")
soap_header = SoapHeaderDefinition.customize(sub_ns=xml.NS_WSDL11_SOAP,
sub_name="header")
class SimpleType(SchemaBase):
_type_info = [
('name', XmlAttribute(Unicode)),
('list', List),
('union', Unicode),
]
class Attribute(SchemaBase):
use = XmlAttribute(Unicode)
ref = XmlAttribute(Unicode)
name = XmlAttribute(Unicode)
type = XmlAttribute(Unicode)
default = XmlAttribute(Unicode)
simple_type = SimpleType.customize(sub_name='simpleType')
class Restriction(SchemaBase):
_type_info = [
('base', XmlAttribute(Unicode)),
('max_length', IntegerAttribute.customize(sub_name="maxLength")),
('min_length', IntegerAttribute.customize(sub_name="minLength")),
('pattern', StringAttribute),
('enumeration', StringAttribute.customize(max_occurs="unbounded")),
('attributes', Attribute.customize(max_occurs="unbounded",
sub_name="attribute")),
]
SimpleType.append_field('restriction', Restriction)
sub_name="body")
soap_header = SoapHeaderDefinition.customize(sub_ns=xml.NS_WSDL11_SOAP,
sub_name="header")
class SoapOperation(Wsdl11Base):
soapAction = XmlAttribute(Unicode)
style = XmlAttribute(Unicode)
class Operation(Wsdl11Base):
input = OperationMode
output = OperationMode
soap_operation = SoapOperation.customize(sub_ns=xml.NS_WSDL11_SOAP,
sub_name="operation")
parameterOrder = XmlAttribute(Unicode)
class PortType(Wsdl11Base):
name = XmlAttribute(Unicode)
operation = Operation.customize(max_occurs="unbounded")
class SoapBinding(Soap11Base):
style = XmlAttribute(Unicode)
transport = XmlAttribute(Unicode)
class Binding(Wsdl11Base):
name = XmlAttribute(Unicode)
type = XmlAttribute(Unicode)
location = XmlAttribute(Unicode)
soap_binding = SoapBinding.customize(sub_ns=xml.NS_WSDL11_SOAP,
sub_name="operation")
parameterOrder = XmlAttribute(Unicode)
class PortType(Wsdl11Base):
name = XmlAttribute(Unicode)
operation = Operation.customize(max_occurs="unbounded")
class SoapBinding(Soap11Base):
style = XmlAttribute(Unicode)
transport = XmlAttribute(Unicode)
class Binding(Wsdl11Base):
name = XmlAttribute(Unicode)
type = XmlAttribute(Unicode)
location = XmlAttribute(Unicode)
soap_binding = SoapBinding.customize(sub_ns=xml.NS_WSDL11_SOAP,
sub_name="binding")
class PortAddress(Soap11Base):
location = XmlAttribute(Unicode)
class ServicePort(Wsdl11Base):
name = XmlAttribute(Unicode)
binding = XmlAttribute(Unicode)
address = PortAddress.customize(sub_ns=xml.NS_WSDL11_SOAP)
class Service(Wsdl11Base):