Skip to content

Commit

Permalink
Merge pull request grpc#9974 from nathanielmanistaatgoogle/lint
Browse files Browse the repository at this point in the history
More lint.
  • Loading branch information
nathanielmanistaatgoogle authored Mar 8, 2017
2 parents 808d19e + 3ec1366 commit 04b4d4c
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 26 deletions.
14 changes: 7 additions & 7 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
# not include "unused_" and "ignored_" by default?
dummy-variables-rgx=^ignored_|^unused_

[DESIGN]
# NOTE(nathaniel): Not particularly attached to this value; it just seems to
# be what works for us at the moment (excepting the dead-code-walking Beta
# API).
max-args=6

[MISCELLANEOUS]
# NOTE(nathaniel): We are big fans of "TODO(<issue link>): " and
# "NOTE(<username or issue link>): ". We do not allow "TODO:",
Expand All @@ -13,28 +19,22 @@ notes=FIXME,XXX

#TODO: Enable missing-docstring
#TODO: Enable too-few-public-methods
#TODO: Enable too-many-arguments
#TODO: Enable no-init
#TODO: Enable duplicate-code
#TODO: Enable invalid-name
#TODO: Enable suppressed-message
#TODO: Enable locally-disabled
#TODO: Enable protected-access
#TODO: Enable no-name-in-module
#TODO: Enable unused-argument
#TODO: Enable wrong-import-order
# TODO(https://github.com/PyCQA/pylint/issues/59#issuecomment-283774279):
# enable cyclic-import after a 1.7-or-later pylint release that recognizes our
# disable=cyclic-import suppressions.
#TODO: Enable too-many-instance-attributes
#TODO: Enable too-many-locals
#TODO: Enable too-many-lines
#TODO: Enable redefined-variable-type
#TODO: Enable next-method-called
#TODO: Enable import-error
#TODO: Enable useless-else-on-loop
#TODO: Enable too-many-return-statements
#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,wrong-import-order,cyclic-import,too-many-instance-attributes,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,no-init,duplicate-code,invalid-name,locally-disabled,protected-access,no-name-in-module,wrong-import-order,cyclic-import,too-many-instance-attributes,too-many-lines,redefined-variable-type,next-method-called,import-error,useless-else-on-loop,too-many-nested-blocks
10 changes: 3 additions & 7 deletions src/python/grpcio/grpc/_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def consume_request_iterator():
cygrpc.Operations(operations), event_handler)
state.due.add(cygrpc.OperationType.send_close_from_client)

def stop_consumption_thread(timeout):
def stop_consumption_thread(timeout): # pylint: disable=unused-argument
with state.condition:
if state.code is None:
call.cancel()
Expand Down Expand Up @@ -736,7 +736,7 @@ def channel_spin():
state.managed_calls = None
return

def stop_channel_spin(timeout):
def stop_channel_spin(timeout): # pylint: disable=unused-argument
with state.lock:
if state.managed_calls is not None:
for call in state.managed_calls:
Expand Down Expand Up @@ -877,12 +877,8 @@ def _moot(state):
def _subscribe(state, callback, try_to_connect):
with state.lock:
if not state.callbacks_and_connectivities and not state.polling:

def cancel_all_subscriptions(timeout):
_moot(state)

polling_thread = _common.CleanupThread(
cancel_all_subscriptions,
lambda timeout: _moot(state),
target=_poll_connectivity,
args=(state, state.channel, bool(try_to_connect)))
polling_thread.start()
Expand Down
2 changes: 2 additions & 0 deletions src/python/grpcio/grpc/beta/_client_adaptations.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
from grpc.framework.foundation import future
from grpc.framework.interfaces.face import face

# pylint: disable=too-many-arguments,too-many-locals,unused-argument

_STATUS_CODE_TO_ABORTION_KIND_AND_ABORTION_ERROR_CLASS = {
grpc.StatusCode.CANCELLED: (face.Abortion.Kind.CANCELLED,
face.CancellationError),
Expand Down
4 changes: 3 additions & 1 deletion src/python/grpcio/grpc/beta/_server_adaptations.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
from grpc.framework.foundation import stream
from grpc.framework.interfaces.face import face

# pylint: disable=too-many-return-statements

_DEFAULT_POOL_SIZE = 8


Expand Down Expand Up @@ -179,7 +181,7 @@ def pipe_requests():
return
request_consumer.terminate()

def stop_request_pipe(timeout):
def stop_request_pipe(timeout): # pylint: disable=unused-argument
thread_joined.set()

request_pipe_thread = _common.CleanupThread(
Expand Down
2 changes: 2 additions & 0 deletions src/python/grpcio/grpc/beta/implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
from grpc.framework.common import cardinality # pylint: disable=unused-import
from grpc.framework.interfaces.face import face # pylint: disable=unused-import

# pylint: disable=too-many-arguments

ChannelCredentials = grpc.ChannelCredentials
ssl_channel_credentials = grpc.ssl_channel_credentials
CallCredentials = grpc.CallCredentials
Expand Down
25 changes: 14 additions & 11 deletions src/python/grpcio/grpc/framework/interfaces/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,29 @@
# abandonment is referenced from specification in this module.
from grpc.framework.foundation import abandonment # pylint: disable=unused-import

# pylint: disable=too-many-arguments


class NoSuchMethodError(Exception):
"""Indicates that an unrecognized operation has been called.
Attributes:
code: A code value to communicate to the other side of the operation along
with indication of operation termination. May be None.
details: A details value to communicate to the other side of the operation
along with indication of operation termination. May be None.
"""

def __init__(self, code, details):
"""Constructor.
Args:
Attributes:
code: A code value to communicate to the other side of the operation
along with indication of operation termination. May be None.
details: A details value to communicate to the other side of the
operation along with indication of operation termination. May be None.
"""

def __init__(self, code, details):
"""Constructor.
Args:
code: A code value to communicate to the other side of the operation
along with indication of operation termination. May be None.
details: A details value to communicate to the other side of the
operation along with indication of operation termination. May be None.
"""
super(NoSuchMethodError, self).__init__()
self.code = code
self.details = details

Expand Down
2 changes: 2 additions & 0 deletions src/python/grpcio/grpc/framework/interfaces/face/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
from grpc.framework.foundation import future # pylint: disable=unused-import
from grpc.framework.foundation import stream # pylint: disable=unused-import

# pylint: disable=too-many-arguments


class NoSuchMethodError(Exception):
"""Raised by customer code to indicate an unrecognized method.
Expand Down

0 comments on commit 04b4d4c

Please sign in to comment.