class_docstr: A readonly wrapper file object that add support for seeking, even if
  the wrapped file object does not. The allows us to stream from http and
  still use Pillow.
class_docstr_tok: ["A","readonly","wrapper","file","object","that","add","support","for","seeking",",","even","if","the","wrapped","file","object","does","not",".","The","allows","us","to","stream","from","http","and","still","use","Pillow","."]
code: def read(self, n=None):
      # Fix up n
      if n is None:
          pass
      else:
          n = int(n)
          if n < 0:
              n = None
  
      # Can and must we read more?
      if not self._have_all:
          more = b""
          if n is None:
              more = self.f.read()
              self._have_all = True
          else:
              want_i = self._i + n
              want_more = want_i - len(self._buffer)
              if want_more > 0:
                  more = self.f.read(want_more)
                  if len(more) < want_more:
                      self._have_all = True
          self._buffer += more
  
      # Read data from buffer and update pointer
      if n is None:
          res = self._buffer[self._i :]
      else:
          res = self._buffer[self._i : self._i + n]
      self._i += len(res)
  
      return res
  
imports: import os
  from io import BytesIO
  import zipfile
  import tempfile
  import shutil
  import enum
  import warnings
  from ..core import urlopen, get_remote_file
  from pathlib import Path
  from urllib.parse import urlparse
  from typing import Optional
label_desc: Use image node_id 2 for calling the SeekableFileObject obj's underlying member method code with example usage: obj.read(n) and returns: res