فهرست منبع

we can now use class decorations instead of reassignment at module scope since we no longer support 2.5, 79 cols

Chris McDonough 10 سال پیش
والد
کامیت
5d7f895e40
1فایلهای تغییر یافته به همراه8 افزوده شده و 6 حذف شده
  1. 8 6
      supervisor/process.py

+ 8 - 6
supervisor/process.py

@@ -28,6 +28,7 @@ from supervisor.datatypes import RestartUnconditionally
 
 from supervisor.socket_manager import SocketManager
 
+@total_ordering
 class Subprocess(object):
 
     """A class to manage a subprocess."""
@@ -592,8 +593,6 @@ class Subprocess(object):
                                                       self.pid))
                 self.kill(signal.SIGKILL)
 
-Subprocess = total_ordering(Subprocess)
-
 class FastCGISubprocess(Subprocess):
     """Extends Subprocess class to handle FastCGI subprocesses"""
 
@@ -655,6 +654,7 @@ class FastCGISubprocess(Subprocess):
         for i in range(3, options.minfds):
             options.close_fd(i)
 
+@total_ordering
 class ProcessGroupBase(object):
     def __init__(self, config):
         self.config = config
@@ -709,8 +709,6 @@ class ProcessGroupBase(object):
             dispatchers.update(process.dispatchers)
         return dispatchers
 
-ProcessGroupBase = total_ordering(ProcessGroupBase)
-
 class ProcessGroup(ProcessGroupBase):
     def transition(self):
         for proc in self.processes.values():
@@ -728,7 +726,10 @@ class FastCGIProcessGroup(ProcessGroup):
         try:
             self.socket_manager.get_socket()
         except Exception as e:
-            raise ValueError('Could not create FastCGI socket %s: %s' % (self.socket_manager.config(), e))
+            raise ValueError(
+                'Could not create FastCGI socket %s: %s' % (
+                    self.socket_manager.config(), e)
+                )
 
 class EventListenerPool(ProcessGroupBase):
     def __init__(self, config):
@@ -779,7 +780,8 @@ class EventListenerPool(ProcessGroupBase):
 
     def _acceptEvent(self, event, head=False):
         # events are required to be instances
-        # this has a side effect to fail with an attribute error on 'old style' classes
+        # this has a side effect to fail with an attribute error on 'old style'
+        # classes
         if not hasattr(event, 'serial'):
             event.serial = new_serial(GlobalSerial)
         if not hasattr(event, 'pool_serials'):