Skip to content

Commit

Permalink
Add plugin support for Numpy-style docstrings, and some minor docstri…
Browse files Browse the repository at this point in the history
…ng syntax fixes
  • Loading branch information
JWCook committed May 20, 2022
1 parent d08cbe8 commit bb75193
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@
# Sphinx extension modules
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
'sphinx_autodoc_typehints',
'sphinxcontrib.apidoc',
'm2r2',
]

# Enable Numpy-style docstrings
napoleon_numpy_docstring = True
napoleon_include_private_with_doc = False
napoleon_include_special_with_doc = False

# Use sphinx-apidoc to auto-generate rst sources
# Configured here instead of instead of in Makefile so it will be used by ReadTheDocs
apidoc_module_dir = PACKAGE_DIR
Expand Down
2 changes: 1 addition & 1 deletion gpxpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
def parse(xml_or_file: Union[AnyStr, IO[str]], version: Optional[str] = None) -> mod_gpx.GPX:
"""
Parse xml (string) or file object. This is just an wrapper for
GPXParser.parse() function.
:py:meth:`GPXParser.parse`.
parser may be 'lxml', 'minidom' or None (then it will be automatically
detected, lxml if possible).
Expand Down
4 changes: 2 additions & 2 deletions gpxpy/gpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def length(self) -> float:
"""
Computes length (2-dimensional) of route.
Returns:
Returns
-----------
length: float
Length returned in meters
Expand Down Expand Up @@ -928,7 +928,7 @@ def get_time_bounds(self) -> TimeBounds:
"""
Gets the time bound (start and end) of the segment.
returns
Returns
----------
time_bounds : TimeBounds named tuple
start_time : datetime
Expand Down
4 changes: 2 additions & 2 deletions gpxpy/gpxfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ def to_xml(self, value: Any, version: str, nsmap: Optional[Dict[str, str]]=None,
version: str of the gpx output version "1.0" or "1.1"
Returns:
None if value is empty or str of XML representation of the
address. Representation starts with a \n.
None if value is empty or str of XML representation of the address.
Representation starts with ``\\n``.
"""
if not value:
return ''
Expand Down

0 comments on commit bb75193

Please sign in to comment.