class_docstr: A debugpy message queue.
class_docstr_tok: ["A","debugpy","message","queue","."]
docstr: Put a tcp frame in the queue.
docstr_tok: ["Put","a","tcp","frame","in","the","queue","."]
code: def put_tcp_frame(self, frame):
      """Put a tcp frame in the queue."""
      self.tcp_buffer += frame
  
      self.log.debug("QUEUE - received frame")
      while True:
          # Finds header
          if self.header_pos == -1:
              self.header_pos = self.tcp_buffer.find(
                  DebugpyMessageQueue.HEADER
              )
          if self.header_pos == -1:
              return
  
          self.log.debug(
              "QUEUE - found header at pos %i", self.header_pos
          )
  
          # Finds separator
          if self.separator_pos == -1:
              hint = self.header_pos + DebugpyMessageQueue.HEADER_LENGTH
              self.separator_pos = self.tcp_buffer.find(
                  DebugpyMessageQueue.SEPARATOR, hint
              )
          if self.separator_pos == -1:
              return
  
          self.log.debug(
              "QUEUE - found separator at pos %i", self.separator_pos
          )
  
          if self.message_pos == -1:
              size_pos = (
                  self.header_pos + DebugpyMessageQueue.HEADER_LENGTH
              )
              self.message_pos = (
                  self.separator_pos
                  + DebugpyMessageQueue.SEPARATOR_LENGTH
              )
              self.message_size = int(
                  self.tcp_buffer[size_pos : self.separator_pos]
              )
  
          self.log.debug(
              "QUEUE - found message at pos %i", self.message_pos
          )
          self.log.debug(
              "QUEUE - message size is %i", self.message_size
          )
  
          if (
              len(self.tcp_buffer) - self.message_pos
              < self.message_size
          ):
              return
  
          self._put_message(
              self.tcp_buffer[
                  self.message_pos : self.message_pos
                  + self.message_size
              ]
          )
          if (
              len(self.tcp_buffer) - self.message_pos
              == self.message_size
          ):
              self.log.debug("QUEUE - resetting tcp_buffer")
              self.tcp_buffer = ""
              self._reset_tcp_pos()
              return
  
          self.tcp_buffer = self.tcp_buffer[
              self.message_pos + self.message_size :
          ]
          self.log.debug(
              "QUEUE - slicing tcp_buffer: %s", self.tcp_buffer
          )
          self._reset_tcp_pos()
  
imports: import os
  import re
  import sys
  import typing
  from pathlib import Path
  import zmq
  from IPython.core.getipython import get_ipython
  from IPython.core.inputtransformer2 import leading_empty_lines
  from tornado.locks import Event
  from tornado.queues import Queue
  from zmq.utils import jsonapi
  from .compiler import get_file_name, get_tmp_directory, get_tmp_hash_seed
label_desc: Use image node_id 4 for calling the DebugpyMessageQueue obj's underlying member method code with example usage: obj.put_tcp_frame(frame) without return types