[orca] Convert some remaining plain uses of static/classmethod() to decorator syntax.



commit 309f33d29a81475016ee9f01c1181c9b138df8cd
Author: Mario Lang <mlang delysid org>
Date:   Sat Jun 4 22:36:41 2016 +0200

    Convert some remaining plain uses of static/classmethod() to decorator syntax.

 src/orca/speechdispatcherfactory.py |   10 +++++-----
 src/orca/speechserver.py            |   13 ++++---------
 2 files changed, 9 insertions(+), 14 deletions(-)
---
diff --git a/src/orca/speechdispatcherfactory.py b/src/orca/speechdispatcherfactory.py
index bf41814..70c15bd 100644
--- a/src/orca/speechdispatcherfactory.py
+++ b/src/orca/speechdispatcherfactory.py
@@ -73,10 +73,11 @@ class SpeechServer(speechserver.SpeechServer):
     DEFAULT_SERVER_ID = 'default'
     _SERVER_NAMES = {DEFAULT_SERVER_ID: guilabels.DEFAULT_SYNTHESIZER}
 
+    @staticmethod
     def getFactoryName():
         return guilabels.SPEECH_DISPATCHER
-    getFactoryName = staticmethod(getFactoryName)
 
+    @staticmethod
     def getSpeechServers():
         servers = []
         default = SpeechServer._getSpeechServer(SpeechServer.DEFAULT_SERVER_ID)
@@ -85,8 +86,8 @@ class SpeechServer(speechserver.SpeechServer):
             for module in default.list_output_modules():
                 servers.append(SpeechServer._getSpeechServer(module))
         return servers
-    getSpeechServers = staticmethod(getSpeechServers)
 
+    @classmethod
     def _getSpeechServer(cls, serverId):
         """Return an active server for given id.
 
@@ -99,20 +100,19 @@ class SpeechServer(speechserver.SpeechServer):
         # Don't return the instance, unless it is succesfully added
         # to `_active_Servers'.
         return cls._active_servers.get(serverId)
-    _getSpeechServer = classmethod(_getSpeechServer)
 
+    @staticmethod
     def getSpeechServer(info=None):
         if info is not None:
             thisId = info[1]
         else:
             thisId = SpeechServer.DEFAULT_SERVER_ID
         return SpeechServer._getSpeechServer(thisId)
-    getSpeechServer = staticmethod(getSpeechServer)
 
+    @staticmethod
     def shutdownActiveServers():
         for server in SpeechServer._active_servers.values():
             server.shutdown()
-    shutdownActiveServers = staticmethod(shutdownActiveServers)
 
     # *** Instance methods ***
 
diff --git a/src/orca/speechserver.py b/src/orca/speechserver.py
index 4e254d5..1de1a52 100644
--- a/src/orca/speechserver.py
+++ b/src/orca/speechserver.py
@@ -85,15 +85,14 @@ class SayAllContext:
 
 
 class SpeechServer(object):
-
     """Provides speech server abstraction."""
 
+    @staticmethod
     def getFactoryName():
         """Returns a localized name describing this factory."""
         pass
 
-    getFactoryName = staticmethod(getFactoryName)
-
+    @staticmethod
     def getSpeechServers():
         """Gets available speech servers as a list.  The caller
         is responsible for calling the shutdown() method of each
@@ -101,23 +100,19 @@ class SpeechServer(object):
         """
         pass
 
-    getSpeechServers = staticmethod(getSpeechServers)
-
+    @staticmethod
     def getSpeechServer(info):
         """Gets a given SpeechServer based upon the info.
         See SpeechServer.getInfo() for more info.
         """
         pass
 
-    getSpeechServer = staticmethod(getSpeechServer)
-
+    @staticmethod
     def shutdownActiveServers():
         """Cleans up and shuts down this factory.
         """
         pass
 
-    shutdownActiveServers = staticmethod(shutdownActiveServers)
-
     def __init__(self):
         pass
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]