def explore(self):
        """INTERACTIVE exploration source capabilities
        
        Will use sitemap URI taken either from explicit self.sitemap_name
        or derived from the mappings supplied.
        """
        # Where do we start? Build options in starts which has entries
        # that are a pair comprised of the uri and a list of acceptable
        # capabilities
        starts = []
        if (self.sitemap_name is not None):
            print((uri) % "Starting from explicit --sitemap %s")
            starts.append( XResource(uri) )
        elif (len(self.mapper)>0):
            uri = self.mapper.default_src_uri()
            (scheme, netloc, path, params, query, fragment) = urlparse(uri)
            if (not scheme and not netloc):
                if (os.path.isdir(path)):
                    # have a dir, look for 'likely' file names
                    print("Looking for capability documents in local directory %s" % (path))
                    for name in ['resourcesync','capabilities.xml',
                                 'resourcelist.xml','changelist.xml']:
                        file = os.path.join(path,name)
                        if (os.path.isfile(file)):
                            starts.append( XResource(file) )
                    if (len(starts)==0):
                        raise ClientFatalError( "No likely capability files found in local directory %s" %
                                                (path) )
                else:
                    # local file, might be anything (or not exist)
                    print("Starting from local file %s" % (path))
                    starts.append( XResource(path) )
            else:
                # remote, can't tell whether we have a sitemap or a server name or something 
                # else, build list of options depending on whether there is a path and whether
                # there is an extension/name
                well_known = urlunparse( [ scheme,netloc,'/.well-known/resourcesync','','','' ] )
                if (not path):
                    # root, just look for .well-known
                    starts.append( XResource(well_known, ['capabilitylist','capabilitylistindex']) )
                else:
                    starts.append( XResource(uri) )
                    starts.append( XResource(well_known, ['capabilitylist','capabilitylistindex']) )
                print("Looking for discovery information based on mappings")
        else:
            raise ClientFatalError("No source information (server base uri or capability uri) specified, use -h for help")
        # 
        # Have list of one or more possible starting point, try them in turn
        try:
            for start in starts:
                # For each starting point we create a fresh history
                history = [ start ]
                input = None
                while (len(history)>0):
                    print
                    xr = history.pop()
                    new_xr = self.explore_uri(xr,len(history)>0)
                    if (new_xr):
                        # Add current and new to history
                        history.append( xr )
                        history.append( new_xr )
        except ExplorerQuit:
            pass # expected way to exit
        print("\nresync-explorer done, bye...\n")
dataset/ETHPy150Open resync/resync/resync/explorer.py/Explorer.explore/swapped operands of `%`