parameters: ()
docstring: Set constants _EOF and _INTR.
      
      This avoids doing potentially costly operations on module load.
docstring_summary: Set constants _EOF and _INTR.
      
      This avoids doing potentially costly operations on module load.
docstring_tokens: Set constants _EOF and _INTR . This avoids doing potentially costly operations on module load .
function: def _make_eof_intr():
      """Set constants _EOF and _INTR.
      
      This avoids doing potentially costly operations on module load.
      """
      global _EOF, _INTR
      if (_EOF is not None) and (_INTR is not None):
          return
  
      # inherit EOF and INTR definitions from controlling process.
      try:
          from termios import VEOF, VINTR
          fd = None
          for name in 'stdin', 'stdout':
              stream = getattr(sys, '__%s__' % name, None)
              if stream is None or not hasattr(stream, 'fileno'):
                  continue
              try:
                  fd = stream.fileno()
              except ValueError:
                  continue
          if fd is None:
              # no fd, raise ValueError to fallback on CEOF, CINTR
              raise ValueError("No stream has a fileno")
          intr = ord(termios.tcgetattr(fd)[6][VINTR])
          eof = ord(termios.tcgetattr(fd)[6][VEOF])
      except (ImportError, OSError, IOError, ValueError, termios.error):
          # unless the controlling process is also not a terminal,
          # such as cron(1), or when stdin and stdout are both closed.
          # Fall-back to using CEOF and CINTR. There
          try:
              from termios import CEOF, CINTR
              (intr, eof) = (CINTR, CEOF)
          except ImportError:
              #                         ^C, ^D
              (intr, eof) = (3, 4)
      
      _INTR = _byte(intr)
      _EOF = _byte(eof)
function_tokens: def _make_eof_intr ( ) : global _EOF , _INTR if ( _EOF is not None ) and ( _INTR is not None ) : return # inherit EOF and INTR definitions from controlling process. try : from termios import VEOF , VINTR fd = None for name in 'stdin' , 'stdout' : stream = getattr ( sys , '__%s__' % name , None ) if stream is None or not hasattr ( stream , 'fileno' ) : continue try : fd = stream . fileno ( ) except ValueError : continue if fd is None : # no fd, raise ValueError to fallback on CEOF, CINTR raise ValueError ( "No stream has a fileno" ) intr = ord ( termios . tcgetattr ( fd ) [ 6 ] [ VINTR ] ) eof = ord ( termios . tcgetattr ( fd ) [ 6 ] [ VEOF ] ) except ( ImportError , OSError , IOError , ValueError , termios . error ) : # unless the controlling process is also not a terminal, # such as cron(1), or when stdin and stdout are both closed. # Fall-back to using CEOF and CINTR. There try : from termios import CEOF , CINTR ( intr , eof ) = ( CINTR , CEOF ) except ImportError : #                         ^C, ^D ( intr , eof ) = ( 3 , 4 ) _INTR = _byte ( intr ) _EOF = _byte ( eof )