# Path: pysphere/ZSI/wstools/Utility.py
# def SplitQName(qname):
#     '''SplitQName(qname) -> (string, string)
#     
#        Split Qualified Name into a tuple of len 2, consisting 
#        of the prefix and the local name.  
# 
#        (prefix, localName)
#     
#        Special Cases:
#            xmlns -- (localName, 'xmlns')
#            None -- (None, localName)
#     '''
#     
#     l = qname.split(':')
#     if len(l) == 1:
#         l.insert(0, None)
#     elif len(l) == 2:
#         if l[0] == 'xmlns':
#             l.reverse()
#     else:
#         return
#     return tuple(l)
# 
# Path: pysphere/ZSI/wstools/Namespaces.py
# class SCHEMA:
#     XSD1        = "http://www.w3.org/1999/XMLSchema"
#     XSD2        = "http://www.w3.org/2000/10/XMLSchema"
#     XSD3        = "http://www.w3.org/2001/XMLSchema"
#     XSD_LIST    = [ XSD1, XSD2, XSD3]
#     XSI1        = "http://www.w3.org/1999/XMLSchema-instance"
#     XSI2        = "http://www.w3.org/2000/10/XMLSchema-instance"
#     XSI3        = "http://www.w3.org/2001/XMLSchema-instance"
#     XSI_LIST    = [ XSI1, XSI2, XSI3 ]
#     BASE        = XSD3


import re
from pysphere.ZSI.generate import WsdlGeneratorError
from pysphere.ZSI.wstools.Utility import SplitQName
from pysphere.ZSI.wstools.Namespaces import SCHEMA
    from pysphere.ZSI.generate.wsdl2python import WriteServiceModule, SchemaDescription
############################################################################
# Monte M. Goode, LBNL
# See LBNLCopyright for copyright notice!
###########################################################################

# utility classes used by new generator - mostly 'sugar' classes
# that are actually imported by the generated code.  also includes
# utilities used by wsdl2python itself.

# $Id$



NCName_to_ModuleName = lambda name: re.sub('\.', '_', TextProtect(name))
NCName_to_ClassName = lambda name: re.sub('\.', '_', TextProtect(name))
TextProtect = lambda s: re.sub('[-./:# ]', '_', s)
TextProtectAttributeName = lambda name: TextProtect('_%s' %name)

# Path: pysphere/ZSI/wstools/Utility.py
# def SplitQName(qname):
#     '''SplitQName(qname) -> (string, string)
#     
#        Split Qualified Name into a tuple of len 2, consisting 
#        of the prefix and the local name.  
# 
#        (prefix, localName)
#     
#        Special Cases:
#            xmlns -- (localName, 'xmlns')
#            None -- (None, localName)
#     '''
#     
#     l = qname.split(':')
#     if len(l) == 1:
#         l.insert(0, None)
#     elif len(l) == 2:
#         if l[0] == 'xmlns':
#             l.reverse()
#     else:
#         return
#     return tuple(l)
# 
# Path: pysphere/ZSI/wstools/Namespaces.py
# class SCHEMA:
#     XSD1        = "http://www.w3.org/1999/XMLSchema"
#     XSD2        = "http://www.w3.org/2000/10/XMLSchema"
#     XSD3        = "http://www.w3.org/2001/XMLSchema"
#     XSD_LIST    = [ XSD1, XSD2, XSD3]
#     XSI1        = "http://www.w3.org/1999/XMLSchema-instance"
#     XSI2        = "http://www.w3.org/2000/10/XMLSchema-instance"
#     XSI3        = "http://www.w3.org/2001/XMLSchema-instance"
#     XSI_LIST    = [ XSI1, XSI2, XSI3 ]
#     BASE        = XSD3


# Path: pysphere/ZSI/generate/utility.py
import re
from pysphere.ZSI.generate import WsdlGeneratorError
from pysphere.ZSI.wstools.Utility import SplitQName
from pysphere.ZSI.wstools.Namespaces import SCHEMA
    from pysphere.ZSI.generate.wsdl2python import WriteServiceModule, SchemaDescription

############################################################################
# Monte M. Goode, LBNL
# See LBNLCopyright for copyright notice!
###########################################################################

# utility classes used by new generator - mostly 'sugar' classes
# that are actually imported by the generated code.  also includes
# utilities used by wsdl2python itself.

# $Id$



NCName_to_ModuleName = lambda name: re.sub('\.', '_', TextProtect(name))
NCName_to_ClassName = lambda name: re.sub('\.', '_', TextProtect(name))
TextProtect = lambda s: re.sub('[-./:# ]', '_', s)
TextProtectAttributeName = lambda name: TextProtect('_%s' %name)

Namespace2ModuleName = lambda ns: TextProtect(ns.lstrip('http://')).rstrip('_')