Skip to content

Commit

Permalink
Formatting docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
blazs committed Jan 16, 2018
1 parent 937be6b commit 072154e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
16 changes: 8 additions & 8 deletions sentinelhub/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ class BBox:
Throughout the sentinelhub package this class serves as the canonical representation of a bounding
box. It can instantiate itself from multiple representations:
1) ((min_x,min_y),(max_x,max_y))
2) (min_x,min_y,max_x,max_y)
3) [min_x,min_y,max_x,max_y]
4) [[min_x, min_y],[max_x,max_y]],
5) 'min_x,min_y,max_x,max_y'
6) {'min_x':min_x, 'max_x':max_x, 'min_y':min_y, 'max_y':max_y}
7) bbox, where bbox is an instance of BBox
1) ``((min_x,min_y),(max_x,max_y))``,
2) ``(min_x,min_y,max_x,max_y)``,
3) ``[min_x,min_y,max_x,max_y]``,
4) ``[[min_x, min_y],[max_x,max_y]]``,
5) ``'min_x,min_y,max_x,max_y'``,
6) ``{'min_x':min_x, 'max_x':max_x, 'min_y':min_y, 'max_y':max_y}``,
7) ``bbox``, where ``bbox`` is an instance of ``BBox``.
:param bbox: a bbox in a number of representations.
:param crs: Coordinate Reference System that bbox is in. Expect one of the constants from the const.CRS enum.
:param crs: Coordinate Reference System that bbox is in. Expect one of the constants from the ``const.CRS`` enum.
:type crs: constants.CRS
"""
def __init__(self, bbox, crs):
Expand Down
20 changes: 10 additions & 10 deletions sentinelhub/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ def ogc_string(crs):

@classmethod
def has_value(cls, value):
""" Tests whether CRS contains a constant defined with string `value`.
""" Tests whether CRS contains a constant defined with string ``value``.
:param value: The string representation of the enum constant.
:type value: str
:return: `True` if there exists a constant with string value `value`, `False` otherwise
:return: ``True`` if there exists a constant with string value ``value``, ``False`` otherwise
:rtype: bool
"""
return any(value == item.value for item in cls)
Expand Down Expand Up @@ -126,11 +126,11 @@ class CustomUrlParam(Enum):

@classmethod
def has_value(cls, value):
""" Tests whether CustomUrlParam contains a constant defined with a string `value`
""" Tests whether CustomUrlParam contains a constant defined with a string ``value``
:param value: The string representation of the enum constant
:type value: str
:return: `True` if there exists a constant with a string value `value`, `False` otherwise
:return: ``True`` if there exists a constant with a string value ``value``, ``False`` otherwise
:rtype: bool
"""
return any(value.lower() == item.value.lower() for item in cls)
Expand Down Expand Up @@ -174,11 +174,11 @@ def canonical_extension(fmt_ext):
""" Canonical extension of file format extension
Converts the format extension fmt_ext into the canonical extension for that format. For example,
`canonical_extension('tif') == 'tiff'`. Here we agree that the canonical extension for format F is F.value
``canonical_extension('tif') == 'tiff'``. Here we agree that the canonical extension for format F is F.value
:param fmt_ext: A string representing an extension (e.g. `'txt'`, `'png'`, etc.)
:param fmt_ext: A string representing an extension (e.g. ``'txt'``, ``'png'``, etc.)
:type fmt_ext: str
:return: The canonical form of the extension (e.g. if `fmt_ext='tif'` then we return `'tiff'`)
:return: The canonical form of the extension (e.g. if ``fmt_ext='tif'`` then we return ``'tiff'``)
:rtype: str
"""
if MimeType.has_value(fmt_ext):
Expand All @@ -199,18 +199,18 @@ def is_image_format(value):
:param value: File format
:type value: str
:return: `True` if file is in image format, `False` otherwise
:return: ``True`` if file is in image format, ``False`` otherwise
:rtype: bool
"""
return value in frozenset([MimeType.TIFF, MimeType.TIFF_d32f, MimeType.PNG, MimeType.JP2, MimeType.JPG])

@classmethod
def has_value(cls, value):
""" Tests whether MimeType contains a constant defined with string `value`
""" Tests whether MimeType contains a constant defined with string ``value``
:param value: The string representation of the enum constant
:type value: str
:return: `True` if there exists a constant with string value `value`, `False` otherwise
:return: ``True`` if there exists a constant with string value ``value``, ``False`` otherwise
:rtype: bool
"""
return any(value == item.value for item in cls)
Expand Down
4 changes: 2 additions & 2 deletions sentinelhub/data_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ class OgcRequest(DataRequest):
:param source: type of OGC request (WMS or WCS)
:type source: constants.DataSource
:param size_x: number of pixels in x or resolution in x (i.e. 512 or `10m`)
:param size_x: number of pixels in x or resolution in x (i.e. `512` or `10m`)
:type size_x: int or str
:param size_y: number of pixels in x or resolution in y (i.e. 512 or `10m`)
:param size_y: number of pixels in x or resolution in y (i.e. `512` or `10m`)
:type size_y: int or str
:param bbox: specifies the bounding box of the requested image. Coordinates must be in
the specified coordinate reference system. Required.
Expand Down

0 comments on commit 072154e

Please sign in to comment.