prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Check for base classes instead of name when importing connectors and databases
  Currently you must give your connector or database class a specific name for them to be imported.
  
  Now that these classes should inherit from the base classes we can test for `isinstance(baseclass)` instead.
  
  
  </issue>
  <code>
  [start of opsdroid/core.py]
  1 """Core components of OpsDroid."""
  2 
  3 import logging
  4 import sys
  5 import weakref
  6 from multiprocessing import Process
  7 from opsdroid.helper import match
  8 from opsdroid.memory import Memory
  9 
  10 
  11 class OpsDroid():
  12     """Root object for opsdroid."""
  13 
  14     instances = []
  15 
  16     def __init__(self):
  17         """Start opsdroid."""
  18         self.bot_name = 'opsdroid'
  19         self.sys_status = 0
  20         self.connectors = []
  21         self.connector_jobs = []
  22         self.skills = []
  23         self.memory = Memory()
  24         logging.info("Created main opsdroid object")
  25 
  26     def __enter__(self):
  27         """Add self to existing instances."""
  28         if len(self.__class__.instances) == 0:
  29             self.__class__.instances.append(weakref.proxy(self))
  30         else:
  31             self.critical("opsdroid has already been started", 1)
  32         return self
  33 
  34     def __exit__(self, exc_type, exc_value, traceback):
  35         """Remove self from existing instances."""
  36         self.__class__.instances = []
  37 
  38     def exit(self):
  39         """Exit application."""
  40         logging.info("Exiting application with return code " +
  41                      str(self.sys_status))
  42         sys.exit(self.sys_status)
  43 
  44     def critical(self, error, code):
  45         """Exit due to unrecoverable error."""
  46         self.sys_status = code
  47         logging.critical(error)
  48         print("Error: " + error)
  49         self.exit()
  50 
  51     def start_connectors(self, connectors):
  52         """Start the connectors."""
  53         if len(connectors) == 0:
  54             self.critical("All connectors failed to load", 1)
  55         elif len(connectors) == 1:
  56             for name, cls in connectors[0]["module"].__dict__.items():
  57                 if isinstance(cls, type) and "Connector" in name:
  58                     connectors[0]["config"]["bot-name"] = self.bot_name
  59                     connector = cls(connectors[0]["config"])
  60                     self.connectors.append(connector)
  61                     connector.connect(self)
  62         else:
  63             for connector_module in connectors:
  64                 for name, cls in connector_module["module"].__dict__.items():
  65                     if isinstance(cls, type) and "Connector" in name:
  66                         connector_module["config"]["bot-name"] = self.bot_name
  67                         connector = cls(connector_module["config"])
  68                         self.connectors.append(connector)
  69                         job = Process(target=connector.connect, args=(self,))
  70                         job.start()
  71                         self.connector_jobs.append(job)
  72             for job in self.connector_jobs:
  73                 job.join()
  74 
  75     def start_databases(self, databases):
  76         """Start the databases."""
  77         if len(databases) == 0:
  78             logging.warning("All databases failed to load")
  79         for database_module in databases:
  80             for name, cls in database_module["module"].__dict__.items():
  81                 if isinstance(cls, type) and "Database" in name:
  82                     logging.debug("Adding database: " + name)
  83                     database = cls(database_module["config"])
  84                     self.memory.databases.append(database)
  85                     database.connect()
  86 
  87     def load_regex_skill(self, regex, skill):
  88         """Load skills."""
  89         self.skills.append({"regex": regex, "skill": skill})
  90 
  91     def parse(self, message):
  92         """Parse a string against all skills."""
  93         if message.text.strip() != "":
  94             logging.debug("Parsing input: " + message.text)
  95             for skill in self.skills:
  96                 if "regex" in skill:
  97                     regex = match(skill["regex"], message.text)
  98                     if regex:
  99                         message.regex = regex
  100                         skill["skill"](self, message)
  101
  [end of opsdroid/core.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/opsdroid/core.py b/opsdroid/core.py
  --- a/opsdroid/core.py
  +++ b/opsdroid/core.py
  @@ -6,6 +6,8 @@
   from multiprocessing import Process
   from opsdroid.helper import match
   from opsdroid.memory import Memory
  +from opsdroid.connector import Connector
  +from opsdroid.database import Database
   
   
   class OpsDroid():
  @@ -54,7 +56,9 @@
               self.critical("All connectors failed to load", 1)
           elif len(connectors) == 1:
               for name, cls in connectors[0]["module"].__dict__.items():
  -                if isinstance(cls, type) and "Connector" in name:
  +                if isinstance(cls, type) and \
  +                   isinstance(cls({}), Connector):
  +                    logging.debug("Adding connector: " + name)
                       connectors[0]["config"]["bot-name"] = self.bot_name
                       connector = cls(connectors[0]["config"])
                       self.connectors.append(connector)
  @@ -62,7 +66,8 @@
           else:
               for connector_module in connectors:
                   for name, cls in connector_module["module"].__dict__.items():
  -                    if isinstance(cls, type) and "Connector" in name:
  +                    if isinstance(cls, type) and \
  +                       isinstance(cls({}), Connector):
                           connector_module["config"]["bot-name"] = self.bot_name
                           connector = cls(connector_module["config"])
                           self.connectors.append(connector)
  @@ -78,11 +83,12 @@
               logging.warning("All databases failed to load")
           for database_module in databases:
               for name, cls in database_module["module"].__dict__.items():
  -                if isinstance(cls, type) and "Database" in name:
  +                if isinstance(cls, type) and \
  +                   isinstance(cls({}), Database):
                       logging.debug("Adding database: " + name)
                       database = cls(database_module["config"])
                       self.memory.databases.append(database)
  -                    database.connect()
  +                    database.connect(self)
   
       def load_regex_skill(self, regex, skill):
           """Load skills."""
  
verification_info: {"golden_diff": "diff --git a/opsdroid/core.py b/opsdroid/core.py\n--- a/opsdroid/core.py\n+++ b/opsdroid/core.py\n@@ -6,6 +6,8 @@\n from multiprocessing import Process\n from opsdroid.helper import match\n from opsdroid.memory import Memory\n+from opsdroid.connector import Connector\n+from opsdroid.database import Database\n \n \n class OpsDroid():\n@@ -54,7 +56,9 @@\n             self.critical(\"All connectors failed to load\", 1)\n         elif len(connectors) == 1:\n             for name, cls in connectors[0][\"module\"].__dict__.items():\n-                if isinstance(cls, type) and \"Connector\" in name:\n+                if isinstance(cls, type) and \\\n+                   isinstance(cls({}), Connector):\n+                    logging.debug(\"Adding connector: \" + name)\n                     connectors[0][\"config\"][\"bot-name\"] = self.bot_name\n                     connector = cls(connectors[0][\"config\"])\n                     self.connectors.append(connector)\n@@ -62,7 +66,8 @@\n         else:\n             for connector_module in connectors:\n                 for name, cls in connector_module[\"module\"].__dict__.items():\n-                    if isinstance(cls, type) and \"Connector\" in name:\n+                    if isinstance(cls, type) and \\\n+                       isinstance(cls({}), Connector):\n                         connector_module[\"config\"][\"bot-name\"] = self.bot_name\n                         connector = cls(connector_module[\"config\"])\n                         self.connectors.append(connector)\n@@ -78,11 +83,12 @@\n             logging.warning(\"All databases failed to load\")\n         for database_module in databases:\n             for name, cls in database_module[\"module\"].__dict__.items():\n-                if isinstance(cls, type) and \"Database\" in name:\n+                if isinstance(cls, type) and \\\n+                   isinstance(cls({}), Database):\n                     logging.debug(\"Adding database: \" + name)\n                     database = cls(database_module[\"config\"])\n                     self.memory.databases.append(database)\n-                    database.connect()\n+                    database.connect(self)\n \n     def load_regex_skill(self, regex, skill):\n         \"\"\"Load skills.\"\"\"\n", "issue": "Check for base classes instead of name when importing connectors and databases\nCurrently you must give your connector or database class a specific name for them to be imported.\n\nNow that these classes should inherit from the base classes we can test for `isinstance(baseclass)` instead.\n\n", "before_files": [{"content": "\"\"\"Core components of OpsDroid.\"\"\"\n\nimport logging\nimport sys\nimport weakref\nfrom multiprocessing import Process\nfrom opsdroid.helper import match\nfrom opsdroid.memory import Memory\n\n\nclass OpsDroid():\n    \"\"\"Root object for opsdroid.\"\"\"\n\n    instances = []\n\n    def __init__(self):\n        \"\"\"Start opsdroid.\"\"\"\n        self.bot_name = 'opsdroid'\n        self.sys_status = 0\n        self.connectors = []\n        self.connector_jobs = []\n        self.skills = []\n        self.memory = Memory()\n        logging.info(\"Created main opsdroid object\")\n\n    def __enter__(self):\n        \"\"\"Add self to existing instances.\"\"\"\n        if len(self.__class__.instances) == 0:\n            self.__class__.instances.append(weakref.proxy(self))\n        else:\n            self.critical(\"opsdroid has already been started\", 1)\n        return self\n\n    def __exit__(self, exc_type, exc_value, traceback):\n        \"\"\"Remove self from existing instances.\"\"\"\n        self.__class__.instances = []\n\n    def exit(self):\n        \"\"\"Exit application.\"\"\"\n        logging.info(\"Exiting application with return code \" +\n                     str(self.sys_status))\n        sys.exit(self.sys_status)\n\n    def critical(self, error, code):\n        \"\"\"Exit due to unrecoverable error.\"\"\"\n        self.sys_status = code\n        logging.critical(error)\n        print(\"Error: \" + error)\n        self.exit()\n\n    def start_connectors(self, connectors):\n        \"\"\"Start the connectors.\"\"\"\n        if len(connectors) == 0:\n            self.critical(\"All connectors failed to load\", 1)\n        elif len(connectors) == 1:\n            for name, cls in connectors[0][\"module\"].__dict__.items():\n                if isinstance(cls, type) and \"Connector\" in name:\n                    connectors[0][\"config\"][\"bot-name\"] = self.bot_name\n                    connector = cls(connectors[0][\"config\"])\n                    self.connectors.append(connector)\n                    connector.connect(self)\n        else:\n            for connector_module in connectors:\n                for name, cls in connector_module[\"module\"].__dict__.items():\n                    if isinstance(cls, type) and \"Connector\" in name:\n                        connector_module[\"config\"][\"bot-name\"] = self.bot_name\n                        connector = cls(connector_module[\"config\"])\n                        self.connectors.append(connector)\n                        job = Process(target=connector.connect, args=(self,))\n                        job.start()\n                        self.connector_jobs.append(job)\n            for job in self.connector_jobs:\n                job.join()\n\n    def start_databases(self, databases):\n        \"\"\"Start the databases.\"\"\"\n        if len(databases) == 0:\n            logging.warning(\"All databases failed to load\")\n        for database_module in databases:\n            for name, cls in database_module[\"module\"].__dict__.items():\n                if isinstance(cls, type) and \"Database\" in name:\n                    logging.debug(\"Adding database: \" + name)\n                    database = cls(database_module[\"config\"])\n                    self.memory.databases.append(database)\n                    database.connect()\n\n    def load_regex_skill(self, regex, skill):\n        \"\"\"Load skills.\"\"\"\n        self.skills.append({\"regex\": regex, \"skill\": skill})\n\n    def parse(self, message):\n        \"\"\"Parse a string against all skills.\"\"\"\n        if message.text.strip() != \"\":\n            logging.debug(\"Parsing input: \" + message.text)\n            for skill in self.skills:\n                if \"regex\" in skill:\n                    regex = match(skill[\"regex\"], message.text)\n                    if regex:\n                        message.regex = regex\n                        skill[\"skill\"](self, message)\n", "path": "opsdroid/core.py"}]}