Skip to content

Commit ca8e1d3

Browse files
committedApr 6, 2017
[sipify] Replace nullptr with None in docstrings
Since nullptr has no meaning to Python devs
1 parent 5ccc6cc commit ca8e1d3

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed
 

‎python/core/qgspropertytransformer.sip

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ class QgsPropertyTransformer
261261
\param fieldName will be set to a field name which is used to calculate the input
262262
to the property transformer. This will be set to an
263263
empty string if an expression is the transformer input.
264-
\returns corresponding property transformer, or nullptr if expression could not
264+
\returns corresponding property transformer, or None if expression could not
265265
be parsed to a transformer.
266266
%End
267267

@@ -323,7 +323,7 @@ class QgsGenericNumericTransformer : QgsPropertyTransformer
323323
\param fieldName will be set to a field name which is used to calculate the input
324324
to the property transformer. This will be set to an
325325
empty string if an expression is the transformer input.
326-
\returns corresponding QgsSizeScaleTransformer, or nullptr if expression could not
326+
\returns corresponding QgsSizeScaleTransformer, or None if expression could not
327327
be parsed to a size scale transformer.
328328
%End
329329

@@ -449,7 +449,7 @@ class QgsSizeScaleTransformer : QgsPropertyTransformer
449449
\param fieldName will be set to a field name which is used to calculate the input
450450
to the property transformer. This will be set to an
451451
empty string if an expression is the transformer input.
452-
\returns corresponding QgsSizeScaleTransformer, or nullptr if expression could not
452+
\returns corresponding QgsSizeScaleTransformer, or None if expression could not
453453
be parsed to a size scale transformer.
454454
%End
455455

‎python/core/raster/qgsrasterfilewriter.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class QgsRasterFileWriter
4848
.. note::
4949

5050
Does not work with tiled mode enabled.
51-
\returns Instance of data provider in editing mode (on success) or null on error.
51+
\returns Instance of data provider in editing mode (on success) or None on error.
5252
.. versionadded:: 3.0
5353
%End
5454

‎scripts/sipify.pl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ sub processDoxygenLine
1414
$line =~ s/\\a //g;
1515
# replace :: with . (changes c++ style namespace/class directives to Python style)
1616
$line =~ s/::/./g;
17+
# replace nullptr with None (nullptr means nothing to Python devs)
18+
$line =~ s/\bnullptr\b/None/g;
19+
1720
if ( $line =~ m/[\\@](ingroup|class)/ ) {
1821
return ""
1922
}

‎src/core/raster/qgsrasterfilewriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class CORE_EXPORT QgsRasterFileWriter
5959
* Returned provider may be used to initialize the raster using writeBlock() calls.
6060
* Ownership of the returned provider is passed to the caller.
6161
* \note Does not work with tiled mode enabled.
62-
* \returns Instance of data provider in editing mode (on success) or null on error.
62+
* \returns Instance of data provider in editing mode (on success) or nullptr on error.
6363
* \since QGIS 3.0
6464
*/
6565
QgsRasterDataProvider *createOneBandRaster( Qgis::DataType dataType,

‎tests/scripts/sipifyheader.expected.sip

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ Factory annotation
131131
Here's some comment mentioning another class QgsAutoAwesomemater.makeLessAwesome.
132132
%End
133133

134+
MyPointer *pointerReturnValue();
135+
%Docstring
136+
I return a pointer. If something bad happens, I return None.
137+
%End
138+
134139
bool isOKwithErrMesg( QString &ErrMsg /Out/ );
135140

136141
void InOutParam( bool &ok = true /In,Out/ );

‎tests/scripts/sipifyheader.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
163163
*/
164164
void LongDocStringMethodWithBrief();
165165

166+
/**
167+
* I return a pointer. If something bad happens, I return nullptr.
168+
*/
169+
MyPointer *pointerReturnValue();
170+
166171
bool isOKwithErrMesg( QString &ErrMsg SIP_OUT );
167172

168173
void InOutParam( bool &ok = true SIP_INOUT );

0 commit comments

Comments
 (0)
Please sign in to comment.