import json
import os


class DataStore(object):
    def __init__(self, storagePath="desertbot_data.json"):
        self.storagePath = storagePath
        self.data = {}
        self.load()

    def load(self):
        if not os.path.exists(self.storagePath):
            self.save()
            return
        with open(self.storagePath) as storageFile:
            self.data = json.load(storageFile)

    def save(self):
        tmpFile = "{}.tmp".format(self.storagePath)
        with open(tmpFile, "w") as storageFile:
            storageFile.write(json.dumps(self.data, indent=4))
        os.rename(tmpFile, self.storagePath)

    def __len__(self):
        return len(self.data)

    def __iter__(self):
        return iter(self.data)

    def __getitem__(self, item):
        return self.data[item]

import json
import os


class DataStore(object):
    def __init__(self, storagePath="desertbot_data.json"):
        self.storagePath = storagePath
        self.data = {}
        self.load()

    def load(self):
        if not os.path.exists(self.storagePath):
            self.save()
            return
        with open(self.storagePath) as storageFile:
            self.data = json.load(storageFile)

    def save(self):
        tmpFile = "{}.tmp".format(self.storagePath)
        with open(tmpFile, "w") as storageFile:
            storageFile.write(json.dumps(self.data, indent=4))
        os.rename(tmpFile, self.storagePath)

    def __len__(self):
        return len(self.data)

    def __iter__(self):
        return iter(self.data)

    def __getitem__(self, item):
        return self.data[item]

    def __setitem__(self, key, value):
        self.data[key] = value
    
    def __contains__(self, key):
        return key in self.data

Add setitem and contains to DataStore
Add setitem and contains to DataStore

Adding new things to the DataStore now actually works >_>
  import json
  import os
  
  
  class DataStore(object):
      def __init__(self, storagePath="desertbot_data.json"):
          self.storagePath = storagePath
          self.data = {}
          self.load()
  
      def load(self):
          if not os.path.exists(self.storagePath):
              self.save()
              return
          with open(self.storagePath) as storageFile:
              self.data = json.load(storageFile)
  
      def save(self):
          tmpFile = "{}.tmp".format(self.storagePath)
          with open(tmpFile, "w") as storageFile:
              storageFile.write(json.dumps(self.data, indent=4))
          os.rename(tmpFile, self.storagePath)
  
      def __len__(self):
          return len(self.data)
  
      def __iter__(self):
          return iter(self.data)
  
      def __getitem__(self, item):
          return self.data[item]
  
+     def __setitem__(self, key, value):
+         self.data[key] = value
+     
+     def __contains__(self, key):
+         return key in self.data
+ 
Add setitem and contains to DataStore
## Code Before:
import json
import os


class DataStore(object):
    def __init__(self, storagePath="desertbot_data.json"):
        self.storagePath = storagePath
        self.data = {}
        self.load()

    def load(self):
        if not os.path.exists(self.storagePath):
            self.save()
            return
        with open(self.storagePath) as storageFile:
            self.data = json.load(storageFile)

    def save(self):
        tmpFile = "{}.tmp".format(self.storagePath)
        with open(tmpFile, "w") as storageFile:
            storageFile.write(json.dumps(self.data, indent=4))
        os.rename(tmpFile, self.storagePath)

    def __len__(self):
        return len(self.data)

    def __iter__(self):
        return iter(self.data)

    def __getitem__(self, item):
        return self.data[item]

## Instruction:
Add setitem and contains to DataStore
## Code After:
import json
import os


class DataStore(object):
    def __init__(self, storagePath="desertbot_data.json"):
        self.storagePath = storagePath
        self.data = {}
        self.load()

    def load(self):
        if not os.path.exists(self.storagePath):
            self.save()
            return
        with open(self.storagePath) as storageFile:
            self.data = json.load(storageFile)

    def save(self):
        tmpFile = "{}.tmp".format(self.storagePath)
        with open(tmpFile, "w") as storageFile:
            storageFile.write(json.dumps(self.data, indent=4))
        os.rename(tmpFile, self.storagePath)

    def __len__(self):
        return len(self.data)

    def __iter__(self):
        return iter(self.data)

    def __getitem__(self, item):
        return self.data[item]

    def __setitem__(self, key, value):
        self.data[key] = value
    
    def __contains__(self, key):
        return key in self.data
