parameters: (self, match, timeout)
return_statement: return self.read_very_lazy()
docstring: Read until a given string is encountered or until timeout.
  
          This method uses select.poll() to implement the timeout.
docstring_summary: Read until a given string is encountered or until timeout.
docstring_tokens: Read until a given string is encountered or until timeout .
function: def _read_until_with_poll(self, match, timeout):
          """Read until a given string is encountered or until timeout.
  
          This method uses select.poll() to implement the timeout.
          """
          n = len(match)
          call_timeout = timeout
          if timeout is not None:
              from time import time
              time_start = time()
          self.process_rawq()
          i = self.cookedq.find(match)
          if i < 0:
              poller = select.poll()
              poll_in_or_priority_flags = select.POLLIN | select.POLLPRI
              poller.register(self, poll_in_or_priority_flags)
              while i < 0 and not self.eof:
                  try:
                      # Poll takes its timeout in milliseconds.
                      ready = poller.poll(None if timeout is None
                                          else 1000 * call_timeout)
                  except select.error as e:
                      if e[0] == errno.EINTR:
                          if timeout is not None:
                              elapsed = time() - time_start
                              call_timeout = timeout-elapsed
                          continue
                      raise
                  for fd, mode in ready:
                      if mode & poll_in_or_priority_flags:
                          i = max(0, len(self.cookedq)-n)
                          self.fill_rawq()
                          self.process_rawq()
                          i = self.cookedq.find(match, i)
                  if timeout is not None:
                      elapsed = time() - time_start
                      if elapsed >= timeout:
                          break
                      call_timeout = timeout-elapsed
              poller.unregister(self)
          if i >= 0:
              i = i + n
              buf = self.cookedq[:i]
              self.cookedq = self.cookedq[i:]
              return buf
          return self.read_very_lazy()
function_tokens: def _read_until_with_poll ( self , match , timeout ) : n = len ( match ) call_timeout = timeout if timeout is not None : from time import time time_start = time ( ) self . process_rawq ( ) i = self . cookedq . find ( match ) if i < 0 : poller = select . poll ( ) poll_in_or_priority_flags = select . POLLIN | select . POLLPRI poller . register ( self , poll_in_or_priority_flags ) while i < 0 and not self . eof : try : # Poll takes its timeout in milliseconds. ready = poller . poll ( None if timeout is None else 1000 * call_timeout ) except select . error as e : if e [ 0 ] == errno . EINTR : if timeout is not None : elapsed = time ( ) - time_start call_timeout = timeout - elapsed continue raise for fd , mode in ready : if mode & poll_in_or_priority_flags : i = max ( 0 , len ( self . cookedq ) - n ) self . fill_rawq ( ) self . process_rawq ( ) i = self . cookedq . find ( match , i ) if timeout is not None : elapsed = time ( ) - time_start if elapsed >= timeout : break call_timeout = timeout - elapsed poller . unregister ( self ) if i >= 0 : i = i + n buf = self . cookedq [ : i ] self . cookedq = self . cookedq [ i : ] return buf return self . read_very_lazy ( )