mirror of
https://github.com/evennia/evennia.git
synced 2026-04-04 06:57:16 +02:00
PEP8 cleanup of the entire codebase. Unchanged are many cases of too-long lines, partly because of the rewrite they would require but also because splitting many lines up would make the code harder to read. Also the third-party libraries (idmapper, prettytable etc) were not cleaned.
This commit is contained in:
parent
30b7d2a405
commit
1ae17bcbe4
154 changed files with 5613 additions and 4054 deletions
|
|
@ -18,7 +18,8 @@ from src.commands.default.muxcommand import MuxCommand
|
|||
__all__ = ("CmdHelp", "CmdSetHelp")
|
||||
|
||||
|
||||
SEP = "{C" + "-"*78 + "{n"
|
||||
SEP = "{C" + "-" * 78 + "{n"
|
||||
|
||||
|
||||
def format_help_entry(title, help_text, aliases=None, suggested=None):
|
||||
"""
|
||||
|
|
@ -38,6 +39,7 @@ def format_help_entry(title, help_text, aliases=None, suggested=None):
|
|||
string += "\n" + SEP
|
||||
return string
|
||||
|
||||
|
||||
def format_help_list(hdict_cmds, hdict_db):
|
||||
"""
|
||||
Output a category-ordered list. The input are the
|
||||
|
|
@ -57,6 +59,7 @@ def format_help_list(hdict_cmds, hdict_db):
|
|||
string += "{G" + fill(", ".join(sorted([str(topic) for topic in hdict_db[category]]))) + "{n"
|
||||
return string
|
||||
|
||||
|
||||
class CmdHelp(Command):
|
||||
"""
|
||||
The main help command
|
||||
|
|
@ -129,13 +132,18 @@ class CmdHelp(Command):
|
|||
# try an exact command auto-help match
|
||||
match = [cmd for cmd in all_cmds if cmd == query]
|
||||
if len(match) == 1:
|
||||
self.msg(format_help_entry(match[0].key, match[0].__doc__, aliases=match[0].aliases, suggested=suggestions))
|
||||
self.msg(format_help_entry(match[0].key,
|
||||
match[0].__doc__,
|
||||
aliases=match[0].aliases,
|
||||
suggested=suggestions))
|
||||
return
|
||||
|
||||
# try an exact database help entry match
|
||||
match = list(HelpEntry.objects.find_topicmatch(query, exact=True))
|
||||
if len(match) == 1:
|
||||
self.msg(format_help_entry(match[0].key, match[0].entrytext, suggested=suggestions))
|
||||
self.msg(format_help_entry(match[0].key,
|
||||
match[0].entrytext,
|
||||
suggested=suggestions))
|
||||
return
|
||||
|
||||
# try to see if a category name was entered
|
||||
|
|
@ -147,6 +155,7 @@ class CmdHelp(Command):
|
|||
# no exact matches found. Just give suggestions.
|
||||
self.msg(format_help_entry("", "No help entry found for '%s'" % query, None, suggested=suggestions))
|
||||
|
||||
|
||||
class CmdSetHelp(MuxCommand):
|
||||
"""
|
||||
@help - edit the help database
|
||||
|
|
@ -169,9 +178,9 @@ class CmdSetHelp(MuxCommand):
|
|||
@sethelp/append pickpocketing, ,attr(is_thief) = This steals ...
|
||||
|
||||
This command manipulates the help database. A help entry can be created,
|
||||
appended/merged to and deleted. If you don't assign a category, the "General"
|
||||
category will be used. If no lockstring is specified, default is to let everyone read
|
||||
the help file.
|
||||
appended/merged to and deleted. If you don't assign a category, the
|
||||
"General" category will be used. If no lockstring is specified, default
|
||||
is to let everyone read the help file.
|
||||
|
||||
"""
|
||||
key = "@help"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue