From 2ead033cdc831d1748a4bbebcb60b63d92d0cfdc Mon Sep 17 00:00:00 2001 From: tajmone Date: Mon, 9 Mar 2015 12:10:31 +0100 Subject: [PATCH] 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. --- evennia/help/models.py | 2 +- evennia/objects/manager.py | 31 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/evennia/help/models.py b/evennia/help/models.py index 4d17bfc0ff..a9187ddbe8 100644 --- a/evennia/help/models.py +++ b/evennia/help/models.py @@ -3,7 +3,7 @@ Models for the help system. The database-tied help system is only half of Evennia's 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 forms of help that do not concern commands, like information about the game world, policy info, rules and similar. diff --git a/evennia/objects/manager.py b/evennia/objects/manager.py index 753f485fd9..a887b8e13d 100644 --- a/evennia/objects/manager.py +++ b/evennia/objects/manager.py @@ -24,7 +24,7 @@ _AT_MULTIMATCH_INPUT = utils.variable_from_module(*settings.SEARCH_AT_MULTIMATCH class ObjectDBManager(TypedObjectManager): """ - This ObjectManager implementes methods for searching + This ObjectManager implements methods for searching and manipulating Objects directly from the database. 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): """ Search for an object based on its player's name or dbref. - This search - is sometimes initiated by appending a * to the beginning of - the search criterion (e.g. in local_and_global_search). + This search is sometimes initiated by appending an `*` to the + beginning of the search criterion (e.g. in local_and_global_search). search_string: (string) The name or dbref to search for. """ ostring = to_unicode(ostring).lstrip('*') @@ -183,7 +182,7 @@ class ObjectDBManager(TypedObjectManager): candidates=None, typeclasses=None): """ 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 typeclasses - list of typeclass path strings to restrict on """ @@ -241,12 +240,12 @@ class ObjectDBManager(TypedObjectManager): Arguments: 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 - not attribute_name is set), this will search object.key and - object.aliases in order. Can also be on the form #dbref, - which will, if exact=True be matched against primary key. + no `attribute_name` is set), this will search `object.key` and + `object.aliases` in order. Can also be on the form #dbref, + which will (if `exact=True`) be matched against primary key. attribute_name: (str): Use this named ObjectAttribute to match 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. typeclass (str or TypeClass): restrict matches to objects having this typeclass. This will help speed up global searches. @@ -260,7 +259,7 @@ class ObjectDBManager(TypedObjectManager): names with multiple components (so "bi sw" will match "Big sword"). Since this is more expensive than exact 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. Returns: @@ -268,7 +267,7 @@ class ObjectDBManager(TypedObjectManager): """ 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) """ if attribute_name: @@ -347,12 +346,12 @@ class ObjectDBManager(TypedObjectManager): will be identical to the original except for the arguments given 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_location (obj) - if not None, change the location - new_home (obj) - if not None, change the Home - new_aliases (list of strings) - if not None, change object aliases. - new_destination (obj) - if not None, change destination + new_location (obj) - if not `None`, change the location. + new_home (obj) - if not `None`, change the Home. + new_aliases (list of strings) - if not `None`, change object aliases. + new_destination (obj) - if not `None`, change destination. """ # get all the object's stats