(self, characters, opposite=False)
return r
Returns a string of characters from the stream up to but not
        including any character in 'characters' or EOF. 'characters' must be
        a container that supports the 'in' method and iteration over its
        characters.
Returns a string of characters from the stream up to but not
        including any character in 'characters' or EOF. 'characters' must be
        a container that supports the 'in' method and iteration over its
        characters.
Returns a string of characters from the stream up to but not including any character in characters or EOF . characters must be a container that supports the in method and iteration over its characters .
def charsUntil(self, characters, opposite=False):
        """ Returns a string of characters from the stream up to but not
        including any character in 'characters' or EOF. 'characters' must be
        a container that supports the 'in' method and iteration over its
        characters.
        """

        # Use a cache of regexps to find the required characters
        try:
            chars = charsUntilRegEx[(characters, opposite)]
        except KeyError:
            if __debug__:
                for c in characters:
                    assert(ord(c) < 128)
            regex = "".join(["\\x%02x" % ord(c) for c in characters])
            if not opposite:
                regex = "^%s" % regex
            chars = charsUntilRegEx[(characters, opposite)] = re.compile("[%s]+" % regex)

        rv = []

        while True:
            # Find the longest matching prefix
            m = chars.match(self.chunk, self.chunkOffset)
            if m is None:
                # If nothing matched, and it wasn't because we ran out of chunk,
                # then stop
                if self.chunkOffset != self.chunkSize:
                    break
            else:
                end = m.end()
                # If not the whole chunk matched, return everything
                # up to the part that didn't match
                if end != self.chunkSize:
                    rv.append(self.chunk[self.chunkOffset:end])
                    self.chunkOffset = end
                    break
            # If the whole remainder of the chunk matched,
            # use it all and read the next chunk
            rv.append(self.chunk[self.chunkOffset:])
            if not self.readChunk():
                # Reached EOF
                break

        r = "".join(rv)
        return r
def charsUntil ( self , characters , opposite = False ) : # Use a cache of regexps to find the required characters try : chars = charsUntilRegEx [ ( characters , opposite ) ] except KeyError : if __debug__ : for c in characters : assert ( ord ( c ) < 128 ) regex = "" . join ( [ "\\x%02x" % ord ( c ) for c in characters ] ) if not opposite : regex = "^%s" % regex chars = charsUntilRegEx [ ( characters , opposite ) ] = re . compile ( "[%s]+" % regex ) rv = [ ] while True : # Find the longest matching prefix m = chars . match ( self . chunk , self . chunkOffset ) if m is None : # If nothing matched, and it wasn't because we ran out of chunk, # then stop if self . chunkOffset != self . chunkSize : break else : end = m . end ( ) # If not the whole chunk matched, return everything # up to the part that didn't match if end != self . chunkSize : rv . append ( self . chunk [ self . chunkOffset : end ] ) self . chunkOffset = end break # If the whole remainder of the chunk matched, # use it all and read the next chunk rv . append ( self . chunk [ self . chunkOffset : ] ) if not self . readChunk ( ) : # Reached EOF break r = "" . join ( rv ) return r