Fix and enable unused-variable lint

In _server.py start_server_batch_result is removed because
start_server_batch can only ever fail as a result of a programming
defect in gRPC Python and not the application. This differs from some
analogous-appearing points in _channel.py where the result of
start_client_batch is checked because at those points it is possible
for a failure to indicate a programming defect on the part of the
application.
pull/9866/head
Nathaniel Manista 8 years ago
parent 7983213fd2
commit e151a21ee4
  1. 8
      .pylintrc
  2. 2
      src/python/grpcio/grpc/_channel.py
  3. 2
      src/python/grpcio/grpc/_server.py
  4. 2
      src/python/grpcio/grpc/framework/foundation/logging_pool.py

@ -1,3 +1,8 @@
[VARIABLES]
# TODO(https://github.com/PyCQA/pylint/issues/1345): How does the inspection
# not include "unused_" and "ignored_" by default?
dummy-variables-rgx=^ignored_|^unused_
[MESSAGES CONTROL]
#TODO: Enable missing-docstring
@ -15,7 +20,6 @@
#TODO: Enable wrong-import-order
#TODO: Enable no-value-for-parameter
#TODO: Enable cyclic-import
#TODO: Enable unused-variable
#TODO: Enable redefined-outer-name
#TODO: Enable too-many-instance-attributes
#TODO: Enable broad-except
@ -29,4 +33,4 @@
#TODO: Enable too-many-nested-blocks
#TODO: Enable super-init-not-called
disable=missing-docstring,too-few-public-methods,too-many-arguments,no-init,duplicate-code,invalid-name,suppressed-message,locally-disabled,protected-access,no-name-in-module,unused-argument,fixme,wrong-import-order,no-value-for-parameter,cyclic-import,unused-variable,redefined-outer-name,too-many-instance-attributes,broad-except,too-many-locals,too-many-lines,redefined-variable-type,next-method-called,import-error,useless-else-on-loop,too-many-return-statements,too-many-nested-blocks,super-init-not-called
disable=missing-docstring,too-few-public-methods,too-many-arguments,no-init,duplicate-code,invalid-name,suppressed-message,locally-disabled,protected-access,no-name-in-module,unused-argument,fixme,wrong-import-order,no-value-for-parameter,cyclic-import,redefined-outer-name,too-many-instance-attributes,broad-except,too-many-locals,too-many-lines,redefined-variable-type,next-method-called,import-error,useless-else-on-loop,too-many-return-statements,too-many-nested-blocks,super-init-not-called

@ -200,7 +200,7 @@ def _consume_request_iterator(request_iterator, state, call,
request = next(request_iterator)
except StopIteration:
break
except Exception as e:
except Exception:
logging.exception("Exception iterating requests!")
call.cancel()
_abort(state, grpc.StatusCode.UNKNOWN,

@ -342,7 +342,7 @@ def _unary_request(rpc_event, state, request_deserializer):
if state.client is _CANCELLED or state.statused:
return None
else:
start_server_batch_result = rpc_event.operation_call.start_server_batch(
rpc_event.operation_call.start_server_batch(
cygrpc.Operations(
(cygrpc.operation_receive_message(_EMPTY_FLAGS),)),
_receive_message(state, rpc_event.operation_call,

@ -39,7 +39,7 @@ def _wrap(behavior):
def _wrapping(*args, **kwargs):
try:
return behavior(*args, **kwargs)
except Exception as e:
except Exception:
logging.exception(
'Unexpected exception from %s executed in logging pool!',
behavior)

Loading…
Cancel
Save