From 4b3eef1e5dbadce02acba3a33e80a4f4aed71089 Mon Sep 17 00:00:00 2001 From: Sam W Date: Tue, 13 Feb 2018 17:17:28 +0000 Subject: changed commented examples to docstrings --- bot/formatter.py | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/bot/formatter.py b/bot/formatter.py index 8fc5a8482..e01c03b29 100644 --- a/bot/formatter.py +++ b/bot/formatter.py @@ -18,10 +18,12 @@ class Formatter(HelpFormatter): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - # basically the same function but changed: - # - to make the helptext appear as a comment - # - to change the indentation to the PEP8 standard: 4 spaces def _add_subcommands_to_page(self, max_width, commands): + """ + basically the same function from d.py but changed: + - to make the helptext appear as a comment + - to change the indentation to the PEP8 standard: 4 spaces + """ for name, command in commands: if name in command.aliases: # skip aliases @@ -32,18 +34,27 @@ class Formatter(HelpFormatter): self._paginator.add_line(shortened) async def format(self): + """ + rewritten help command to make it more python-y + + example of specific command: + async def (ctx, ): + \""" + + \""" + await do_(ctx, ) + + example of standard help page: + class : + bot.() # + class : + bot.() # + + # + """ self._paginator = Paginator(prefix="```py") if isinstance(self.command, Command): - # help on a specific command to look like an async function - - # example: - # async def (ctx, ): - # """ - # - # """ - # await do_(ctx, ) - # strip the command of bot. and () stripped_command = self.command.name.replace(HELP_PREFIX, "").replace("()", "") # getting args using the handy inspect module @@ -63,14 +74,6 @@ class Formatter(HelpFormatter): return self._paginator.pages - # if not a specific command, help page will be in the format: - # class : - # bot.() # - # class : - # bot.() # - # - # # - max_width = self.max_name_size def category_check(tup): -- cgit v1.2.3