Skip to content

Commit

Permalink
Fix formatting of exception blocks in PyQGIS docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 10, 2021
1 parent fa6bc1e commit 8359281
Show file tree
Hide file tree
Showing 34 changed files with 381 additions and 181 deletions.
4 changes: 2 additions & 2 deletions python/core/auto_generated/geometry/qgscurvepolygon.sip.in
Expand Up @@ -95,7 +95,7 @@ Returns the curve polygon's exterior ring.
%Docstring
Retrieves an interior ring from the curve polygon. The first interior ring has index 0.

An IndexError will be raised if no interior ring with the specified index exists.
:raises IndexError: if no interior ring with the specified index exists.

.. seealso:: :py:func:`numInteriorRings`

Expand Down Expand Up @@ -151,7 +151,7 @@ Removes an interior ring from the polygon. The first interior ring has index 0.
The corresponding ring is removed from the polygon and deleted.
It is not possible to remove the exterior ring using this method.

An IndexError will be raised if no interior ring with the specified index exists.
:raises IndexError: if no interior ring with the specified index exists.

.. seealso:: :py:func:`removeInteriorRings`
%End
Expand Down
56 changes: 35 additions & 21 deletions python/core/auto_generated/geometry/qgsgeometry.sip.in
Expand Up @@ -1694,9 +1694,11 @@ Returns a list of ``count`` random points generated inside a (multi)polygon geom
Optionally, a specific random ``seed`` can be used when generating points. If ``seed``
is 0, then a completely random sequence of points will be generated.

This method works only with (multi)polygon geometry types. If the geometry
is not a polygon type, a TypeError will be raised. If the geometry
is null, a ValueError will be raised.
This method works only with (multi)polygon geometry types.

:raises TypeError: if the geometry is not a polygon type

:raises ValueError: if the geometry is null

.. versionadded:: 3.10
%End
Expand Down Expand Up @@ -1823,9 +1825,11 @@ Returns the contents of the geometry as a 2-dimensional point.

Any z or m values present in the geometry will be discarded.

This method works only with single-point geometry types. If the geometry
is not a single-point type, a TypeError will be raised. If the geometry
is null, a ValueError will be raised.
This method works only with single-point geometry types.

:raises TypeError: if the geometry is not a single-point type

:raises ValueError: if the geometry is null
%End
%MethodCode
const QgsWkbTypes::Type type = sipCpp->wkbType();
Expand Down Expand Up @@ -1853,9 +1857,11 @@ Returns the contents of the geometry as a polyline.
Any z or m values present in the geometry will be discarded. If the geometry is a curved line type
(such as a CircularString), it will be automatically segmentized.

This method works only with single-line (or single-curve) geometry types. If the geometry
is not a single-line type, a TypeError will be raised. If the geometry is null, a ValueError
will be raised.
This method works only with single-line (or single-curve).

:raises TypeError: if the geometry is not a single-line type

:raises ValueError: if the geometry is null
%End
%MethodCode
const QgsWkbTypes::Type type = sipCpp->wkbType();
Expand Down Expand Up @@ -1884,9 +1890,11 @@ Returns the contents of the geometry as a polygon.
Any z or m values present in the geometry will be discarded. If the geometry is a curved polygon type
(such as a CurvePolygon), it will be automatically segmentized.

This method works only with single-polygon (or single-curve polygon) geometry types. If the geometry
is not a single-polygon type, a TypeError will be raised. If the geometry is null, a ValueError
will be raised.
This method works only with single-polygon (or single-curve polygon) geometry types.

:raises TypeError: if the geometry is not a single-polygon type

:raises ValueError: if the geometry is null
%End
%MethodCode
const QgsWkbTypes::Type type = sipCpp->wkbType();
Expand Down Expand Up @@ -1914,9 +1922,11 @@ Returns the contents of the geometry as a multi-point.

Any z or m values present in the geometry will be discarded.

This method works only with multi-point geometry types. If the geometry
is not a multi-point type, a TypeError will be raised. If the geometry is null, a ValueError
will be raised.
This method works only with multi-point geometry types.

:raises TypeError: if the geometry is not a multi-point type

:raises ValueError: if the geometry is null
%End
%MethodCode
const QgsWkbTypes::Type type = sipCpp->wkbType();
Expand Down Expand Up @@ -1945,9 +1955,11 @@ Returns the contents of the geometry as a multi-linestring.
Any z or m values present in the geometry will be discarded. If the geometry is a curved line type
(such as a MultiCurve), it will be automatically segmentized.

This method works only with multi-linestring (or multi-curve) geometry types. If the geometry
is not a multi-linestring type, a TypeError will be raised. If the geometry is null, a ValueError
will be raised.
This method works only with multi-linestring (or multi-curve) geometry types.

:raises TypeError: if the geometry is not a multi-linestring type

:raises ValueError: if the geometry is null
%End
%MethodCode
const QgsWkbTypes::Type type = sipCpp->wkbType();
Expand Down Expand Up @@ -1976,9 +1988,11 @@ Returns the contents of the geometry as a multi-polygon.
Any z or m values present in the geometry will be discarded. If the geometry is a curved polygon type
(such as a MultiSurface), it will be automatically segmentized.

This method works only with multi-polygon (or multi-curve polygon) geometry types. If the geometry
is not a multi-polygon type, a TypeError will be raised. If the geometry is null, a ValueError
will be raised.
This method works only with multi-polygon (or multi-curve polygon) geometry types.

:raises TypeError: if the geometry is not a multi-polygon type

:raises ValueError: if the geometry is null
%End
%MethodCode
const QgsWkbTypes::Type type = sipCpp->wkbType();
Expand Down
16 changes: 11 additions & 5 deletions python/core/auto_generated/geometry/qgsgeometrycollection.sip.in
Expand Up @@ -69,7 +69,9 @@ Returns the number of geometries within the collection.
%Docstring
Returns a geometry from within the collection.

:param n: index of geometry to return. An IndexError will be raised if no geometry with the specified index exists.
:param n: index of geometry to return.

:raises IndexError: if no geometry with the specified index exists.
%End
%MethodCode
if ( a0 < 0 || a0 >= sipCpp->numGeometries() )
Expand Down Expand Up @@ -133,9 +135,9 @@ Inserts a geometry before a specified index and takes ownership. Returns ``True`
%Docstring
Removes a geometry from the collection by index.

An IndexError will be raised if no geometry with the specified index exists.

:return: ``True`` if removal was successful.

:raises IndexError: if no geometry with the specified index exists.
%End
%MethodCode
const int count = sipCpp->numGeometries();
Expand Down Expand Up @@ -256,11 +258,13 @@ Returns a geometry without curves. Caller takes ownership

SIP_PYOBJECT __getitem__( int index ) /TypeHint="QgsAbstractGeometry"/;
%Docstring
Returns the geometry at the specified ``index``. An IndexError will be raised if no geometry with the specified ``index`` exists.
Returns the geometry at the specified ``index``.

Indexes can be less than 0, in which case they correspond to geometries from the end of the collect. E.g. an index of -1
corresponds to the last geometry in the collection.

:raises IndexError: if no geometry with the specified ``index`` exists.

.. versionadded:: 3.6
%End
%MethodCode
Expand All @@ -282,11 +286,13 @@ corresponds to the last geometry in the collection.

void __delitem__( int index );
%Docstring
Deletes the geometry at the specified ``index``. A geometry at the ``index`` must already exist or an IndexError will be raised.
Deletes the geometry at the specified ``index``.

Indexes can be less than 0, in which case they correspond to geometries from the end of the collection. E.g. an index of -1
corresponds to the last geometry in the collection.

:raises IndexError: if no geometry at the ``index`` exists

.. versionadded:: 3.6
%End
%MethodCode
Expand Down
48 changes: 28 additions & 20 deletions python/core/auto_generated/geometry/qgslinestring.sip.in
Expand Up @@ -274,10 +274,12 @@ Returns a new linestring from a QPolygonF ``polygon`` input.

SIP_PYOBJECT pointN( int i ) const /TypeHint="QgsPoint"/;
%Docstring
Returns the point at the specified index. An IndexError will be raised if no point with the specified index exists.
Returns the point at the specified index.

Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
corresponds to the last point in the line.

:raises IndexError: if no point with the specified index exists.
%End
%MethodCode
const int count = sipCpp->numPoints();
Expand All @@ -303,10 +305,10 @@ corresponds to the last point in the line.
%Docstring
Returns the x-coordinate of the specified node in the line string.

An IndexError will be raised if no point with the specified index exists.

Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
corresponds to the last point in the line.

:raises IndexError: if no point with the specified index exists.
%End
%MethodCode
const int count = sipCpp->numPoints();
Expand All @@ -330,10 +332,10 @@ corresponds to the last point in the line.
%Docstring
Returns the y-coordinate of the specified node in the line string.

An IndexError will be raised if no point with the specified index exists.

Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
corresponds to the last point in the line.

:raises IndexError: if no point with the specified index exists.
%End
%MethodCode
const int count = sipCpp->numPoints();
Expand All @@ -360,12 +362,12 @@ corresponds to the last point in the line.
%Docstring
Returns the z-coordinate of the specified node in the line string.

An IndexError will be raised if no point with the specified index exists.

If the LineString does not have a z-dimension then ``nan`` will be returned.

Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
corresponds to the last point in the line.

:raises IndexError: if no point with the specified index exists.
%End
%MethodCode
const int count = sipCpp->numPoints();
Expand All @@ -388,12 +390,12 @@ corresponds to the last point in the line.
%Docstring
Returns the m-coordinate of the specified node in the line string.

An IndexError will be raised if no point with the specified index exists.

If the LineString does not have a m-dimension then ``nan`` will be returned.

Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
corresponds to the last point in the line.

:raises IndexError: if no point with the specified index exists.
%End
%MethodCode
const int count = sipCpp->numPoints();
Expand All @@ -417,11 +419,11 @@ corresponds to the last point in the line.
Sets the x-coordinate of the specified node in the line string.
The corresponding node must already exist in line string.

An IndexError will be raised if no point with the specified index exists.

Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
corresponds to the last point in the line.

:raises IndexError: if no point with the specified index exists.

.. seealso:: :py:func:`xAt`
%End
%MethodCode
Expand All @@ -446,11 +448,11 @@ corresponds to the last point in the line.
Sets the y-coordinate of the specified node in the line string.
The corresponding node must already exist in line string.

An IndexError will be raised if no point with the specified index exists.

Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
corresponds to the last point in the line.

:raises IndexError: if no point with the specified index exists.

.. seealso:: :py:func:`yAt`
%End
%MethodCode
Expand All @@ -475,11 +477,11 @@ corresponds to the last point in the line.
Sets the z-coordinate of the specified node in the line string.
The corresponding node must already exist in line string and the line string must have z-dimension.

An IndexError will be raised if no point with the specified index exists.

Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
corresponds to the last point in the line.

:raises IndexError: if no point with the specified index exists.

.. seealso:: :py:func:`zAt`
%End
%MethodCode
Expand All @@ -504,11 +506,11 @@ corresponds to the last point in the line.
Sets the m-coordinate of the specified node in the line string.
The corresponding node must already exist in line string and the line string must have m-dimension.

An IndexError will be raised if no point with the specified index exists.

Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
corresponds to the last point in the line.

:raises IndexError: if no point with the specified index exists.

.. seealso:: :py:func:`mAt`
%End
%MethodCode
Expand Down Expand Up @@ -736,11 +738,13 @@ of the curve.

SIP_PYOBJECT __getitem__( int index ) /TypeHint="QgsPoint"/;
%Docstring
Returns the point at the specified ``index``. An IndexError will be raised if no point with the specified ``index`` exists.
Returns the point at the specified ``index``.

Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
corresponds to the last point in the line.

:raises IndexError: if no point with the specified ``index`` exists.

.. versionadded:: 3.6
%End
%MethodCode
Expand All @@ -763,11 +767,13 @@ corresponds to the last point in the line.

void __setitem__( int index, const QgsPoint &point );
%Docstring
Sets the point at the specified ``index``. A point at the ``index`` must already exist or an IndexError will be raised.
Sets the point at the specified ``index``.

Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
corresponds to the last point in the line.

:raises IndexError: if no point with the specified ``index`` exists.

.. versionadded:: 3.6
%End
%MethodCode
Expand All @@ -793,11 +799,13 @@ corresponds to the last point in the line.

void __delitem__( int index );
%Docstring
Deletes the vertex at the specified ``index``. A point at the ``index`` must already exist or an IndexError will be raised.
Deletes the vertex at the specified ``index``.

Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
corresponds to the last point in the line.

:raises IndexError: if no point with the specified ``index`` exists.

.. versionadded:: 3.6
%End
%MethodCode
Expand Down
2 changes: 1 addition & 1 deletion python/core/auto_generated/geometry/qgsmulticurve.sip.in
Expand Up @@ -28,7 +28,7 @@ Multi curve geometry collection.
%Docstring
Returns the curve with the specified ``index``.

An IndexError will be raised if no curve with the specified index exists.
:raises IndexError: if no curve with the specified index exists.

.. versionadded:: 3.16
%End
Expand Down
Expand Up @@ -33,7 +33,7 @@ Constructor for an empty multilinestring geometry.
%Docstring
Returns the line string with the specified ``index``.

An IndexError will be raised if no line string with the specified index exists.
:raises IndexError: if no line string with the specified index exists.

.. versionadded:: 3.16
%End
Expand Down
2 changes: 1 addition & 1 deletion python/core/auto_generated/geometry/qgsmultipoint.sip.in
Expand Up @@ -31,7 +31,7 @@ Constructor for an empty multipoint geometry.
%Docstring
Returns the point with the specified ``index``.

An IndexError will be raised if no point with the specified index exists.
:raises IndexError: if no point with the specified index exists.

.. versionadded:: 3.16
%End
Expand Down
2 changes: 1 addition & 1 deletion python/core/auto_generated/geometry/qgsmultipolygon.sip.in
Expand Up @@ -33,7 +33,7 @@ Constructor for an empty multipolygon geometry.
%Docstring
Returns the polygon with the specified ``index``.

An IndexError will be raised if no polygon with the specified index exists.
:raises IndexError: if no polygon with the specified index exists.

.. versionadded:: 3.16
%End
Expand Down
2 changes: 1 addition & 1 deletion python/core/auto_generated/geometry/qgsmultisurface.sip.in
Expand Up @@ -33,7 +33,7 @@ Constructor for an empty multisurface geometry.
%Docstring
Returns the surface with the specified ``index``.

An IndexError will be raised if no surface with the specified index exists.
:raises IndexError: if no surface with the specified index exists.

.. versionadded:: 3.16
%End
Expand Down

0 comments on commit 8359281

Please sign in to comment.