class_docstr: Parser for the Telnet protocol.
  Usage::
  
      def data_received(data):
          print(data)
  
      def size_received(rows, columns):
          print(rows, columns)
  
      p = TelnetProtocolParser(data_received, size_received)
      p.feed(binary_data)
class_docstr_tok: ["Parser","for","the","Telnet","protocol",".","Usage",":",":","def","data_received","(","data",")",":","print","(","data",")","def","size_received","(","rows",",","columns",")",":","print","(","rows",",","columns",")","p","=","TelnetProtocolParser","(","data_received",",","size_received",")","p.feed","(","binary_data",")"]
docstr: Received NAWS. (Window dimensions.)
docstr_tok: ["Received","NAWS",".","(","Window","dimensions",".",")"]
code: def naws(self, data):
      """
      Received NAWS. (Window dimensions.)
      """
      if len(data) == 4:
          # NOTE: the first parameter of struct.unpack should be
          # a 'str' object. Both on Py2/py3. This crashes on OSX
          # otherwise.
          columns, rows = struct.unpack(str("!HH"), data)
          self.size_received_callback(rows, columns)
      else:
          logger.warning("Wrong number of NAWS bytes")
  
file_path: catboost/contrib/python/prompt-toolkit/py2/prompt_toolkit/contrib/telnet/protocol.py
imports: from __future__ import unicode_literals
  import struct
  from six import int2byte, binary_type, iterbytes
  from .log import logger
label_desc: Use image node_id 8 for calling the TelnetProtocolParser obj's underlying member method code with example usage: obj.naws(data) without return types