def parse_descriptor_string(d_string, cur_package=None):
    """parse_descriptor_string will expand names of modules using
    information about the current package and allowing shortcuts
    for any bundled vistrails packages (e.g. "basic" for
    "org.vistrails.vistrails.basic").  It also allows a nicer
    format for namespace/module specification (namespace comes
    fist unlike port specifications where it is after the module
    name...

    Examples:
      "persistence:PersistentInputFile", None -> 
          ("org.vistrails.vistrails.persistence", PersistentInputFile", "")
      "basic:String", None ->
          ("org.vistrails.vistrails.basic", "String", "")
      "NamespaceA|NamespaceB|Module", "org.example.my" ->
          ("org.example.my", "Module", "NamespaceA|NamespaceB")
    """

    package = ''
    qual_name = ''
    name = ''
    namespace = None
    parts = d_string.strip().split(':', 1)
    if len(parts) > 1:
        qual_name = parts[1]
        if '.' in parts[0]:
            package = parts[0]
        else:
            package = '%s.%s' % (_defaultPkgPrefix, parts[0])
    else:
        qual_name = d_string
        if cur_package is None:
            reg = get_module_registry()
            if reg._current_package is not None:
                package = reg._current_package.identifier
            else:
                package = get_vistrails_basic_pkg_id()
        else:
            package = cur_package
    qual_parts = qual_name.rsplit('|', 1)
    if len(qual_parts) > 1:
        namespace, name = qual_parts
    else:
        name = qual_name
    return (package, name, namespace)
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/core/modules/utils.py/parse_descriptor_string/original