Fix docstring formatting

This commit is contained in:
Griatch 2020-10-19 22:01:44 +02:00
parent daa8be261c
commit 9238a9bb58
4 changed files with 39 additions and 28 deletions

View file

@ -1,4 +1,4 @@
# API Summary # API Summary
[evennia](api:evennia) - library root [evennia](api:evennia) - library root
- [evennia.accounts](api:evennia.accounts) - the out-of-character entities representing players - [evennia.accounts](api:evennia.accounts) - the out-of-character entities representing players
@ -75,6 +75,7 @@ The flat API is defined in `__init__.py` [viewable here](github:evennia/__init__
- [evennia.EvMenu](api:evennia.utils.evmenu#evennia.utils.evmenu.EvMenu) - menu system ([docs](Components/EvMenu)) - [evennia.EvMenu](api:evennia.utils.evmenu#evennia.utils.evmenu.EvMenu) - menu system ([docs](Components/EvMenu))
- [evennia.EvTable](api:evennia.utils.evtable#evennia.utils.evtable.EvTable) - text table creater - [evennia.EvTable](api:evennia.utils.evtable#evennia.utils.evtable.EvTable) - text table creater
- [evennia.EvForm](api:evennia.utils.evform#evennia.utils.evform.EvForm) - text form creator - [evennia.EvForm](api:evennia.utils.evform#evennia.utils.evform.EvForm) - text form creator
- Evennia.EvMore - text paginator
- [evennia.EvEditor](api:evennia.utils.eveditor#evennia.utils.eveditor.EvEditor) - in game text line editor ([docs](Components/EvEditor)) - [evennia.EvEditor](api:evennia.utils.eveditor#evennia.utils.eveditor.EvEditor) - in game text line editor ([docs](Components/EvEditor))
### Global singleton handlers ### Global singleton handlers

View file

@ -578,8 +578,8 @@ class IAttributeBackend:
def do_batch_finish(self, attr_objs): def do_batch_finish(self, attr_objs):
""" """
Called only by batch_add. Used for handling database operations and/or Called after batch_add completed. Used for handling database operations
caching complications. and/or caching complications.
Args: Args:
attr_objs (list of IAttribute): The Attributes created/updated thus far. attr_objs (list of IAttribute): The Attributes created/updated thus far.
@ -1098,10 +1098,11 @@ class AttributeHandler:
*args (tuple): Each argument should be a tuples (can be of varying *args (tuple): Each argument should be a tuples (can be of varying
length) representing the Attribute to add to this object. length) representing the Attribute to add to this object.
Supported tuples are Supported tuples are
- `(key, value)`
- `(key, value, category)` - (key, value)
- `(key, value, category, lockstring)` - (key, value, category)
- `(key, value, category, lockstring, default_access)` - (key, value, category, lockstring)
- (key, value, category, lockstring, default_access)
Keyword Args: Keyword Args:
strattr (bool): If `True`, value must be a string. This strattr (bool): If `True`, value must be a string. This

View file

@ -163,8 +163,6 @@ reaching a node without any options.
For a menu demo, import `CmdTestMenu` from this module and add it to For a menu demo, import `CmdTestMenu` from this module and add it to
your default cmdset. Run it with this module, like `testmenu evennia.utils.evmenu`. your default cmdset. Run it with this module, like `testmenu evennia.utils.evmenu`.
----
## Menu generation from template string ## Menu generation from template string
@ -179,10 +177,13 @@ EvMenu:
For maximum flexibility you can inject normally-created nodes in the menu tree For maximum flexibility you can inject normally-created nodes in the menu tree
before passing it to EvMenu. If that's not needed, you can also create a menu before passing it to EvMenu. If that's not needed, you can also create a menu
in one step with: in one step with:
::
```python
evmenu.template2menu(caller, menu_template, goto_callables) evmenu.template2menu(caller, menu_template, goto_callables)
```
The `goto_callables` is a mapping `{"funcname": callable, ...}`, where each The `goto_callables` is a mapping `{"funcname": callable, ...}`, where each
callable must be a module-global function on the form callable must be a module-global function on the form
`funcname(caller, raw_string, **kwargs)` (like any goto-callable). The `funcname(caller, raw_string, **kwargs)` (like any goto-callable). The
@ -260,10 +261,11 @@ strings is only needed if wanting to pass strippable spaces, otherwise the
key:values will be converted to strings/numbers with literal_eval before passed key:values will be converted to strings/numbers with literal_eval before passed
into the callable. into the callable.
The `> ` option takes a glob or regex to perform different actions depending on user The \\> option takes a glob or regex to perform different actions depending
input. Make sure to sort these in increasing order of generality since they on user input. Make sure to sort these in increasing order of generality since
will be tested in sequence. they will be tested in sequence.
----
""" """

View file

@ -7,17 +7,20 @@ the text (the name comes from the traditional 'more' unix command).
To use, simply pass the text through the EvMore object: To use, simply pass the text through the EvMore object:
```python
from evennia.utils.evmore import EvMore
text = some_long_text_output() ```python
EvMore(caller, text, always_page=False, session=None, justify_kwargs=None, **kwargs)
from evennia.utils.evmore import EvMore
text = some_long_text_output()
EvMore(caller, text, always_page=False, session=None, justify_kwargs=None, **kwargs)
``` ```
One can also use the convenience function `msg` from this module to avoid One can also use the convenience function `msg` from this module to avoid
having to set up the `EvMenu` object manually: having to set up the `EvMenu` object manually:
```python ```python
from evennia.utils import evmore from evennia.utils import evmore
text = some_long_text_output() text = some_long_text_output()
@ -153,20 +156,22 @@ class EvMore(object):
): ):
""" """
Initialization of the EvMore pager Initialization of the EvMore pager.
Args: Args:
caller (Object or Account): Entity reading the text. caller (Object or Account): Entity reading the text.
inp (str, EvTable, Paginator or iterator): The text or data to put under paging. inp (str, EvTable, Paginator or iterator): The text or data to put under paging.
- If a string, paginage normally. If this text contains - If a string, paginage normally. If this text contains
one or more `\f` format symbol, automatic pagination and justification one or more `\\\\f` format symbol, automatic pagination and justification
are force-disabled and page-breaks will only happen after each `\f`. are force-disabled and page-breaks will only happen after each `\\\\f`.
- If `EvTable`, the EvTable will be paginated with the same - If `EvTable`, the EvTable will be paginated with the same
setting on each page if it is too long. The table setting on each page if it is too long. The table
decorations will be considered in the size of the page. decorations will be considered in the size of the page.
- Otherwise `inp` is converted to an iterator, where each step is - Otherwise `inp` is converted to an iterator, where each step is
expected to be a line in the final display. Each line expected to be a line in the final display. Each line
will be run through `iter_callable`. will be run through `iter_callable`.
always_page (bool, optional): If `False`, the always_page (bool, optional): If `False`, the
pager will only kick in if `inp` is too big pager will only kick in if `inp` is too big
to fit the screen. to fit the screen.
@ -445,14 +450,15 @@ class EvMore(object):
Notes: Notes:
If overridden, this method must perform the following actions: If overridden, this method must perform the following actions:
- read and re-store `self._data` (the incoming data set) if needed for pagination to work. - read and re-store `self._data` (the incoming data set) if needed for pagination to work.
- set `self._npages` to the total number of pages. Default is 1. - set `self._npages` to the total number of pages. Default is 1.
- set `self._paginator` to a callable that will take a page number 1...N and return - set `self._paginator` to a callable that will take a page number 1...N and return
the data to display on that page (not any decorations or next/prev buttons). If only the data to display on that page (not any decorations or next/prev buttons). If only
wanting to change the paginator, override `self.paginator` instead. wanting to change the paginator, override `self.paginator` instead.
- set `self._page_formatter` to a callable that will receive the page from `self._paginator` - set `self._page_formatter` to a callable that will receive the page from `self._paginator`
and format it with one element per line. Default is `str`. Or override `self.page_formatter` and format it with one element per line. Default is `str`. Or override `self.page_formatter`
directly instead. directly instead.
By default, helper methods are called that perform these actions By default, helper methods are called that perform these actions
depending on supported inputs. depending on supported inputs.
@ -528,6 +534,7 @@ def msg(
): ):
""" """
EvMore-supported version of msg, mimicking the normal msg method. EvMore-supported version of msg, mimicking the normal msg method.
""" """
EvMore( EvMore(
caller, caller,