Explorar o código

Iterate over an enum since we can

Since enums are themselves iterable there's no need to maintain a list
of the elements of the enum dating from back before the enum when its
values were just independent constants that hung out together.
Nathaniel Manista %!s(int64=10) %!d(string=hai) anos
pai
achega
8d81365a3c
Modificáronse 1 ficheiros con 1 adicións e 11 borrados
  1. 1 11
      src/python/src/grpc/framework/base/packets/_ends.py

+ 1 - 11
src/python/src/grpc/framework/base/packets/_ends.py

@@ -50,16 +50,6 @@ from grpc.framework.foundation import callable_util
 
 _IDLE_ACTION_EXCEPTION_LOG_MESSAGE = 'Exception calling idle action!'
 
-_OPERATION_OUTCOMES = (
-    base_interfaces.Outcome.COMPLETED,
-    base_interfaces.Outcome.CANCELLED,
-    base_interfaces.Outcome.EXPIRED,
-    base_interfaces.Outcome.RECEPTION_FAILURE,
-    base_interfaces.Outcome.TRANSMISSION_FAILURE,
-    base_interfaces.Outcome.SERVICER_FAILURE,
-    base_interfaces.Outcome.SERVICED_FAILURE,
-    )
-
 
 class _EasyOperation(base_interfaces.Operation):
   """A trivial implementation of base_interfaces.Operation."""
@@ -98,7 +88,7 @@ class _Endlette(object):
     # indicates an in-progress fire-and-forget operation for which the customer
     # has chosen to ignore results.
     self._operations = {}
-    self._stats = {outcome: 0 for outcome in _OPERATION_OUTCOMES}
+    self._stats = {outcome: 0 for outcome in base_interfaces.Outcome}
     self._idle_actions = []
 
   def terminal_action(self, operation_id):