Package duplicity :: Module pexpect :: Class searcher_re
[hide private]
[frames] | no frames]

Class searcher_re

source code


This is regular expression string search helper for the
spawn.expect_any() method.

Attributes:

    eof_index     - index of EOF, or -1
    timeout_index - index of TIMEOUT, or -1

After a successful match by the search() method the following attributes
are available:

    start - index into the buffer, first byte of match
    end   - index into the buffer, first byte after match
    match - the re.match object returned by a succesful re.search



Instance Methods [hide private]
 
__init__(self, patterns)
This creates an instance that searches for 'patterns' Where 'patterns' may be a list or other sequence of compiled regular expressions, or the EOF or TIMEOUT types.
source code
 
__str__(self)
This returns a human-readable string that represents the state of the object.
source code
 
search(self, buffer, freshlen, searchwindowsize=None)
This searches 'buffer' for the first occurence of one of the regular expressions.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, patterns)
(Constructor)

source code 
This creates an instance that searches for 'patterns' Where 'patterns' may be a list or other sequence of compiled regular expressions, or the EOF or TIMEOUT types.
Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 
This returns a human-readable string that represents the state of the object.
Overrides: object.__str__

search(self, buffer, freshlen, searchwindowsize=None)

source code 

This searches 'buffer' for the first occurence of one of the regular expressions. 'freshlen' must indicate the number of bytes at the end of 'buffer' which have not been searched before.

See class spawn for the 'searchwindowsize' argument.

If there is a match this returns the index of that string, and sets 'start', 'end' and 'match'. Otherwise, returns -1.