internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: opsdroid/opsdroid

Issue:
Fix no database warning message
# Description
When opsdroid is run with no databases set in the `configuration.yaml` a warning message is logged saying the following:
`"No databases in configuration. This will cause skills which store things inmemory to lose data when opsdroid is restarted."` located on [line 241](https://github.com/opsdroid/opsdroid/blob/7e0aa02595ba18121aecb67006c0980eeb62ddfb/opsdroid/loader.py#L241) in the file opsdroid.loader.

The words "in" and "memory" should have a space between them - The issue resides in line splitting without adding a blank space after the word "in".

Example:
```python
            _LOGGER.warning(_("No databases in configuration."
                              "This will cause skills which store things in"
                              "memory to lose data when opsdroid is "
                              "restarted."))
```


## Steps to Reproduce
Run opsdroid without any database configured.

## Expected Functionality
The logging message should still show up but with a space between the two words.


## Experienced Functionality
Typo in warning message.

## Versions
- **Opsdroid version:** dev
- **Python version:** 3.6
- **OS/Docker version:** OS 10.13.4

## Configuration File
Please include your version of the configuration file bellow.

```yaml
# Your code goes here.

```

## Additional Details
Any other details you wish to include such as screenshots, console messages, etc.


<!-- Love opsdroid? Please consider supporting our collective:
 +👉  https://opencollective.com/opsdroid/donate -->


Discussion:
I would try to fix this issue.

Resolving patch:
diff --git a/opsdroid/loader.py b/opsdroid/loader.py
--- a/opsdroid/loader.py
+++ b/opsdroid/loader.py
@@ -239,7 +239,7 @@ def load_modules_from_config(self, config):
             databases = self._load_modules('database', config['databases'])
         else:
             _LOGGER.warning(_("No databases in configuration."
-                              "This will cause skills which store things in"
+                              "This will cause skills which store things in "
                               "memory to lose data when opsdroid is "
                               "restarted."))
 


Test patch:
Repository: opsdroid/opsdroid

Issue:
Databases fail to load under 0.12
<!-- Before you post an issue or if you are unsure about something join our gitter channel https://gitter.im/opsdroid/ and ask away! We are more than happy to help you. -->
# Description

When I configure opsdroid to use a database (tested with the matrix or mongo database) I get the following error:

```
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.6/site-packages/opsdroid/__main__.py", line 201, in <module>
    init()
  File "/usr/local/lib/python3.6/site-packages/opsdroid/__main__.py", line 198, in init
    main()
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/opsdroid/__main__.py", line 192, in main
    opsdroid.start_loop()
  File "/usr/local/lib/python3.6/site-packages/opsdroid/core.py", line 131, in start_loop
    self.loader.load_modules_from_config(self.config)
  File "/usr/local/lib/python3.6/site-packages/opsdroid/loader.py", line 266, in load_modules_from_config
    databases = self._load_modules('database', config['databases'])
  File "/usr/local/lib/python3.6/site-packages/opsdroid/loader.py", line 311, in _load_modules
    config["is_builtin"] = self.is_builtin_module(config)
  File "/usr/local/lib/python3.6/site-packages/opsdroid/loader.py", line 94, in is_builtin_module
    module_name=config["name"]
  File "/usr/local/lib/python3.6/importlib/util.py", line 89, in find_spec
    return _find_spec(fullname, parent.__path__)
AttributeError: module 'opsdroid.database' has no attribute '__path__'
```


## Steps to Reproduce

start opsdroid with a database config section.


## Expected Functionality

The database should load


## Experienced Functionality

opsdroid crashes

## Versions
- **Opsdroid version:** 0.12.1
- **Python version:** 3.6 (conda)
- **OS/Docker version:** arch inux


Discussion:
Thanks for raising this! 
I tried to work out why it was going wrong, but everything I did lead to new and even more incomprehensible errors lol

Resolving patch:
diff --git a/opsdroid/database.py b/opsdroid/database/__init__.py
similarity index 100%
rename from opsdroid/database.py
rename to opsdroid/database/__init__.py


Test patch:
Repository: opsdroid/opsdroid

Issue:
Add Python 3.7 support
We need to update opsdroid to be fully supported in 3.7.

- [x] Test against Python 3.7.
  - [x] Travis
  - [x] AppVeyor
- [x] Fix any bugs highlighted.
- [x] Add 3.7 to supported versions in `setup.py`.
- [ ] ~Update docker base image to be latest supported version~.


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -72,6 +72,7 @@ def run(self):
         'Programming Language :: Python :: 3 :: Only',
         'Programming Language :: Python :: 3.5',
         'Programming Language :: Python :: 3.6',
+        'Programming Language :: Python :: 3.7',
         'Topic :: Communications :: Chat',
         'Topic :: Scientific/Engineering :: Artificial Intelligence',
         'Topic :: Software Development :: Libraries :: Python Modules'


Test patch:
Repository: opsdroid/opsdroid

Issue:
Pass config to skill setup method
# Description
When running the `setup` method of a skill only a pointer to opsdroid is passed, the config for that skill should be passed too. See the [call here](https://github.com/opsdroid/opsdroid/blob/master/opsdroid/core.py#L153).




Discussion:
Hi, I'm a first-time contributor, and would like to work on this. Would that be alright?
Hello @RonitRay  that would be amazing if you could work on this issue. Please let us know if you need any help 👍 
Great!
So, from what I understand, the call is
`skill["module"].setup(self)`

and you require it to be
`skill["module"].setup(self, self.config)`

is that right or am I approaching this the wrong way?
Yep that looks right to me. If you raise a Pull Request we can always review it there. 

Resolving patch:
diff --git a/opsdroid/core.py b/opsdroid/core.py
--- a/opsdroid/core.py
+++ b/opsdroid/core.py
@@ -147,10 +147,18 @@ def start_loop(self):
             self.eventloop.close()
 
     def setup_skills(self, skills):
-        """Call the setup function on the passed in skills."""
+        """Call the setup function on the loaded skills.
+
+        Iterates through all the skills which have been loaded and runs
+        any setup functions which have been defined in the skill.
+
+        Args:
+            skills (list): A list of all the loaded skills.
+
+        """
         with contextlib.suppress(AttributeError):
             for skill in skills:
-                skill["module"].setup(self)
+                skill["module"].setup(self, self.config)
 
     def train_parsers(self, skills):
         """Train the parsers."""


Test patch:
diff --git a/tests/test_core.py b/tests/test_core.py
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -6,6 +6,7 @@
 import asynctest.mock as amock
 import importlib
 
+from opsdroid.__main__ import configure_lang
 from opsdroid.core import OpsDroid
 from opsdroid.message import Message
 from opsdroid.connector import Connector
@@ -19,6 +20,7 @@ class TestCore(unittest.TestCase):
 
     def setUp(self):
         self.previous_loop = asyncio.get_event_loop()
+        configure_lang({})
 
     def tearDown(self):
         self.previous_loop.close()
@@ -148,6 +150,9 @@ def test_setup_modules(self):
             example_modules.append({"module": {"name": "test"}})
             opsdroid.setup_skills(example_modules)
             self.assertEqual(len(example_modules[0]["module"].mock_calls), 1)
+            self.assertEqual(example_modules[0]['module'].method_calls[0][0], 'setup')
+            self.assertEqual(len(example_modules[0]['module'].method_calls[0][1]), 2)
+            self.assertEqual(example_modules[0]['module'].method_calls[0][1][1], {})
 
     def test_default_connector(self):
         with OpsDroid() as opsdroid:
Repository: opsdroid/opsdroid

Issue:
Application hangs on kill if connector doesn't disconnect
If a connector doesn't honour the disconnect method opsdroid can hang on shutdown. We should force kill connectors after 30 seconds after disconnect is called. 


Discussion:

Resolving patch:
diff --git a/opsdroid/core.py b/opsdroid/core.py
--- a/opsdroid/core.py
+++ b/opsdroid/core.py
@@ -185,6 +185,13 @@ async def unload(self, future=None):
         self.cron_task = None
         _LOGGER.info(_("Stopped cron"))
 
+        _LOGGER.info(_("Stopping pending tasks..."))
+        tasks = asyncio.Task.all_tasks()
+        for task in list(tasks):
+            if not task.done() and task is not asyncio.Task.current_task():
+                task.cancel()
+        _LOGGER.info(_("Stopped pending tasks"))
+
     async def reload(self):
         """Reload opsdroid."""
         await self.unload()


Test patch:
diff --git a/tests/test_core.py b/tests/test_core.py
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -247,8 +247,14 @@ async def test_unload(self):
             opsdroid.cron_task.cancel = amock.CoroutineMock()
             mock_cron_task = opsdroid.cron_task
 
+            async def task():
+                await asyncio.sleep(.5)
+
+            t = asyncio.Task(task(), loop=self.loop)
+
             await opsdroid.unload()
 
+            self.assertTrue(t.cancel())
             self.assertTrue(mock_connector.disconnect.called)
             self.assertTrue(mock_database.disconnect.called)
             self.assertTrue(mock_web_server.stop.called)
Repository: opsdroid/opsdroid

Issue:
Cannot disconnect from SQLite
<!-- Before you post an issue or if you are unsure about something join our gitter channel https://gitter.im/opsdroid/ and ask away! We are more than happy to help you. -->
# Description
SQLite database connector can’t disconnect because of wrong method signature.

## Steps to Reproduce
Enable the SQLite database module, then try to shut down the bot.


## Expected Functionality
The bot should shut down.

## Experienced Functionality
This error message on the console, and the bot remains running (but with the connectors already disconnected).

```
ERROR opsdroid.core: {'message': 'Task exception was never retrieved', 'exception': TypeError('disconnect() takes 1 positional argument but 2 were given',), 'future': <Task finished coro=<OpsDroid.handle_signal() done, defined at /home/polesz/.local/lib/python3.6/site-packages/opsdroid/core.py:121> exception=TypeError('disconnect() takes 1 positional argument but 2 were given',)>}
```

## Versions
- **Opsdroid version:** 0.13.0
- **Python version:** 3.6.6 (bundled with Fedora 28)
- **OS/Docker version:** Fedora 28, no Docker involved

## Additional information
It seems the method signature of `Database.disconnect()` is wrong (should be `async def disconnect(self, opsdroid)`) or the caller (`OpsDroid.unload()`) should not pass the `opsdroid` instance to `database.disconnect()` (personally i’d vote for the former).


Discussion:
Thank you for raising this, as soon as #728 gets merged into opsdroid, this issue will be fixed. 
Looking deeper into this it seems to affect mongo and redis, too, as neither of them override the default `disconnect()` method.

Resolving patch:
diff --git a/opsdroid/database/__init__.py b/opsdroid/database/__init__.py
--- a/opsdroid/database/__init__.py
+++ b/opsdroid/database/__init__.py
@@ -40,7 +40,7 @@ async def connect(self, opsdroid):
         """
         raise NotImplementedError
 
-    async def disconnect(self):
+    async def disconnect(self, opsdroid):
         """Disconnect from the database.
 
         This method should disconnect from the given database using a native


Test patch:
diff --git a/tests/test_database.py b/tests/test_database.py
--- a/tests/test_database.py
+++ b/tests/test_database.py
@@ -26,7 +26,7 @@ async def test_connect(self):
     async def test_disconnect(self):
         database = Database({})
         try:
-            await database.disconnect()
+            await database.disconnect(None)
         except NotImplementedError:
             self.fail("disconnect() raised NotImplementedError unexpectedly!")
Repository: opsdroid/opsdroid

Issue:
Matrix Connector should not log HTML page contents on a 504
If the matrix server responds with a 504 error on `/sync` (which is pretty common) the connector should not log the whole HTML page, as it clutters the log.

This is *especially* true on a matrix.org account as you get a whole cloudflare error page.
Matrix Connector should not log HTML page contents on a 504
If the matrix server responds with a 504 error on `/sync` (which is pretty common) the connector should not log the whole HTML page, as it clutters the log.

This is *especially* true on a matrix.org account as you get a whole cloudflare error page.


Discussion:

Resolving patch:
diff --git a/opsdroid/connector/matrix/connector.py b/opsdroid/connector/matrix/connector.py
--- a/opsdroid/connector/matrix/connector.py
+++ b/opsdroid/connector/matrix/connector.py
@@ -142,6 +142,14 @@ async def listen(self):  # pragma: no cover
                 message = await self._parse_sync_response(response)
                 await self.opsdroid.parse(message)
 
+            except MatrixRequestError as mre:
+                # We can safely ignore timeout errors. The non-standard error
+                # codes are returned by Cloudflare.
+                if mre.code in [504, 522, 524]:
+                    _LOGGER.info('Matrix Sync Timeout (code: %d)', mre.code)
+                    continue
+
+                _LOGGER.exception('Matrix Sync Error')
             except CancelledError:
                 raise
             except Exception:  # pylint: disable=W0703


Test patch:
Repository: opsdroid/opsdroid

Issue:
Opsdroid installs connector from repository instead of core
<!-- Before you post an issue or if you are unsure about something join our gitter channel https://gitter.im/opsdroid/ and ask away! We are more than happy to help you. -->
# Description
I have got my hands on a raspberry pi 3 and decided to install opsdroid on it and keep it on permanently. I had set up the Slack and Telegram connector, but  I kept getting the exception:

```python
(...)
  File "/usr/local/lib/python3.6/site-packages/opsdroid/core.py", line 279, in start_connectors
    connector = cls(connector_module["config"], self)
TypeError: __init__() takes 2 positional arguments but 3 were given
```

I had to do a bit of digging in order to try and figure out why this was happening since I installed opsdroid from pip. Also, on my Kali machine, it worked just fine.

After checking the `config.yaml` I've noticed that in the Kali machine `telegram` was spelt with a lower `t` whilst the raspberry one was with a capital `T`. 

Apparently, typing `- name: Telegram` will clone the telegram connector from the deprecated repo, but typing `- name: telegram` will use the one in core.

I haven't tested 
## Steps to Reproduce
- Add any connector that has been merged to the core.
- Set up the connector in `config.yaml` starting with capital letter (`- name: Slack`)
- Run opsdroid
- The exception occurs because opsdroid downloaded the deprecated repository


## Expected Functionality
Opsdroid should install the newer version of the connector that has been merged to the core.


## Experienced Functionality
Explain what happened instead(Please include the debug log).

## Versions
- **Opsdroid version:** stable
- **Python version:** 3.6
- **OS/Docker version:** raspbian


<!-- Love opsdroid? Please consider supporting our collective:
 +👉  https://opencollective.com/opsdroid/donate -->


Discussion:

Resolving patch:
diff --git a/opsdroid/loader.py b/opsdroid/loader.py
--- a/opsdroid/loader.py
+++ b/opsdroid/loader.py
@@ -105,7 +105,7 @@ def is_builtin_module(config):
             return importlib.util.find_spec(
                 'opsdroid.{module_type}.{module_name}'.format(
                     module_type=config["type"],
-                    module_name=config["name"]
+                    module_name=config["name"].lower()
                 )
             )
         except ImportError:
@@ -116,7 +116,7 @@ def build_module_import_path(config):
         """Generate the module import path from name and type."""
         if config["is_builtin"]:
             return "opsdroid" + "." + config["type"] + \
-                "." + config["name"]
+                "." + config["name"].lower()
         return MODULES_DIRECTORY + "." + config["type"] + \
             "." + config["name"]
 


Test patch:
Repository: opsdroid/opsdroid

Issue:
Matrix connector tries to parse empty messages
Talked about this in opsdroid-general: the matrix connector tries to parse empty messages (like ones sent from the bot itself). We should avoid this by checking that the message is not `None` before parsing. Cadair pointed out that we can do this with `if message:` above L143 in the connector. 

https://github.com/opsdroid/opsdroid/blob/11508b513ea563a58fc95581b7032256449c65c1/opsdroid/connector/matrix/connector.py#L143


Discussion:

Resolving patch:
diff --git a/opsdroid/connector/matrix/connector.py b/opsdroid/connector/matrix/connector.py
--- a/opsdroid/connector/matrix/connector.py
+++ b/opsdroid/connector/matrix/connector.py
@@ -140,7 +140,8 @@ async def listen(self):  # pragma: no cover
                     filter=self.filter_id)
                 _LOGGER.debug("matrix sync request returned")
                 message = await self._parse_sync_response(response)
-                await self.opsdroid.parse(message)
+                if message:
+                    await self.opsdroid.parse(message)
 
             except MatrixRequestError as mre:
                 # We can safely ignore timeout errors. The non-standard error
@@ -201,7 +202,7 @@ def _get_formatted_message_body(message, body=None, msgtype="m.text"):
             "msgtype": msgtype,
             "format": "org.matrix.custom.html",
             "formatted_body": clean_html
-            }
+        }
 
     @register_event(Message)
     async def send_message(self, message):


Test patch:
Repository: opsdroid/opsdroid

Issue:
Add time to crontab log message
When the cron parser is triggered it emits a debug log saying `Running crontab skills`.

It would be more useful if it included the time that opsdroid thinks it is. This would help when trying to debug issues where skills are triggered at the wrong time due to opsdroid having the wrong timezone.

The line which needs updating is [here](https://github.com/opsdroid/opsdroid/blob/master/opsdroid/parsers/crontab.py#L17). 


Discussion:

Resolving patch:
diff --git a/opsdroid/parsers/crontab.py b/opsdroid/parsers/crontab.py
--- a/opsdroid/parsers/crontab.py
+++ b/opsdroid/parsers/crontab.py
@@ -1,5 +1,5 @@
 """A helper function for parsing and executing crontab skills."""
-
+import time
 import asyncio
 import logging
 
@@ -14,7 +14,7 @@ async def parse_crontab(opsdroid):
     """Parse all crontab skills against the current time."""
     while opsdroid.eventloop.is_running():
         await asyncio.sleep(60 - arrow.now().time().second)
-        _LOGGER.debug(_("Running crontab skills"))
+        _LOGGER.debug(_("Running crontab skills at %s "), time.asctime())
         for skill in opsdroid.skills:
             for matcher in skill.matchers:
                 if "crontab" in matcher:


Test patch:
Repository: opsdroid/opsdroid

Issue:
Make web server default to all networks
Currently the opsdroid web server is only served on `127.0.0.1` by default. In order to make opsdroid accessible via other networks you much set the `web.host` config option to something else (usually `0.0.0.0`).

This can be misleading for new users and is also causing problems when running on more complex infrastructure like Kubernetes.

I propose that the default is changed to `0.0.0.0` which resolves up front issues but still allows users to lock things down to specific networks if they choose.


Discussion:

Resolving patch:
diff --git a/opsdroid/web.py b/opsdroid/web.py
--- a/opsdroid/web.py
+++ b/opsdroid/web.py
@@ -64,7 +64,7 @@ def get_host(self):
         try:
             host = self.config["host"]
         except KeyError:
-            host = '127.0.0.1'
+            host = '0.0.0.0'
         return host
 
     @property


Test patch:
diff --git a/tests/test_web.py b/tests/test_web.py
--- a/tests/test_web.py
+++ b/tests/test_web.py
@@ -38,11 +38,11 @@ async def test_web_get_host(self):
         with OpsDroid() as opsdroid:
             opsdroid.config["web"] = {}
             app = web.Web(opsdroid)
-            self.assertEqual(app.get_host, "127.0.0.1")
+            self.assertEqual(app.get_host, "0.0.0.0")
 
-            opsdroid.config["web"] = {"host": "0.0.0.0"}
+            opsdroid.config["web"] = {"host": "127.0.0.1"}
             app = web.Web(opsdroid)
-            self.assertEqual(app.get_host, "0.0.0.0")
+            self.assertEqual(app.get_host, "127.0.0.1")
 
     async def test_web_get_ssl(self):
         """Check the host getter."""
Repository: opsdroid/opsdroid

Issue:
PyPI deployments are failing
Looks like PyPI deployments are failing. `v0.15.1` and `v0.15.2` haven't gone out.

```
HTTPError: 400 Client Error: The description failed to render in the default format of reStructuredText. See https://pypi.org/help/#description-content-type for more information. for url: https://upload.pypi.org/legacy/
```
PyPI deployments are failing
Looks like PyPI deployments are failing. `v0.15.1` and `v0.15.2` haven't gone out.

```
HTTPError: 400 Client Error: The description failed to render in the default format of reStructuredText. See https://pypi.org/help/#description-content-type for more information. for url: https://upload.pypi.org/legacy/
```


Discussion:
Looks [related](https://github.com/pypa/warehouse/issues/4079#issuecomment-420929642) to the py35 setuptools issue. #941
Looks [related](https://github.com/pypa/warehouse/issues/4079#issuecomment-420929642) to the py35 setuptools issue. #941

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -55,6 +55,7 @@ def run(self):
     author_email='jacob@tom.linson.uk',
     description='An open source ChatOps bot framework.',
     long_description=README,
+    long_description_content_type='text/markdown',
     packages=PACKAGES,
     include_package_data=True,
     zip_safe=False,


Test patch: