docstr: After a successful read, purge the read part of buffer
docstr_tok: ["After","a","successful","read",",","purge","the","read","part","of","buffer"]
code: def purge(self) -> None:
      """
      After a successful read, purge the read part of buffer
      """
      unread = self.unread_bytes()
  
      # Only if we have read all of the buffer do we truncate, to
      # reduce the amount of memory thrashing.  This heuristic
      # can be changed or removed later.
      if unread > 0:
          return
  
      if unread > 0:
          # move unread data to the front
          view = self._buffer.getbuffer()
          view[:unread] = view[-unread:]
      self._buffer.truncate(unread)
      self._buffer.seek(0)
  
file_path: catboost/contrib/python/redis/py3/redis/_parsers/socket.py
imports: import errno
  import io
  import socket
  from io import SEEK_END
  from typing import Optional, Union
  from ..exceptions import ConnectionError, TimeoutError
  from ..utils import SSL_AVAILABLE
label_desc: Use image node_id 9 for calling the SocketBuffer obj's underlying member method code with example usage: obj.purge() without return types