code: def __init__(self, filebasename, mode, flag="c"):
      filebasename = self._os.fsencode(filebasename)
      self._mode = mode
      self._readonly = flag == "r"
  
      # The directory file is a text file.  Each line looks like
      #    "%r, (%d, %d)\n" % (key, pos, siz)
      # where key is the string key, pos is the offset into the dat
      # file of the associated value's first byte, and siz is the number
      # of bytes in the associated value.
      self._dirfile = filebasename + b".dir"
  
      # The data file is a binary file pointed into by the directory
      # file, and holds the values associated with keys.  Each value
      # begins at a _BLOCKSIZE-aligned byte offset, and is a raw
      # binary 8-bit string value.
      self._datfile = filebasename + b".dat"
      self._bakfile = filebasename + b".bak"
  
      # The index is an in-memory dict, mirroring the directory file.
      self._index = None  # maps keys to (pos, siz) pairs
  
      # Handle the creation
      self._create(flag)
      self._update(flag)
  
imports: import ast
  import io
  import os
  import collections.abc
label_desc: Use image node_id 1 to create a new _Database object from inherited base classes: collections.abc with example: obj = _Database(filebasename, mode, flag)