Skip to content

Commit

Permalink
Iterate over an enum since we can
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nathanielmanistaatgoogle committed Mar 16, 2015
1 parent ae3e5b5 commit 8d81365
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/python/src/grpc/framework/base/packets/_ends.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,6 @@

_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."""
Expand Down Expand Up @@ -98,7 +88,7 @@ def __init__(self, pool):
# 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):
Expand Down

0 comments on commit 8d81365

Please sign in to comment.