def __init__(self, pathOrRefNode=None, namespace=None, refnode=None):
        import general, nodetypes
        self._refNode = None
        if pathOrRefNode:
            if isinstance(pathOrRefNode, (basestring,Path)):
                try:
                    self._refNode = general.PyNode( cmds.referenceQuery( str(pathOrRefNode), referenceNode=1 ) )
                except __HOLE__:
                    pass
            if not self._refNode:
                if isinstance( pathOrRefNode, nodetypes.Reference ):
                    self._refNode = pathOrRefNode
                else:
                    try:
                        self._refNode = general.PyNode( pathOrRefNode )
                    except general.MayaObjectError:
                        self._refNode = general.PyNode( cmds.file( pathOrRefNode, q=1, referenceNode=True) )
        elif namespace:
            namespace = namespace.rstrip(':')
            for iNamespace, iRefNode in iterReferences(namespaces=True, recursive=True, refNodes=True, references=False):
                if namespace == iNamespace:
                    self._refNode = iRefNode
                    break
            if self._refNode is None:
                raise RuntimeError,"Could not find a reference with the namespace %r" % namespace

        elif refnode:
            self._refNode = general.PyNode( refnode )

        assert self._refNode.type() == 'reference'

#        def create(path, unresolvedPath ):
#            """Actually create the FileReference object"""
#            def splitCopyNumber(path):
#                """Return a tuple with the path and the copy number. Second element will be None if no copy number"""
#                buf = path.split('{')
#                try:
#                    return ( buf[0], int(buf[1][:-1]) )
#                except:
#                    return (path, None)
#
#            path, copyNumber = splitCopyNumber(path)
#            unresolvedPath, copyNumber2 = splitCopyNumber(unresolvedPath)
#            assert copyNumber == copyNumber2, "copy number of %s is not the same as %s" % ( path, unresolvedPath )
#            self._file = Path(path)
#            self._copyNumber = copyNumber
#            self._unresolvedPath = Path(unresolvedPath)
#            #self._refNode = refNode
#            #return self
#
#        # Direct mappings:
#        # refNode --> refFile:  MFileIO.getReferenceFileByNode( refNode )
#        # refFile --> refNode:  cmds.file( refFile, q=1, referenceNode=1)
#        # refFile --> namespace:  refNode.namespace() + cmds.file( refFile, q=1, namespace=1)
#        self._refNode = None
#
#        import general
#        if unresolvedPath:
#            # check to ensure it's legit
#            assert path in ReferenceCache.byFullPath,  "%s is not a valid reference file" % path
#            return create(path, unresolvedPath)
#
#        if refnode:
#            refNode = general.PyNode(refnode)
#            self._refNode = refNode
#            # refNode is all we need for now. we can get anything else from this when it is asked for
#            return
#
#
#
#        resolvedPath, unresolvedPath = ReferenceCache.getPaths( path, namespace )
#        create( resolvedPath, unresolvedPath )
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/core/system.py/FileReference.__init__