more docstrings...

It's not always easy to decide when a given term should go between ` `
in order to show up as code-style. Wherever it seemed obvious and
convenient I've added them. Avoided to use it where I wasn't sure, and
always kept in mind some balance between readability in source-code and
on Wiki.
This commit is contained in:
tajmone 2015-03-09 12:10:31 +01:00 committed by Griatch
parent 90bef1a8d5
commit 2ead033cdc
2 changed files with 16 additions and 17 deletions

View file

@ -3,7 +3,7 @@ Models for the help system.
The database-tied help system is only half of Evennia's help The database-tied help system is only half of Evennia's help
functionality, the other one being the auto-generated command help functionality, the other one being the auto-generated command help
that is created on the fly from each command's __doc__ string. The that is created on the fly from each command's `__doc__` string. The
persistent database system defined here is intended for all other persistent database system defined here is intended for all other
forms of help that do not concern commands, like information about the forms of help that do not concern commands, like information about the
game world, policy info, rules and similar. game world, policy info, rules and similar.

View file

@ -24,7 +24,7 @@ _AT_MULTIMATCH_INPUT = utils.variable_from_module(*settings.SEARCH_AT_MULTIMATCH
class ObjectDBManager(TypedObjectManager): class ObjectDBManager(TypedObjectManager):
""" """
This ObjectManager implementes methods for searching This ObjectManager implements methods for searching
and manipulating Objects directly from the database. and manipulating Objects directly from the database.
Evennia-specific search methods (will return Typeclasses or Evennia-specific search methods (will return Typeclasses or
@ -60,9 +60,8 @@ class ObjectDBManager(TypedObjectManager):
def get_object_with_player(self, ostring, exact=True, candidates=None): def get_object_with_player(self, ostring, exact=True, candidates=None):
""" """
Search for an object based on its player's name or dbref. Search for an object based on its player's name or dbref.
This search This search is sometimes initiated by appending an `*` to the
is sometimes initiated by appending a * to the beginning of beginning of the search criterion (e.g. in local_and_global_search).
the search criterion (e.g. in local_and_global_search).
search_string: (string) The name or dbref to search for. search_string: (string) The name or dbref to search for.
""" """
ostring = to_unicode(ostring).lstrip('*') ostring = to_unicode(ostring).lstrip('*')
@ -183,7 +182,7 @@ class ObjectDBManager(TypedObjectManager):
candidates=None, typeclasses=None): candidates=None, typeclasses=None):
""" """
Returns objects based on key or alias match. Will also do fuzzy Returns objects based on key or alias match. Will also do fuzzy
matching based on the utils.string_partial_matching function. matching based on the `utils.string_partial_matching` function.
candidates - list of candidate objects to restrict on candidates - list of candidate objects to restrict on
typeclasses - list of typeclass path strings to restrict on typeclasses - list of typeclass path strings to restrict on
""" """
@ -241,12 +240,12 @@ class ObjectDBManager(TypedObjectManager):
Arguments: Arguments:
searchdata: (str or obj) The entity to match for. This is usually a searchdata: (str or obj) The entity to match for. This is usually a
key string but may also be an object itself. By default (if key string but may also be an object itself. By default (if
not attribute_name is set), this will search object.key and no `attribute_name` is set), this will search `object.key` and
object.aliases in order. Can also be on the form #dbref, `object.aliases` in order. Can also be on the form #dbref,
which will, if exact=True be matched against primary key. which will (if `exact=True`) be matched against primary key.
attribute_name: (str): Use this named ObjectAttribute to match attribute_name: (str): Use this named ObjectAttribute to match
searchdata against, instead of the defaults. If this is searchdata against, instead of the defaults. If this is
the name of a database field (with or without the db_ prefix), the name of a database field (with or without the `db_` prefix),
that will be matched too. that will be matched too.
typeclass (str or TypeClass): restrict matches to objects having this typeclass (str or TypeClass): restrict matches to objects having this
typeclass. This will help speed up global searches. typeclass. This will help speed up global searches.
@ -260,7 +259,7 @@ class ObjectDBManager(TypedObjectManager):
names with multiple components (so "bi sw" will match names with multiple components (so "bi sw" will match
"Big sword"). Since this is more expensive than exact "Big sword"). Since this is more expensive than exact
matching, it is recommended to be used together with the matching, it is recommended to be used together with the
objlist keyword to limit the number of possibilities. This `objlist` keyword to limit the number of possibilities. This
value has no meaning if searching for attributes/properties. value has no meaning if searching for attributes/properties.
Returns: Returns:
@ -268,7 +267,7 @@ class ObjectDBManager(TypedObjectManager):
""" """
def _searcher(searchdata, candidates, typeclass, exact=False): def _searcher(searchdata, candidates, typeclass, exact=False):
""" """
Helper method for searching objects. typeclass is only used Helper method for searching objects. `typeclass` is only used
for global searching (no candidates) for global searching (no candidates)
""" """
if attribute_name: if attribute_name:
@ -347,12 +346,12 @@ class ObjectDBManager(TypedObjectManager):
will be identical to the original except for the arguments given will be identical to the original except for the arguments given
specifically to this method. specifically to this method.
original_object (obj) - the object to make a copy from original_object (obj) - the object to make a copy from.
new_key (str) - name the copy differently from the original. new_key (str) - name the copy differently from the original.
new_location (obj) - if not None, change the location new_location (obj) - if not `None`, change the location.
new_home (obj) - if not None, change the Home new_home (obj) - if not `None`, change the Home.
new_aliases (list of strings) - if not None, change object aliases. new_aliases (list of strings) - if not `None`, change object aliases.
new_destination (obj) - if not None, change destination new_destination (obj) - if not `None`, change destination.
""" """
# get all the object's stats # get all the object's stats