def explore_uri(self, explorer_resource, show_back=True):
        """INTERACTIVE exploration of capabilities document(s) starting at a given URI

        Will flag warnings if the document is not of type listed in caps
        """
        uri = explorer_resource.uri
        caps = explorer_resource.acceptable_capabilities
        checks = explorer_resource.checks
        print((uri) % "Reading %s")
        options={}
        capability=None
        try:
            if (caps=='resource'):
                # Not expecting a capability document
                self.explore_show_head(uri,check_headers=checks)
            else: 
                s=Sitemap()
                list = s.parse_xml(urllib.urlopen(uri))
                (options,capability)=self.explore_show_summary(list,s.parsed_index,caps,context=uri)
        except IOError as e:
            print("Cannot read %s (%s)" % (uri,str(e)))
        except Exception as e:
            print("Cannot parse %s (%s)" % (uri,str(e)))
        #
        # Loop until we have some valide input
        #
        while (True):
            # don't offer number option for no resources/capabilities
            num_prompt = '' if (len(options)==0) else 'number, '
            up_prompt = 'b(ack), ' if (show_back) else ''
            input = raw_input( "Follow [%s%sq(uit)]?" % (num_prompt,up_prompt) )
            if (input in options.keys()):
                break
            if (input == 'q'):
                raise ExplorerQuit()
            if (input == 'b'):
                return(None)
        #
        # Got input that is one of the options
        #
        checks = {}
        r = options[input]
        if ( r.capability is None ):
            if (capability in ['resourcelist','changelist',
                               'resourcedump','changedump']):
                caps = 'resource'
            else:
                caps = self.allowed_entries(capability)
        elif (r.capability is 'resource'):
            caps = r.capability
        else:
            caps = [r.capability]
        # Record anything we know about the resource to check
        if (r.length is not None):
            checks['content-length']=r.length
        if (r.lastmod is not None):
            checks['last-modified']=r.lastmod
        if (r.mime_type is not None):
            checks['content-type']=r.mime_type
        # FIXME - could add fixity checks here too
        return( XResource(options[input].uri, caps, checks) )
dataset/ETHPy150Open resync/resync/resync/explorer.py/Explorer.explore_uri/swapped operands of `%`