Minor cleanup for docstring to more succinct

This commit is contained in:
Griatch 2024-04-01 20:24:32 +02:00
parent 798d5b3059
commit c4552d6953
3 changed files with 9 additions and 33 deletions

View file

@ -20,6 +20,8 @@
- [Feature][pull3466]: Add optional `no_article` kwarg to
`DefaultObject.get_numbered_name` for the system to skip adding automatic
articles. (chiizujin)
- [Feature][pull3433]: Add ability to default get/drop to affect stacks of
items, such as `get/drop 3 rock` by a custom class parent (InspectorCaracal)
- Feature: Clean up the default Command variable list shown when a command has
no `func()` defined (Griatch)
- [Feature][issue3461]: Add `DefaultObject.filter_display_visible` helper method
@ -61,6 +63,7 @@
[pull3464]: https://github.com/evennia/evennia/pull/3464
[pull3466]: https://github.com/evennia/evennia/pull/3466
[pull3467]: https://github.com/evennia/evennia/pull/3467
[pull3433]: https://github.com/evennia/evennia/pull/3433
[issue3450]: https://github.com/evennia/evennia/issues/3450
[issue3462]: https://github.com/evennia/evennia/issues/3462
[issue3460]: https://github.com/evennia/evennia/issues/3460

View file

@ -31,6 +31,7 @@ value - which may change as Evennia is developed. This way you can
always be sure of what you have changed and what is default behaviour.
"""
import os
import sys

View file

@ -4,9 +4,8 @@ General Character commands usually available to all characters
import re
from django.conf import settings
import evennia
from django.conf import settings
from evennia.typeclasses.attributes import NickTemplateInvalid
from evennia.utils import utils
@ -385,43 +384,16 @@ class NumberedTargetCommand(COMMAND_DEFAULT_CLASS):
A class that parses out an optional number component from the input string. This
class is intended to be inherited from to provide additional functionality, rather
than used on its own.
Note that the class's __doc__ string (this text) is used by Evennia to create the
automatic help entry for the command, so make sure to document consistently here.
"""
def parse(self):
"""
This method is called by the cmdhandler once the command name
has been identified. It creates a new set of member variables
that can be later accessed from self.func() (see below)
Parser that extracts a `.number` property from the beginning of the input string.
The following variables are available for our use when entering this
method (from the command definition, and assigned on the fly by the
cmdhandler):
self.key - the name of this command ('look')
self.aliases - the aliases of this cmd ('l')
self.permissions - permission string for this command
self.help_category - overall category of command
For example, if the input string is "3 apples", this parser will set `self.number = 3` and
`self.args = "apples"`. If the input string is "apples", this parser will set
`self.number = 0` and `self.args = "apples"`.
self.caller - the object calling this command
self.cmdstring - the actual command name used to call this
(this allows you to know which alias was used,
for example)
self.args - the raw input; everything following self.cmdstring.
self.cmdset - the cmdset from which this command was picked. Not
often used (useful for commands like 'help' or to
list all available commands etc)
self.obj - the object on which this command was defined. It is often
the same as self.caller.
This parser does additional parsing on self.args to identify a leading number,
storing the results in the following variables:
self.number = an integer representing the amount, or 0 if none was given
self.args = the re-defined input with the leading number removed
Optionally, if COMMAND_DEFAULT_CLASS is a MuxCommand, it applies the same
parsing to self.lhs
"""
super().parse()
self.number = 0