prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Incense being used when false
  ### Expected Behavior
  
  Don't use Incense when set to false in config
  ### Actual Behavior
  
  Bot using incense when set to false in config
  ### Your FULL config.json (remove your username, password, gmapkey and any other private info)
  
  http://pastebin.com/YEHMRMiE
  ### Output when issue occurred
  
  [2016-09-02 15:43:55] [UseIncense] [INFO] [use_incense] Using Ordinary incense. 8 incense remaining
  ### Steps to Reproduce
  
  Run bot with Incense false in config
  ### Other Information
  
  OS: Linux
  Branch: Dev
  Git Commit: 1cc9da7a79c421f11a4b13359f6a6c1abfcd061a
  Python Version: 2.7.12
  Any other relevant files/configs (eg: path files) 
  config.json
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pokemongo_bot/cell_workers/use_incense.py`
  Content:
  ```
  1 import time
  2 from pokemongo_bot.base_task import BaseTask
  3 from pokemongo_bot.worker_result import WorkerResult
  4 from pokemongo_bot.item_list import Item
  5 from pokemongo_bot import inventory
  6 
  7 class UseIncense(BaseTask):
  8     SUPPORTED_TASK_API_VERSION = 1
  9 
  10     def initialize(self):
  11       self.start_time = 0
  12       self.use_incense = self.config.get('use_incense', False)
  13       self.use_order = self.config.get('use_order', {})
  14       self._update_inventory()
  15       
  16       self.types = {
  17         401: "Ordinary",
  18         402: "Spicy",
  19         403: "Cool",
  20         404: "Floral"
  21       }
  22       
  23     def _get_type(self):
  24       for order in self.use_order:
  25           if order == "ordinary" and self.incense_ordinary_count > 0:
  26             return Item.ITEM_INCENSE_ORDINARY.value
  27           if order == "spicy" and self.incense_spicy_count > 0:
  28             return Item.ITEM_INCENSE_SPICY.value
  29           if order == "cool" and self.incense_cool_count > 0:
  30             return Item.ITEM_INCENSE_COOL.value
  31           if order == "floral" and self.incense_floral_count > 0:
  32             return Item.ITEM_INCENSE_FLORAL.value
  33             
  34       return Item.ITEM_INCENSE_ORDINARY.value 
  35     
  36     def _update_inventory(self):
  37       self.incense_ordinary_count = inventory.items().get(Item.ITEM_INCENSE_ORDINARY.value).count      
  38       self.incense_spicy_count = inventory.items().get(Item.ITEM_INCENSE_SPICY.value).count
  39       self.incense_cool_count = inventory.items().get(Item.ITEM_INCENSE_COOL.value).count      
  40       self.incense_floral_count = inventory.items().get(Item.ITEM_INCENSE_FLORAL.value).count  
  41     
  42     def _has_count(self):
  43       return self.incense_ordinary_count > 0 or self.incense_spicy_count > 0 or self.incense_cool_count > 0 or self.incense_floral_count > 0
  44             
  45     def _should_run(self):         
  46       if self._has_count() > 0 and self.start_time == 0:
  47         return True      
  48       
  49       using_incense = time.time() - self.start_time < 1800
  50       if not using_incense: 
  51         self._update_inventory()
  52         if self._has_count() and self.use_incense:
  53           return True
  54 
  55     def work(self):
  56       if self._should_run():
  57         self.start_time = time.time()
  58         type = self._get_type()        
  59         response_dict = self.bot.api.use_incense(incense_type=type)
  60         result = response_dict.get('responses', {}).get('USE_INCENSE', {}).get('result', 0)
  61         if result is 1:
  62           self.emit_event(
  63               'use_incense',
  64               formatted="Using {type} incense. {incense_count} incense remaining",
  65               data={
  66                   'type': self.types.get(type, 'Unknown'),
  67                   'incense_count': inventory.items().get(type).count
  68               }
  69           )
  70         else:
  71           self.emit_event(
  72               'use_incense',
  73               formatted="Unable to use incense {type}. {incense_count} incense remaining",
  74               data={
  75                   'type': self.types.get(type, 'Unknown'),
  76                   'incense_count': inventory.items().get(type).count
  77               }
  78           )
  79       
  80       return WorkerResult.SUCCESS
  81
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/pokemongo_bot/cell_workers/use_incense.py b/pokemongo_bot/cell_workers/use_incense.py
  --- a/pokemongo_bot/cell_workers/use_incense.py
  +++ b/pokemongo_bot/cell_workers/use_incense.py
  @@ -42,7 +42,10 @@
       def _has_count(self):
         return self.incense_ordinary_count > 0 or self.incense_spicy_count > 0 or self.incense_cool_count > 0 or self.incense_floral_count > 0
               
  -    def _should_run(self):         
  +    def _should_run(self):
  +      if not self.use_incense:
  +        return False
  +
         if self._has_count() > 0 and self.start_time == 0:
           return True
  
verification_info: {"golden_diff": "diff --git a/pokemongo_bot/cell_workers/use_incense.py b/pokemongo_bot/cell_workers/use_incense.py\n--- a/pokemongo_bot/cell_workers/use_incense.py\n+++ b/pokemongo_bot/cell_workers/use_incense.py\n@@ -42,7 +42,10 @@\n     def _has_count(self):\n       return self.incense_ordinary_count > 0 or self.incense_spicy_count > 0 or self.incense_cool_count > 0 or self.incense_floral_count > 0\n             \n-    def _should_run(self):         \n+    def _should_run(self):\n+      if not self.use_incense:\n+        return False\n+\n       if self._has_count() > 0 and self.start_time == 0:\n         return True\n", "issue": "Incense being used when false\n### Expected Behavior\n\nDon't use Incense when set to false in config\n### Actual Behavior\n\nBot using incense when set to false in config\n### Your FULL config.json (remove your username, password, gmapkey and any other private info)\n\nhttp://pastebin.com/YEHMRMiE\n### Output when issue occurred\n\n[2016-09-02 15:43:55] [UseIncense] [INFO] [use_incense] Using Ordinary incense. 8 incense remaining\n### Steps to Reproduce\n\nRun bot with Incense false in config\n### Other Information\n\nOS: Linux\nBranch: Dev\nGit Commit: 1cc9da7a79c421f11a4b13359f6a6c1abfcd061a\nPython Version: 2.7.12\nAny other relevant files/configs (eg: path files) \nconfig.json\n\n", "before_files": [{"content": "import time\nfrom pokemongo_bot.base_task import BaseTask\nfrom pokemongo_bot.worker_result import WorkerResult\nfrom pokemongo_bot.item_list import Item\nfrom pokemongo_bot import inventory\n\nclass UseIncense(BaseTask):\n    SUPPORTED_TASK_API_VERSION = 1\n\n    def initialize(self):\n      self.start_time = 0\n      self.use_incense = self.config.get('use_incense', False)\n      self.use_order = self.config.get('use_order', {})\n      self._update_inventory()\n      \n      self.types = {\n        401: \"Ordinary\",\n        402: \"Spicy\",\n        403: \"Cool\",\n        404: \"Floral\"\n      }\n      \n    def _get_type(self):\n      for order in self.use_order:\n          if order == \"ordinary\" and self.incense_ordinary_count > 0:\n            return Item.ITEM_INCENSE_ORDINARY.value\n          if order == \"spicy\" and self.incense_spicy_count > 0:\n            return Item.ITEM_INCENSE_SPICY.value\n          if order == \"cool\" and self.incense_cool_count > 0:\n            return Item.ITEM_INCENSE_COOL.value\n          if order == \"floral\" and self.incense_floral_count > 0:\n            return Item.ITEM_INCENSE_FLORAL.value\n            \n      return Item.ITEM_INCENSE_ORDINARY.value \n    \n    def _update_inventory(self):\n      self.incense_ordinary_count = inventory.items().get(Item.ITEM_INCENSE_ORDINARY.value).count      \n      self.incense_spicy_count = inventory.items().get(Item.ITEM_INCENSE_SPICY.value).count\n      self.incense_cool_count = inventory.items().get(Item.ITEM_INCENSE_COOL.value).count      \n      self.incense_floral_count = inventory.items().get(Item.ITEM_INCENSE_FLORAL.value).count  \n    \n    def _has_count(self):\n      return self.incense_ordinary_count > 0 or self.incense_spicy_count > 0 or self.incense_cool_count > 0 or self.incense_floral_count > 0\n            \n    def _should_run(self):         \n      if self._has_count() > 0 and self.start_time == 0:\n        return True      \n      \n      using_incense = time.time() - self.start_time < 1800\n      if not using_incense: \n        self._update_inventory()\n        if self._has_count() and self.use_incense:\n          return True\n\n    def work(self):\n      if self._should_run():\n        self.start_time = time.time()\n        type = self._get_type()        \n        response_dict = self.bot.api.use_incense(incense_type=type)\n        result = response_dict.get('responses', {}).get('USE_INCENSE', {}).get('result', 0)\n        if result is 1:\n          self.emit_event(\n              'use_incense',\n              formatted=\"Using {type} incense. {incense_count} incense remaining\",\n              data={\n                  'type': self.types.get(type, 'Unknown'),\n                  'incense_count': inventory.items().get(type).count\n              }\n          )\n        else:\n          self.emit_event(\n              'use_incense',\n              formatted=\"Unable to use incense {type}. {incense_count} incense remaining\",\n              data={\n                  'type': self.types.get(type, 'Unknown'),\n                  'incense_count': inventory.items().get(type).count\n              }\n          )\n      \n      return WorkerResult.SUCCESS\n", "path": "pokemongo_bot/cell_workers/use_incense.py"}], "after_files": [{"content": "import time\nfrom pokemongo_bot.base_task import BaseTask\nfrom pokemongo_bot.worker_result import WorkerResult\nfrom pokemongo_bot.item_list import Item\nfrom pokemongo_bot import inventory\n\nclass UseIncense(BaseTask):\n    SUPPORTED_TASK_API_VERSION = 1\n\n    def initialize(self):\n      self.start_time = 0\n      self.use_incense = self.config.get('use_incense', False)\n      self.use_order = self.config.get('use_order', {})\n      self._update_inventory()\n      \n      self.types = {\n        401: \"Ordinary\",\n        402: \"Spicy\",\n        403: \"Cool\",\n        404: \"Floral\"\n      }\n      \n    def _get_type(self):\n      for order in self.use_order:\n          if order == \"ordinary\" and self.incense_ordinary_count > 0:\n            return Item.ITEM_INCENSE_ORDINARY.value\n          if order == \"spicy\" and self.incense_spicy_count > 0:\n            return Item.ITEM_INCENSE_SPICY.value\n          if order == \"cool\" and self.incense_cool_count > 0:\n            return Item.ITEM_INCENSE_COOL.value\n          if order == \"floral\" and self.incense_floral_count > 0:\n            return Item.ITEM_INCENSE_FLORAL.value\n            \n      return Item.ITEM_INCENSE_ORDINARY.value \n    \n    def _update_inventory(self):\n      self.incense_ordinary_count = inventory.items().get(Item.ITEM_INCENSE_ORDINARY.value).count      \n      self.incense_spicy_count = inventory.items().get(Item.ITEM_INCENSE_SPICY.value).count\n      self.incense_cool_count = inventory.items().get(Item.ITEM_INCENSE_COOL.value).count      \n      self.incense_floral_count = inventory.items().get(Item.ITEM_INCENSE_FLORAL.value).count  \n    \n    def _has_count(self):\n      return self.incense_ordinary_count > 0 or self.incense_spicy_count > 0 or self.incense_cool_count > 0 or self.incense_floral_count > 0\n            \n    def _should_run(self):\n      if not self.use_incense:\n        return False\n\n      if self._has_count() > 0 and self.start_time == 0:\n        return True      \n      \n      using_incense = time.time() - self.start_time < 1800\n      if not using_incense: \n        self._update_inventory()\n        if self._has_count() and self.use_incense:\n          return True\n\n    def work(self):\n      if self._should_run():\n        self.start_time = time.time()\n        type = self._get_type()        \n        response_dict = self.bot.api.use_incense(incense_type=type)\n        result = response_dict.get('responses', {}).get('USE_INCENSE', {}).get('result', 0)\n        if result is 1:\n          self.emit_event(\n              'use_incense',\n              formatted=\"Using {type} incense. {incense_count} incense remaining\",\n              data={\n                  'type': self.types.get(type, 'Unknown'),\n                  'incense_count': inventory.items().get(type).count\n              }\n          )\n        else:\n          self.emit_event(\n              'use_incense',\n              formatted=\"Unable to use incense {type}. {incense_count} incense remaining\",\n              data={\n                  'type': self.types.get(type, 'Unknown'),\n                  'incense_count': inventory.items().get(type).count\n              }\n          )\n      \n      return WorkerResult.SUCCESS\n", "path": "pokemongo_bot/cell_workers/use_incense.py"}]}