class_docstr: This is like pexpect.spawn but allows you to supply your own open file
  descriptor. For example, you could use it to read through a file looking
  for patterns, or to control a modem or serial device. 
class_docstr_tok: ["This","is","like","pexpect.spawn","but","allows","you","to","supply","your","own","open","file","descriptor",".","For","example",",","you","could","use","it","to","read","through","a","file","looking","for","patterns",",","or","to","control","a","modem","or","serial","device","."]
docstr: Read from the file descriptor and return the result as a string.
  
  The read_nonblocking method of :class:`SpawnBase` assumes that a call
  to os.read will not block (timeout parameter is ignored). This is not
  the case for POSIX file-like objects such as sockets and serial ports.
  
  Use :func:`select.select`, timeout is implemented conditionally for
  POSIX systems.
  
  :param int size: Read at most *size* bytes.
  :param int timeout: Wait timeout seconds for file descriptor to be
      ready to read. When -1 (default), use self.timeout. When 0, poll.
  :return: String containing the bytes read
docstr_tok: ["Read","from","the","file","descriptor","and","return","the","result","as","a","string",".","The","read_nonblocking","method","of",":","class",":","`","SpawnBase","`","assumes","that","a","call","to","os.read","will","not","block","(","timeout","parameter","is","ignored",")",".","This","is","not","the","case","for","POSIX","file-like","objects","such","as","sockets","and","serial","ports",".","Use",":","func",":","`","select.select","`",",","timeout","is","implemented","conditionally","for","POSIX","systems",".",":","param","int","size",":","Read","at","most","*","size","*","bytes",".",":","param","int","timeout",":","Wait","timeout","seconds","for","file","descriptor","to","be","ready","to","read",".","When","-1","(","default",")",",","use","self.timeout",".","When","0",",","poll",".",":","return",":","String","containing","the","bytes","read"]
code: def read_nonblocking(self, size=1, timeout=-1):
      """
      Read from the file descriptor and return the result as a string.
  
      The read_nonblocking method of :class:`SpawnBase` assumes that a call
      to os.read will not block (timeout parameter is ignored). This is not
      the case for POSIX file-like objects such as sockets and serial ports.
  
      Use :func:`select.select`, timeout is implemented conditionally for
      POSIX systems.
  
      :param int size: Read at most *size* bytes.
      :param int timeout: Wait timeout seconds for file descriptor to be
          ready to read. When -1 (default), use self.timeout. When 0, poll.
      :return: String containing the bytes read
      """
      if os.name == "posix":
          if timeout == -1:
              timeout = self.timeout
          rlist = [self.child_fd]
          wlist = []
          xlist = []
          if self.use_poll:
              rlist = poll_ignore_interrupts(rlist, timeout)
          else:
              rlist, wlist, xlist = select_ignore_interrupts(
                  rlist, wlist, xlist, timeout
              )
          if self.child_fd not in rlist:
              raise TIMEOUT("Timeout exceeded.")
      return super(fdspawn, self).read_nonblocking(size)
  
file_path: catboost/contrib/python/pexpect/py3/pexpect/fdpexpect.py
imports: from .spawnbase import SpawnBase
  from .exceptions import ExceptionPexpect, TIMEOUT
  from .utils import select_ignore_interrupts, poll_ignore_interrupts
  import os
label_desc: Use image node_id 9 for calling the fdspawn obj's underlying member method code with example usage: obj.read_nonblocking(size, timeout) and returns: super