parameters: ()
docstring: Test program for telnetlib.
  
      Usage: python telnetlib.py [-d] ... [host [port]]
  
      Default host is localhost; default port is 23.
docstring_summary: Test program for telnetlib.
docstring_tokens: Test program for telnetlib .
function: def test():
      """Test program for telnetlib.
  
      Usage: python telnetlib.py [-d] ... [host [port]]
  
      Default host is localhost; default port is 23.
  
      """
      debuglevel = 0
      while sys.argv[1:] and sys.argv[1] == '-d':
          debuglevel = debuglevel+1
          del sys.argv[1]
      host = 'localhost'
      if sys.argv[1:]:
          host = sys.argv[1]
      port = 0
      if sys.argv[2:]:
          portstr = sys.argv[2]
          try:
              port = int(portstr)
          except ValueError:
              port = socket.getservbyname(portstr, 'tcp')
      with Telnet() as tn:
          tn.set_debuglevel(debuglevel)
          tn.open(host, port, timeout=0.5)
          tn.interact()
function_tokens: def test ( ) : debuglevel = 0 while sys . argv [ 1 : ] and sys . argv [ 1 ] == '-d' : debuglevel = debuglevel + 1 del sys . argv [ 1 ] host = 'localhost' if sys . argv [ 1 : ] : host = sys . argv [ 1 ] port = 0 if sys . argv [ 2 : ] : portstr = sys . argv [ 2 ] try : port = int ( portstr ) except ValueError : port = socket . getservbyname ( portstr , 'tcp' ) with Telnet ( ) as tn : tn . set_debuglevel ( debuglevel ) tn . open ( host , port , timeout = 0.5 ) tn . interact ( )