Skip to content

Commit

Permalink
[sipify] Add return types for functions in docstrings
Browse files Browse the repository at this point in the history
and change \return -> :return: in docystrings
  • Loading branch information
nyalldawson committed Apr 7, 2017
1 parent 8c5e241 commit bfd37e1
Show file tree
Hide file tree
Showing 28 changed files with 644 additions and 102 deletions.
5 changes: 5 additions & 0 deletions python/core/annotations/qgsannotationmanager.sip
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class QgsAnnotationManager : QObject
Returns true if the addition was successful, or false if the annotation could not be added.
\see removeAnnotation()
\see annotationAdded()
:rtype: bool
%End

bool removeAnnotation( QgsAnnotation *annotation );
Expand All @@ -55,6 +56,7 @@ class QgsAnnotationManager : QObject
\see compositionRemoved()
\see compositionAboutToBeRemoved()
\see clear()
:rtype: bool
%End

void clear();
Expand All @@ -66,19 +68,22 @@ class QgsAnnotationManager : QObject
QList< QgsAnnotation * > annotations() const;
%Docstring
Returns a list of all annotations contained in the manager.
:rtype: list of QgsAnnotation
%End

bool readXml( const QDomElement &element, const QDomDocument &doc );
%Docstring
Reads the manager's state from a DOM element, restoring all annotations
present in the XML document.
\see writeXml()
:rtype: bool
%End

QDomElement writeXml( QDomDocument &doc ) const;
%Docstring
Returns a DOM element representing the state of the manager.
\see readXml()
:rtype: QDomElement
%End

signals:
Expand Down
5 changes: 5 additions & 0 deletions python/core/annotations/qgshtmlannotation.sip
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class QgsHtmlAnnotation: QgsAnnotation
~QgsHtmlAnnotation();

QSizeF minimumFrameSize() const;
%Docstring
:rtype: QSizeF
%End

void setSourceFile( const QString &htmlFile );
%Docstring
Expand All @@ -39,6 +42,7 @@ class QgsHtmlAnnotation: QgsAnnotation
%Docstring
Returns the file path for the source HTML file.
\see setSourceFile()
:rtype: str
%End

virtual void writeXml( QDomElement &elem, QDomDocument &doc ) const;
Expand All @@ -49,6 +53,7 @@ class QgsHtmlAnnotation: QgsAnnotation
static QgsHtmlAnnotation *create() /Factory/;
%Docstring
Returns a new QgsHtmlAnnotation object.
:rtype: QgsHtmlAnnotation
%End

protected:
Expand Down
2 changes: 2 additions & 0 deletions python/core/annotations/qgssvgannotation.sip
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ class QgsSvgAnnotation: QgsAnnotation
%Docstring
Returns the file path for the source SVG file.
\see setFilePath()
:rtype: str
%End

static QgsSvgAnnotation *create() /Factory/;
%Docstring
Returns a new QgsSvgAnnotation object.
:rtype: QgsSvgAnnotation
%End

protected:
Expand Down
2 changes: 2 additions & 0 deletions python/core/annotations/qgstextannotation.sip
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class QgsTextAnnotation: QgsAnnotation
Returns the text document which will be rendered
within the annotation.
\see setDocument()
:rtype: QTextDocument
%End

void setDocument( const QTextDocument *doc );
Expand All @@ -46,6 +47,7 @@ class QgsTextAnnotation: QgsAnnotation
static QgsTextAnnotation *create() /Factory/;
%Docstring
Returns a new QgsTextAnnotation object.
:rtype: QgsTextAnnotation
%End

protected:
Expand Down
9 changes: 9 additions & 0 deletions python/core/processing/qgsprocessingalgorithm.sip
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class QgsProcessingAlgorithm
\see displayName()
\see group()
\see tags()
:rtype: str
%End

QString id() const;
Expand All @@ -57,48 +58,56 @@ class QgsProcessingAlgorithm
provider's ID and the algorithms unique name (e.g. "qgis:mergelayers" ).
\see name()
\see provider()
:rtype: str
%End

virtual QString displayName() const = 0;
%Docstring
Returns the translated algorithm name, which should be used for any user-visible display
of the algorithm name.
\see name()
:rtype: str
%End

virtual QStringList tags() const;
%Docstring
Returns a list of tags which relate to the algorithm, and are used to assist users in searching
for suitable algorithms. These tags should be localised.
:rtype: list of str
%End

virtual QIcon icon() const;
%Docstring
Returns an icon for the algorithm.
\see svgIconPath()
:rtype: QIcon
%End

virtual QString svgIconPath() const;
%Docstring
Returns a path to an SVG version of the algorithm's icon.
\see icon()
:rtype: str
%End

virtual QString group() const;
%Docstring
Returns the name of the group this algorithm belongs to. This string
should be localised.
\see tags()
:rtype: str
%End

virtual Flags flags() const;
%Docstring
Returns the flags indicating how and when the algorithm operates and should be exposed to users.
:rtype: Flags
%End

QgsProcessingProvider *provider() const;
%Docstring
Returns the provider to which this algorithm belongs.
:rtype: QgsProcessingProvider
%End

private:
Expand Down
16 changes: 15 additions & 1 deletion python/core/processing/qgsprocessingprovider.sip
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ class QgsProcessingProvider : QObject
%Docstring
Returns an icon for the provider.
\see svgIconPath()
:rtype: QIcon
%End

virtual QString svgIconPath() const;
%Docstring
Returns a path to an SVG version of the provider's icon.
\see icon()
:rtype: str
%End

virtual QString id() const = 0;
Expand All @@ -50,32 +52,37 @@ class QgsProcessingProvider : QObject
should be a unique, short, character only string, eg "qgis" or "gdal". This
string should not be localised.
\see name()
:rtype: str
%End

virtual QString name() const = 0;
%Docstring
Returns the full provider name, which is used to describe the provider within the GUI.
This string should be localised.
\see id()
:rtype: str
%End

virtual bool canBeActivated() const;
%Docstring
Returns true if the provider can be activated, or false if it cannot be activated (e.g. due to
missing external dependencies).
\see isActive()
:rtype: bool
%End

virtual bool isActive() const;
%Docstring
Returns true if the provider is active and able to run algorithms.
:rtype: bool
%End

virtual QStringList supportedOutputRasterLayerExtensions() const;
%Docstring
Returns a list of the raster format file extensions supported by this provider.
\see supportedOutputVectorLayerExtensions()
\see supportedOutputTableExtensions()
:rtype: list of str
%End

virtual QStringList supportedOutputVectorLayerExtensions() const;
Expand All @@ -84,20 +91,23 @@ class QgsProcessingProvider : QObject
\see supportedOutputRasterLayerExtensions()
\see supportedOutputTableExtensions()
\see supportsNonFileBasedOutput()
:rtype: list of str
%End

virtual QStringList supportedOutputTableExtensions() const;
%Docstring
Returns a list of the table format file extensions supported by this provider.
\see supportedOutputRasterLayerExtensions()
\see supportedOutputVectorLayerExtensions()
:rtype: list of str
%End

virtual bool supportsNonFileBasedOutput() const;
%Docstring
Returns true if the provider supports non-file based outputs (such as memory layers
or direct database outputs).
\see supportedOutputVectorLayerExtensions()
:rtype: bool
%End

virtual bool load();
Expand All @@ -107,8 +117,9 @@ class QgsProcessingProvider : QObject
Subclasses should not individually load any algorithms in their load() implementations, as that must
occur within the loadAlgorithms() method. Instead, subclasses should call refreshAlgorithms()
from any overloaded load() method to trigger an initial load of the provider's algorithms.
\returns true if provider could be successfully loaded
:return: true if provider could be successfully loaded
\see unload()
:rtype: bool
%End

virtual void unload();
Expand All @@ -126,13 +137,15 @@ class QgsProcessingProvider : QObject
%Docstring
Returns a list of algorithms supplied by this provider.
\see algorithm()
:rtype: list of const QgsProcessingAlgorithm
%End

const QgsProcessingAlgorithm *algorithm( const QString &name ) const;
%Docstring
Returns the matching algorithm by name, or a None if no matching
algorithm is contained by this provider.
\see algorithms()
:rtype: QgsProcessingAlgorithm
%End

signals:
Expand All @@ -155,6 +168,7 @@ class QgsProcessingProvider : QObject
bool addAlgorithm( QgsProcessingAlgorithm *algorithm /Transfer/ );
%Docstring
Adds an algorithm to the provider. Ownership of the algorithm is transferred to the provider.
:rtype: bool
%End

private:
Expand Down
7 changes: 7 additions & 0 deletions python/core/processing/qgsprocessingregistry.sip
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class QgsProcessingRegistry : QObject
QList<QgsProcessingProvider *> providers() const;
%Docstring
Get list of available providers.
:rtype: list of QgsProcessingProvider
%End

bool addProvider( QgsProcessingProvider *provider /Transfer/ );
Expand All @@ -48,38 +49,44 @@ class QgsProcessingRegistry : QObject
Adding a provider to the registry automatically triggers the providers QgsProcessingProvider.load()
method to populate the provider with algorithms.
\see removeProvider()
:rtype: bool
%End

bool removeProvider( QgsProcessingProvider *provider );
%Docstring
Removes a provider implementation from the registry (the provider object is deleted).
Returns false if the provider could not be removed (eg provider does not exist in the registry).
\see addProvider()
:rtype: bool
%End

bool removeProvider( const QString &providerId );
%Docstring
Removes a provider implementation from the registry (the provider object is deleted).
Returns false if the provider could not be removed (eg provider does not exist in the registry).
\see addProvider()
:rtype: bool
%End

QgsProcessingProvider *providerById( const QString &id );
%Docstring
Returns a matching provider by provider ID.
:rtype: QgsProcessingProvider
%End

QList< const QgsProcessingAlgorithm *> algorithms() const;
%Docstring
Returns a list of all available algorithms from registered providers.
\see algorithmById()
:rtype: list of const QgsProcessingAlgorithm
%End

const QgsProcessingAlgorithm *algorithmById( const QString &id ) const;
%Docstring
Finds an algorithm by its ID. If no matching algorithm is found, a None
is returned.
\see algorithms()
:rtype: QgsProcessingAlgorithm
%End

signals:
Expand Down
6 changes: 6 additions & 0 deletions python/core/processing/qgsprocessingutils.sip
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class QgsProcessingUtils
value.
\see compatibleVectorLayers()
\see compatibleLayers()
:rtype: list of QgsRasterLayer
%End

static QList< QgsVectorLayer * > compatibleVectorLayers( QgsProject *project,
Expand All @@ -50,6 +51,7 @@ class QgsProcessingUtils
value.
\see compatibleRasterLayers()
\see compatibleLayers()
:rtype: list of QgsVectorLayer
%End

static QList< QgsMapLayer * > compatibleLayers( QgsProject *project, bool sort = true );
Expand All @@ -61,6 +63,7 @@ class QgsProcessingUtils
value.
\see compatibleRasterLayers()
\see compatibleVectorLayers()
:rtype: list of QgsMapLayer
%End


Expand All @@ -74,6 +77,7 @@ class QgsProcessingUtils
for layers in the specified project, then those matching layers will be
returned.
\see mapLayerFromString()
:rtype: QgsMapLayer
%End

static QgsMapLayer *mapLayerFromString( const QString &string ) /Factory/;
Expand All @@ -83,12 +87,14 @@ class QgsProcessingUtils
then the layer at this file path will be loaded.
The caller takes responsibility for deleting the returned map layer.
\see mapLayerFromProject()
:rtype: QgsMapLayer
%End

static QString normalizeLayerSource( const QString &source );
%Docstring
Normalizes a layer source string for safe comparison across different
operating system environments.
:rtype: str
%End

};
Expand Down
Loading

0 comments on commit bfd37e1

Please sign in to comment.