parameters: (self, list, timeout=None)
return_statement: return (-1, None, text)
docstring: Read until one from a list of a regular expressions matches.
  
          The timeout is implemented using select.select().
docstring_summary: Read until one from a list of a regular expressions matches.
docstring_tokens: Read until one from a list of a regular expressions matches .
function: def _expect_with_select(self, list, timeout=None):
          """Read until one from a list of a regular expressions matches.
  
          The timeout is implemented using select.select().
          """
          re = None
          list = list[:]
          indices = range(len(list))
          for i in indices:
              if not hasattr(list[i], "search"):
                  if not re: import re
                  list[i] = re.compile(list[i])
          if timeout is not None:
              from time import time
              time_start = time()
          while 1:
              self.process_rawq()
              for i in indices:
                  m = list[i].search(self.cookedq)
                  if m:
                      e = m.end()
                      text = self.cookedq[:e]
                      self.cookedq = self.cookedq[e:]
                      return (i, m, text)
              if self.eof:
                  break
              if timeout is not None:
                  elapsed = time() - time_start
                  if elapsed >= timeout:
                      break
                  s_args = ([self.fileno()], [], [], timeout-elapsed)
                  r, w, x = select.select(*s_args)
                  if not r:
                      break
              self.fill_rawq()
          text = self.read_very_lazy()
          if not text and self.eof:
              raise EOFError
          return (-1, None, text)
function_tokens: def _expect_with_select ( self , list , timeout = None ) : re = None list = list [ : ] indices = range ( len ( list ) ) for i in indices : if not hasattr ( list [ i ] , "search" ) : if not re : import re list [ i ] = re . compile ( list [ i ] ) if timeout is not None : from time import time time_start = time ( ) while 1 : self . process_rawq ( ) for i in indices : m = list [ i ] . search ( self . cookedq ) if m : e = m . end ( ) text = self . cookedq [ : e ] self . cookedq = self . cookedq [ e : ] return ( i , m , text ) if self . eof : break if timeout is not None : elapsed = time ( ) - time_start if elapsed >= timeout : break s_args = ( [ self . fileno ( ) ] , [ ] , [ ] , timeout - elapsed ) r , w , x = select . select ( * s_args ) if not r : break self . fill_rawq ( ) text = self . read_very_lazy ( ) if not text and self . eof : raise EOFError return ( - 1 , None , text )