From 3a58d872bc62a553815129ea00e2eb98ec0ca8d0 Mon Sep 17 00:00:00 2001 From: Etienne Trimaille Date: Thu, 12 Dec 2024 12:29:33 +0100 Subject: [PATCH] Add Python annotations and remove args kwargs from Python methods --- docs/pyqgis_developer_cookbook/processing.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/pyqgis_developer_cookbook/processing.rst b/docs/pyqgis_developer_cookbook/processing.rst index 340d0b26187..8eb8ddc63e1 100644 --- a/docs/pyqgis_developer_cookbook/processing.rst +++ b/docs/pyqgis_developer_cookbook/processing.rst @@ -91,18 +91,22 @@ If you want to add your existing plugin to Processing, you need to add some code :skipif: True from qgis.core import QgsProcessingProvider + from qgis.PyQt.QtGui import QIcon from .example_processing_algorithm import ExampleProcessingAlgorithm class Provider(QgsProcessingProvider): - def loadAlgorithms(self, *args, **kwargs): + """ The provider of our plugin. """ + + def loadAlgorithms(self): + """ Load each algorithm into the current provider. """ self.addAlgorithm(ExampleProcessingAlgorithm()) # add additional algorithms here # self.addAlgorithm(MyOtherAlgorithm()) - def id(self, *args, **kwargs): + def id(self) -> str: """The ID of your plugin, used for identifying the provider. This string should be a unique, short, character only string, @@ -110,7 +114,7 @@ If you want to add your existing plugin to Processing, you need to add some code """ return 'yourplugin' - def name(self, *args, **kwargs): + def name(self) -> str: """The human friendly name of your plugin in Processing. This string should be as short as possible (e.g. "Lastools", not @@ -118,7 +122,7 @@ If you want to add your existing plugin to Processing, you need to add some code """ return self.tr('Your plugin') - def icon(self): + def icon(self) -> QIcon: """Should return a QIcon which is used for your provider inside the Processing toolbox. """