Skip to content

Commit 1d9153e

Browse files
authored
Remove pylint pragmas (#283)
1 parent 8c23c46 commit 1d9153e

20 files changed

+17
-48
lines changed

examples/http_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def ping() -> Result:
1717
class TestHttpServer(BaseHTTPRequestHandler):
1818
"""HTTPServer request handler"""
1919

20-
def do_POST(self) -> None: # pylint: disable=invalid-name
20+
def do_POST(self) -> None:
2121
"""POST handler"""
2222
# Process request
2323
request = self.rfile.read(int(self.headers["Content-Length"])).decode()

jsonrpcserver/async_dispatcher.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636

3737
logger = logging.getLogger(__name__)
3838

39-
# pylint: disable=missing-function-docstring,duplicate-code
40-
4139

4240
async def call(
4341
request: Request, context: Any, method: Method
@@ -49,7 +47,7 @@ async def call(
4947
validate_result(result)
5048
except JsonRpcError as exc:
5149
return Failure(ErrorResult(code=exc.code, message=exc.message, data=exc.data))
52-
except Exception as exc: # pylint: disable=broad-except
50+
except Exception as exc:
5351
# Other error inside method - Internal error
5452
logger.exception(exc)
5553
return Failure(InternalErrorResult(str(exc)))
@@ -139,6 +137,6 @@ async def dispatch_to_response_pure(
139137
result.unwrap(),
140138
)
141139
)
142-
except Exception as exc: # pylint: disable=broad-except
140+
except Exception as exc:
143141
logger.exception(exc)
144142
return post_process(Failure(ServerErrorResponse(str(exc), None)))

jsonrpcserver/async_main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
from .sentinels import NOCONTEXT
1212
from .utils import identity
1313

14-
# pylint: disable=missing-function-docstring,duplicate-code
15-
1614

1715
async def dispatch_to_response(
1816
request: str,

jsonrpcserver/dispatcher.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
requests, providing responses.
33
"""
44

5-
# pylint: disable=protected-access
65
import logging
76
from functools import partial
87
from inspect import signature
@@ -143,7 +142,7 @@ def call(
143142
except JsonRpcError as exc:
144143
return Failure(ErrorResult(code=exc.code, message=exc.message, data=exc.data))
145144
# Any other uncaught exception inside method - internal error.
146-
except Exception as exc: # pylint: disable=broad-except
145+
except Exception as exc:
147146
logger.exception(exc)
148147
return Failure(InternalErrorResult(str(exc)))
149148
return result
@@ -249,7 +248,7 @@ def validate_request(
249248
# Since the validator is unknown, the specific exception that will be raised is also
250249
# unknown. Any exception raised we assume the request is invalid and return an
251250
# "invalid request" response.
252-
except Exception: # pylint: disable=broad-except
251+
except Exception:
253252
return Failure(InvalidRequestResponse("The request failed schema validation"))
254253
return Success(request)
255254

@@ -266,7 +265,7 @@ def deserialize_request(
266265
# Since the deserializer is unknown, the specific exception that will be raised is
267266
# also unknown. Any exception raised we assume the request is invalid, return a
268267
# parse error response.
269-
except Exception as exc: # pylint: disable=broad-except
268+
except Exception as exc:
270269
return Failure(ParseErrorResponse(str(exc)))
271270

272271

@@ -297,7 +296,7 @@ def dispatch_to_response_pure(
297296
args_validator, post_process, methods, context, result.unwrap()
298297
)
299298
)
300-
except Exception as exc: # pylint: disable=broad-except
299+
except Exception as exc:
301300
# There was an error with the jsonrpcserver library.
302301
logging.exception(exc)
303302
return post_process(Failure(ServerErrorResponse(str(exc), None)))

jsonrpcserver/methods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626

2727
def method(
28-
f: Optional[Method] = None, # pylint: disable=invalid-name
28+
f: Optional[Method] = None,
2929
name: Optional[str] = None,
3030
) -> Callable[..., Any]:
3131
"""A decorator to add a function into jsonrpcserver's internal global_methods dict.

jsonrpcserver/response.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ErrorResponse(NamedTuple):
4141
Response = Result[SuccessResponse, ErrorResponse]
4242

4343

44-
def ParseErrorResponse(data: Any) -> ErrorResponse: # pylint: disable=invalid-name
44+
def ParseErrorResponse(data: Any) -> ErrorResponse:
4545
"""An ErrorResponse with most attributes already populated.
4646
4747
From the spec: "This (id) member is REQUIRED. It MUST be the same as the value of
@@ -51,7 +51,7 @@ def ParseErrorResponse(data: Any) -> ErrorResponse: # pylint: disable=invalid-n
5151
return ErrorResponse(ERROR_PARSE_ERROR, "Parse error", data, None)
5252

5353

54-
def InvalidRequestResponse(data: Any) -> ErrorResponse: # pylint: disable=invalid-name
54+
def InvalidRequestResponse(data: Any) -> ErrorResponse:
5555
"""An ErrorResponse with most attributes already populated.
5656
5757
From the spec: "This (id) member is REQUIRED. It MUST be the same as the value of
@@ -63,13 +63,11 @@ def InvalidRequestResponse(data: Any) -> ErrorResponse: # pylint: disable=inval
6363

6464
def MethodNotFoundResponse(data: Any, id: Any) -> ErrorResponse:
6565
"""An ErrorResponse with some attributes already populated."""
66-
# pylint: disable=invalid-name,redefined-builtin
6766
return ErrorResponse(ERROR_METHOD_NOT_FOUND, "Method not found", data, id)
6867

6968

7069
def ServerErrorResponse(data: Any, id: Any) -> ErrorResponse:
7170
"""An ErrorResponse with some attributes already populated."""
72-
# pylint: disable=invalid-name,redefined-builtin
7371
return ErrorResponse(ERROR_SERVER_ERROR, "Server error", data, id)
7472

7573

jsonrpcserver/result.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
from .codes import ERROR_INTERNAL_ERROR, ERROR_INVALID_PARAMS, ERROR_METHOD_NOT_FOUND
1616
from .sentinels import NODATA
1717

18-
# pylint: disable=missing-class-docstring,missing-function-docstring,invalid-name
19-
2018

2119
class SuccessResult(NamedTuple):
2220
result: Any = None

jsonrpcserver/sentinels.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class Sentinel:
1212
Has a nicer repr than `object()`.
1313
"""
1414

15-
# pylint: disable=too-few-public-methods
1615
def __init__(self, name: str):
1716
self.name = name
1817

jsonrpcserver/server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88

99

1010
class RequestHandler(BaseHTTPRequestHandler):
11-
def do_POST(self) -> None: # pylint: disable=invalid-name
11+
"""Handle HTTP requests"""
12+
13+
def do_POST(self) -> None:
14+
"""Handle POST request"""
1215
request = self.rfile.read(int(str(self.headers["Content-Length"]))).decode()
1316
response = dispatch(request)
1417
if response is not None:

jsonrpcserver/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
from functools import reduce
44
from typing import Any, Callable, List
55

6-
# pylint: disable=invalid-name
7-
86

97
def identity(x: Any) -> Any:
108
"""Returns the argument."""

tests/test_async_dispatcher.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
from jsonrpcserver.sentinels import NOCONTEXT, NODATA
2121
from jsonrpcserver.utils import identity
2222

23-
# pylint: disable=missing-function-docstring,duplicate-code
24-
2523

2624
async def ping() -> Result:
2725
return Ok("pong")

tests/test_async_main.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
from jsonrpcserver.response import SuccessResponse
1212
from jsonrpcserver.result import Ok, Result
1313

14-
# pylint: disable=missing-function-docstring
15-
16-
# pylint: disable=missing-function-docstring
17-
1814

1915
async def ping() -> Result:
2016
return Ok("pong")

tests/test_dispatcher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def test_dispatch_to_response_pure_method_not_found() -> None:
426426

427427

428428
def test_dispatch_to_response_pure_invalid_params_auto() -> None:
429-
def f(colour: str, size: str) -> Result: # pylint: disable=unused-argument
429+
def f(colour: str, size: str) -> Result:
430430
return Ok()
431431

432432
assert dispatch_to_response_pure(
@@ -615,7 +615,7 @@ def test_dispatch_to_response_pure_notification_method_not_found() -> None:
615615

616616

617617
def test_dispatch_to_response_pure_notification_invalid_params_auto() -> None:
618-
def foo(colour: str, size: str) -> Result: # pylint: disable=unused-argument
618+
def foo(colour: str, size: str) -> Result:
619619
return Ok()
620620

621621
assert (

tests/test_main.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
from jsonrpcserver.response import SuccessResponse
1212
from jsonrpcserver.result import Ok, Result
1313

14-
# pylint: disable=missing-function-docstring
15-
16-
# pylint: disable=missing-function-docstring
17-
1814

1915
def ping() -> Result:
2016
return Ok("pong")
@@ -28,7 +24,7 @@ def test_dispatch_to_response() -> None:
2824

2925
def test_dispatch_to_response_with_global_methods() -> None:
3026
@method
31-
def ping() -> Result: # pylint: disable=redefined-outer-name
27+
def ping() -> Result:
3228
return Ok("pong")
3329

3430
response = dispatch_to_response('{"jsonrpc": "2.0", "method": "ping", "id": 1}')

tests/test_methods.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
from jsonrpcserver.methods import global_methods, method
44
from jsonrpcserver.result import Ok, Result
55

6-
# pylint: disable=missing-function-docstring
7-
86

97
def test_decorator() -> None:
108
@method

tests/test_request.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
from jsonrpcserver.request import Request
44

5-
# pylint: disable=missing-function-docstring
6-
75

86
def test_request() -> None:
97
assert Request(method="foo", params=[], id=1).method == "foo"

tests/test_response.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
to_serializable,
1515
)
1616

17-
# pylint: disable=missing-function-docstring,invalid-name,duplicate-code
18-
1917

2018
def test_SuccessResponse() -> None:
2119
response = SuccessResponse(sentinel.result, sentinel.id)

tests/test_result.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
)
1414
from jsonrpcserver.sentinels import NODATA
1515

16-
# pylint: disable=missing-function-docstring,invalid-name
17-
1816

1917
def test_SuccessResult() -> None:
2018
assert SuccessResult(None).result is None

tests/test_sentinels.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
from jsonrpcserver.sentinels import Sentinel
44

5-
# pylint: disable=missing-function-docstring
6-
75

86
def test_sentinel() -> None:
97
assert repr(Sentinel("foo")) == "<foo>"

tests/test_server.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
from jsonrpcserver.server import serve
66

7-
# pylint: disable=missing-function-docstring
8-
97

108
@patch("jsonrpcserver.server.HTTPServer")
119
def test_serve(*_: Mock) -> None:

0 commit comments

Comments
 (0)