class_docstr: A BytesIO-like object, backed by an in-memory file.
  
  This allows formatted files to be read and written without I/O.
  
  A MemoryFile created with initial bytes becomes immutable. A
  MemoryFile created without initial bytes may be written to using
  either file-like or dataset interfaces.
  
  Examples
  --------
  
  A GeoTIFF can be loaded in memory and accessed using the GeoTIFF
  format driver
  
  >>> with open('tests/data/RGB.byte.tif', 'rb') as f, MemoryFile(f) as memfile:
  ...     with memfile.open() as src:
  ...         pprint.pprint(src.profile)
  ...
  {'count': 3,
   'crs': CRS({'init': 'epsg:32618'}),
   'driver': 'GTiff',
   'dtype': 'uint8',
   'height': 718,
   'interleave': 'pixel',
   'nodata': 0.0,
   'tiled': False,
   'transform': Affine(300.0379266750948, 0.0, 101985.0,
         0.0, -300.041782729805, 2826915.0),
   'width': 791}
docstr: Create a new file in memory
  
  Parameters
  ----------
  file_or_bytes : file-like object or bytes, optional
      File or bytes holding initial data.
  filename : str, optional
      An optional filename. A unique one will otherwise be generated.
  ext : str, optional
      An optional extension.
  
  Returns
  -------
  MemoryFile
docstr_tok: ["Create","a","new","file","in","memory","Parameters","--","--","--","--","--","file_or_bytes",":","file-like","object","or","bytes",",","optional","File","or","bytes","holding","initial","data",".","filename",":","str",",","optional","An","optional","filename",".","A","unique","one","will","otherwise","be","generated",".","ext",":","str",",","optional","An","optional","extension",".","Returns","--","--","--","-","MemoryFile"]
code: def __init__(
      self, file_or_bytes=None, dirname=None, filename=None, ext=".tif"
  ):
      """Create a new file in memory
  
      Parameters
      ----------
      file_or_bytes : file-like object or bytes, optional
          File or bytes holding initial data.
      filename : str, optional
          An optional filename. A unique one will otherwise be generated.
      ext : str, optional
          An optional extension.
  
      Returns
      -------
      MemoryFile
      """
      super().__init__(
          file_or_bytes=file_or_bytes,
          dirname=dirname,
          filename=filename,
          ext=ext,
      )
  
imports: import logging
  import warnings
  from rasterio._base import get_dataset_driver, driver_can_create, driver_can_create_copy
  from rasterio._io import DatasetReaderBase, DatasetWriterBase, BufferedDatasetWriterBase, MemoryFileBase
  from rasterio.windows import WindowMethodsMixin
  from rasterio.env import ensure_env
  from rasterio.errors import RasterioDeprecationWarning
  from rasterio.transform import TransformMethodsMixin
  from rasterio._path import _UnparsedPath
label_desc: Use image node_id 1 to create a new MemoryFile object from inherited base classes: MemoryFileBase with example: obj = MemoryFile(file_or_bytes, dirname, filename, ext)