diff options
author | Philip Paquette <pcpaquette@gmail.com> | 2019-09-11 12:58:45 -0400 |
---|---|---|
committer | Philip Paquette <pcpaquette@gmail.com> | 2019-09-14 18:18:53 -0400 |
commit | abb42dcd4886705d6ba8af27f68ef605218ac67c (patch) | |
tree | 9ae16f7a09fff539fa72e65198e284bca6ac3376 /diplomacy/integration/webdiplomacy_net/orders.py | |
parent | a954a00d263750c279dbb2c0a9ae85707022bcd7 (diff) |
Added ReadtheDocs documentation for the public API
- Reformatted the docstring to be compatible
- Added tests to make sure the documentation compiles properly
- Added sphinx as a pip requirement
Co-authored-by: Philip Paquette <pcpaquette@gmail.com>
Co-authored-by: notoraptor <stevenbocco@gmail.com>
Diffstat (limited to 'diplomacy/integration/webdiplomacy_net/orders.py')
-rw-r--r-- | diplomacy/integration/webdiplomacy_net/orders.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/diplomacy/integration/webdiplomacy_net/orders.py b/diplomacy/integration/webdiplomacy_net/orders.py index afacf03..8fa966c 100644 --- a/diplomacy/integration/webdiplomacy_net/orders.py +++ b/diplomacy/integration/webdiplomacy_net/orders.py @@ -18,9 +18,10 @@ LOGGER = logging.getLogger(__name__) def is_adjacent_for_convoy(loc_1, loc_2, map_object): """ Checks if two locations are adjacent (for convoy purposes) - - If loc_1 and loc_2 are water, loc_1 and loc_2 must be adjacent - - If loc_1 or loc_2 is land, then they are not adjacent - - If loc_1 or loc_2 are coast, then the other locations needs to be a water loc at most 1 loc away + + - If loc_1 and loc_2 are water, loc_1 and loc_2 must be adjacent + - If loc_1 or loc_2 is land, then they are not adjacent + - If loc_1 or loc_2 are coast, then the other locations needs to be a water loc at most 1 loc away :type map_object: diplomacy.Map """ @@ -48,6 +49,7 @@ def is_adjacent_for_convoy(loc_1, loc_2, map_object): def find_convoy_path(src, dest, map_object, game=None, including=None, excluding=None): """ Finds a convoy path from src to dest + :param src: The source location (e.g. 'BRE') :param dest: The destination location (e.g. 'LON') :param map_object: A diplomacy.Map object representation of the current map @@ -55,7 +57,7 @@ def find_convoy_path(src, dest, map_object, game=None, including=None, excluding :param including: Optional. A single province (e.g. 'NAO') or a list of provinces that must be in the path. :param excluding: Optional. A single province (e.g. 'NAO') or a list of provinces that must NOT be in the path. :return: Either an empty list if a convoy is not possible between src and dest - or a list of [src, fleet1, fleet2, ..., fleet_n, dest] to use to convoy A `src` - `dest`. + or a list of [src, fleet1, fleet2, ..., fleet_n, dest] to use to convoy A `src` - `dest`. :type map_object: diplomacy.Map :type game: diplomacy.Game """ @@ -122,11 +124,12 @@ def find_convoy_path(src, dest, map_object, game=None, including=None, excluding return [] -class Order(): +class Order: """ Class to convert order from string representation to dictionary (webdiplomacy.net) representation """ def __init__(self, order, map_id=None, map_name=None, phase_type=None, game=None): """ Constructor + :param order: An order (either as a string 'A PAR H' or as a dictionary) :param map_id: Optional. The map id of the map where orders are submitted (webdiplomacy format) :param map_name: Optional. The map name of the map where orders are submitted. @@ -162,6 +165,7 @@ class Order(): def _build_from_string(self, order, game=None): """ Builds this object from a string + :type order: str :type game: diplomacy.Game """ @@ -444,6 +448,7 @@ class Order(): def _build_from_dict(self, order): """ Builds this object from a dictionary + :type order: dict """ # pylint: disable=too-many-return-statements |