From 95900ba73c4361bfd2f559f74a50df2dd04c23f2 Mon Sep 17 00:00:00 2001 From: A5rocks <40616000+A5rocks@users.noreply.github.com> Date: Sun, 3 Nov 2019 03:23:31 +0900 Subject: [PATCH] Python 2 compatibility is basically impossible. Implicit Relative Imports ruin the day here (`import logging`) and so why not ruin Python 2's day with type hinting? --- disco/util/runner.py | 3 ++- docs/bot_tutorial/programmatic_running.md | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/disco/util/runner.py b/disco/util/runner.py index 665eab1..c12a95d 100644 --- a/disco/util/runner.py +++ b/disco/util/runner.py @@ -1,3 +1,4 @@ +""" Utility module to help run a bot programmatically. Breaks in Python 2... """ import logging from gevent import monkey @@ -10,7 +11,7 @@ from disco.bot import Bot, BotConfig # noqa: E402 from disco.util.logging import setup_logging # noqa: E402 -def bot_creator(config: dict = {}, bot: bool = True, autosharded: bool = False, **kwargs): +def bot_creator(config: dict = {}, bot: bool = True, autosharded: bool = False, **kwargs): # noqa: E999 """ Create a bot object and return it to be run without the cli. diff --git a/docs/bot_tutorial/programmatic_running.md b/docs/bot_tutorial/programmatic_running.md index 1d57137..a5ce7f3 100644 --- a/docs/bot_tutorial/programmatic_running.md +++ b/docs/bot_tutorial/programmatic_running.md @@ -1,5 +1,9 @@ # CLI-less Running +{% hint style='tip' %} +This only works for Python 3. +{% endhint %} + In certain environments, it is either impossible to get to a console, or completely impractical. Even if you are not using said environments, being