def setUp(self, tp):
self._item = tp<EOL>assert tp.content.isComplex() is True and(tp.content.content.isRestriction() or tp.content.content.isExtension() is True),'<STR_LIT>'<EOL>self.extType = None<EOL>self.restriction = False<EOL>self.extension = False<EOL>self._kw_array = None<EOL>self._is_array = False<EOL>self.name = tp.getAttribute('<STR_LIT:name>')<EOL>self.ns = tp.getTargetNamespace()<EOL>derivation = tp.content.content<EOL>try:<EOL><INDENT>base = derivation.getTypeDefinition('<STR_LIT>')<EOL><DEDENT>except XMLSchema.SchemaError as ex:<EOL><INDENT>base = None<EOL><DEDENT>if base is None:<EOL><INDENT>base = derivation.getAttributeQName('<STR_LIT>')<EOL>if base is None:<EOL><INDENT>raise ContainerError('<STR_LIT>'%derivation.getItemTrace())<EOL><DEDENT>if base != (SOAP.ENC,'<STR_LIT>') and base != (SCHEMA.XSD3,'<STR_LIT>'):<EOL><INDENT>raise ContainerError('<STR_LIT>' %(<EOL>base, derivation.getItemTrace()<EOL>))<EOL><DEDENT><DEDENT>if base == (SOAP.ENC,'<STR_LIT>'):<EOL><INDENT>self.logger.debug("<STR_LIT>")<EOL>self._is_array = True<EOL>self._kw_array = {'<STR_LIT>':None, '<STR_LIT>':ID3, '<STR_LIT>':None}<EOL>self.sKlass = BTI.get_typeclass(base[<NUM_LIT:1>], base[<NUM_LIT:0>])<EOL>self.sKlassNS = base[<NUM_LIT:0>]<EOL>for a in derivation.getAttributeContent():<EOL><INDENT>assert a.isAttribute() is True,'<STR_LIT>' %a.getItemTrace()<EOL>if a.isReference() is False:<EOL><INDENT>continue<EOL><DEDENT>if a.getAttribute('<STR_LIT>') != (SOAP.ENC,'<STR_LIT>'):<EOL><INDENT>continue<EOL><DEDENT>attr = a.getAttributeQName((WSDL.BASE, '<STR_LIT>'))<EOL>if attr is None:<EOL><INDENT>warnings.warn('<STR_LIT>' %(<EOL>SOAP.ENC,'<STR_LIT>',WSDL.BASE, '<STR_LIT>'))<EOL>break<EOL><DEDENT>self._kw_array['<STR_LIT>'] = attr<EOL>qname = self._kw_array.get('<STR_LIT>')<EOL>if a is not None:<EOL><INDENT>ncname = qname[<NUM_LIT:1>].strip('<STR_LIT>')<EOL>namespace = qname[<NUM_LIT:0>]<EOL>try:<EOL><INDENT>ofwhat = a.getSchemaItem(XMLSchema.TYPES, namespace, ncname)<EOL><DEDENT>except XMLSchema.SchemaError as ex:<EOL><INDENT>ofwhat = None<EOL><DEDENT>if ofwhat is None:<EOL><INDENT>self._kw_array['<STR_LIT>'] = BTI.get_typeclass(ncname, namespace)<EOL><DEDENT>else:<EOL><INDENT>self._kw_array['<STR_LIT>'] = GetClassNameFromSchemaItem(ofwhat, do_extended=self.do_extended)<EOL><DEDENT>if self._kw_array['<STR_LIT>'] is None:<EOL><INDENT>raise ContainerError('<STR_LIT>'%(namespace, ncname, derivation.getItemTrace()))<EOL><DEDENT>self.logger.debug('<STR_LIT>' %<EOL>str(self._kw_array['<STR_LIT>']))<EOL>break<EOL><DEDENT><DEDENT><DEDENT>elif isinstance(base, XMLSchema.XMLSchemaComponent):<EOL><INDENT>self.sKlass = base.getAttribute('<STR_LIT:name>')<EOL>self.sKlassNS = base.getTargetNamespace()<EOL><DEDENT>else:<EOL><INDENT>self.sKlass = base.getName()<EOL>self.sKlassNS = base.getTargetNamespace()<EOL><DEDENT>attrs = []<EOL>if derivation.isRestriction():<EOL><INDENT>self.restriction = True<EOL>self.extension = False<EOL>attrs += derivation.getAttributeContent() or ()<EOL><DEDENT>else:<EOL><INDENT>self.restriction = False<EOL>self.extension = True<EOL>attrs += tp.getAttributeContent() or ()<EOL>if isinstance(derivation, XMLSchema.XMLSchemaComponent):<EOL><INDENT>attrs += derivation.getAttributeContent() or ()<EOL><DEDENT><DEDENT>if attrs:<EOL><INDENT>self.extType = derivation<EOL><DEDENT>if derivation.content is not Noneand derivation.content.isModelGroup():<EOL><INDENT>group = derivation.content<EOL>if group.isReference():<EOL><INDENT>group = group.getModelGroupReference()<EOL><DEDENT>self.mgContent = group.content<EOL><DEDENT>elif derivation.content:<EOL><INDENT>raise Wsdl2PythonError('<STR_LIT>' %derivation.content.getItemTrace())<EOL><DEDENT>else:<EOL><INDENT>self.mgContent = ()<EOL><DEDENT>self.attrComponents = self._setAttributes(tuple(attrs))<EOL>
complexContent/[extension,restriction]
            restriction
            extension
            extType -- used in figuring attrs for extensions