Fixing D204, D205, D208, and D211 pep8

Curently tox ignores D204, D205, D208, and D211.
D204: 1 blank required after class docstring.
D205: Blank line required between one-line summary and description.
D208: Docstring is over-indented.
D211: No blank lines allowed before class docstring.
This patch removes tox ignores and fix docstrings.

Change-Id: I691f728e7b12ad4fcd542a116fd3d491e83393a4
This commit is contained in:
Navid Pustchi 2016-04-19 06:59:58 +00:00
parent 2caee11017
commit f95a3bb6bc
6 changed files with 32 additions and 6 deletions

View File

@ -16,6 +16,7 @@ __all__ = ('ClientException',)
class ClientException(Exception): class ClientException(Exception):
"""The base exception for everything to do with clients.""" """The base exception for everything to do with clients."""
message = None message = None
def __init__(self, message=None): def __init__(self, message=None):

View File

@ -23,6 +23,7 @@ __all__ = ('ConnectionError',
class RetriableConnectionFailure(Exception): class RetriableConnectionFailure(Exception):
"""A mixin class that implies you can retry the most recent request.""" """A mixin class that implies you can retry the most recent request."""
pass pass

View File

@ -64,6 +64,7 @@ __all__ = ('HttpError',
class HttpError(base.ClientException): class HttpError(base.ClientException):
"""The base exception class for all HTTP exceptions.""" """The base exception class for all HTTP exceptions."""
http_status = 0 http_status = 0
message = "HTTP Error" message = "HTTP Error"
@ -90,6 +91,7 @@ class HTTPClientError(HttpError):
Exception for cases in which the client seems to have erred. Exception for cases in which the client seems to have erred.
""" """
message = "HTTP Client Error" message = "HTTP Client Error"
@ -99,6 +101,7 @@ class HttpServerError(HttpError):
Exception for cases in which the server is aware that it has Exception for cases in which the server is aware that it has
erred or is incapable of performing the request. erred or is incapable of performing the request.
""" """
message = "HTTP Server Error" message = "HTTP Server Error"
@ -107,6 +110,7 @@ class BadRequest(HTTPClientError):
The request cannot be fulfilled due to bad syntax. The request cannot be fulfilled due to bad syntax.
""" """
http_status = 400 http_status = 400
message = "Bad Request" message = "Bad Request"
@ -117,6 +121,7 @@ class Unauthorized(HTTPClientError):
Similar to 403 Forbidden, but specifically for use when authentication Similar to 403 Forbidden, but specifically for use when authentication
is required and has failed or has not yet been provided. is required and has failed or has not yet been provided.
""" """
http_status = 401 http_status = 401
message = "Unauthorized" message = "Unauthorized"
@ -126,6 +131,7 @@ class PaymentRequired(HTTPClientError):
Reserved for future use. Reserved for future use.
""" """
http_status = 402 http_status = 402
message = "Payment Required" message = "Payment Required"
@ -136,6 +142,7 @@ class Forbidden(HTTPClientError):
The request was a valid request, but the server is refusing to respond The request was a valid request, but the server is refusing to respond
to it. to it.
""" """
http_status = 403 http_status = 403
message = "Forbidden" message = "Forbidden"
@ -146,6 +153,7 @@ class NotFound(HTTPClientError):
The requested resource could not be found but may be available again The requested resource could not be found but may be available again
in the future. in the future.
""" """
http_status = 404 http_status = 404
message = "Not Found" message = "Not Found"
@ -156,6 +164,7 @@ class MethodNotAllowed(HTTPClientError):
A request was made of a resource using a request method not supported A request was made of a resource using a request method not supported
by that resource. by that resource.
""" """
http_status = 405 http_status = 405
message = "Method Not Allowed" message = "Method Not Allowed"
@ -166,6 +175,7 @@ class NotAcceptable(HTTPClientError):
The requested resource is only capable of generating content not The requested resource is only capable of generating content not
acceptable according to the Accept headers sent in the request. acceptable according to the Accept headers sent in the request.
""" """
http_status = 406 http_status = 406
message = "Not Acceptable" message = "Not Acceptable"
@ -175,6 +185,7 @@ class ProxyAuthenticationRequired(HTTPClientError):
The client must first authenticate itself with the proxy. The client must first authenticate itself with the proxy.
""" """
http_status = 407 http_status = 407
message = "Proxy Authentication Required" message = "Proxy Authentication Required"
@ -184,6 +195,7 @@ class RequestTimeout(HTTPClientError):
The server timed out waiting for the request. The server timed out waiting for the request.
""" """
http_status = 408 http_status = 408
message = "Request Timeout" message = "Request Timeout"
@ -194,6 +206,7 @@ class Conflict(HTTPClientError):
Indicates that the request could not be processed because of conflict Indicates that the request could not be processed because of conflict
in the request, such as an edit conflict. in the request, such as an edit conflict.
""" """
http_status = 409 http_status = 409
message = "Conflict" message = "Conflict"
@ -204,6 +217,7 @@ class Gone(HTTPClientError):
Indicates that the resource requested is no longer available and will Indicates that the resource requested is no longer available and will
not be available again. not be available again.
""" """
http_status = 410 http_status = 410
message = "Gone" message = "Gone"
@ -214,6 +228,7 @@ class LengthRequired(HTTPClientError):
The request did not specify the length of its content, which is The request did not specify the length of its content, which is
required by the requested resource. required by the requested resource.
""" """
http_status = 411 http_status = 411
message = "Length Required" message = "Length Required"
@ -224,6 +239,7 @@ class PreconditionFailed(HTTPClientError):
The server does not meet one of the preconditions that the requester The server does not meet one of the preconditions that the requester
put on the request. put on the request.
""" """
http_status = 412 http_status = 412
message = "Precondition Failed" message = "Precondition Failed"
@ -233,6 +249,7 @@ class RequestEntityTooLarge(HTTPClientError):
The request is larger than the server is willing or able to process. The request is larger than the server is willing or able to process.
""" """
http_status = 413 http_status = 413
message = "Request Entity Too Large" message = "Request Entity Too Large"
@ -250,6 +267,7 @@ class RequestUriTooLong(HTTPClientError):
The URI provided was too long for the server to process. The URI provided was too long for the server to process.
""" """
http_status = 414 http_status = 414
message = "Request-URI Too Long" message = "Request-URI Too Long"
@ -260,6 +278,7 @@ class UnsupportedMediaType(HTTPClientError):
The request entity has a media type which the server or resource does The request entity has a media type which the server or resource does
not support. not support.
""" """
http_status = 415 http_status = 415
message = "Unsupported Media Type" message = "Unsupported Media Type"
@ -270,6 +289,7 @@ class RequestedRangeNotSatisfiable(HTTPClientError):
The client has asked for a portion of the file, but the server cannot The client has asked for a portion of the file, but the server cannot
supply that portion. supply that portion.
""" """
http_status = 416 http_status = 416
message = "Requested Range Not Satisfiable" message = "Requested Range Not Satisfiable"
@ -279,6 +299,7 @@ class ExpectationFailed(HTTPClientError):
The server cannot meet the requirements of the Expect request-header field. The server cannot meet the requirements of the Expect request-header field.
""" """
http_status = 417 http_status = 417
message = "Expectation Failed" message = "Expectation Failed"
@ -289,6 +310,7 @@ class UnprocessableEntity(HTTPClientError):
The request was well-formed but was unable to be followed due to semantic The request was well-formed but was unable to be followed due to semantic
errors. errors.
""" """
http_status = 422 http_status = 422
message = "Unprocessable Entity" message = "Unprocessable Entity"
@ -298,6 +320,7 @@ class InternalServerError(HttpServerError):
A generic error message, given when no more specific message is suitable. A generic error message, given when no more specific message is suitable.
""" """
http_status = 500 http_status = 500
message = "Internal Server Error" message = "Internal Server Error"
@ -309,6 +332,7 @@ class HttpNotImplemented(HttpServerError):
The server either does not recognize the request method, or it lacks The server either does not recognize the request method, or it lacks
the ability to fulfill the request. the ability to fulfill the request.
""" """
http_status = 501 http_status = 501
message = "Not Implemented" message = "Not Implemented"
@ -319,6 +343,7 @@ class BadGateway(HttpServerError):
The server was acting as a gateway or proxy and received an invalid The server was acting as a gateway or proxy and received an invalid
response from the upstream server. response from the upstream server.
""" """
http_status = 502 http_status = 502
message = "Bad Gateway" message = "Bad Gateway"
@ -328,6 +353,7 @@ class ServiceUnavailable(HttpServerError):
The server is currently unavailable. The server is currently unavailable.
""" """
http_status = 503 http_status = 503
message = "Service Unavailable" message = "Service Unavailable"
@ -338,6 +364,7 @@ class GatewayTimeout(HttpServerError):
The server was acting as a gateway or proxy and did not receive a timely The server was acting as a gateway or proxy and did not receive a timely
response from the upstream server. response from the upstream server.
""" """
http_status = 504 http_status = 504
message = "Gateway Timeout" message = "Gateway Timeout"
@ -347,6 +374,7 @@ class HttpVersionNotSupported(HttpServerError):
The server does not support the HTTP protocol version used in the request. The server does not support the HTTP protocol version used in the request.
""" """
http_status = 505 http_status = 505
message = "HTTP Version Not Supported" message = "HTTP Version Not Supported"

View File

@ -790,6 +790,7 @@ class TCPKeepAliveAdapter(requests.adapters.HTTPAdapter):
disables Nagle's Algorithm. See also: disables Nagle's Algorithm. See also:
http://blogs.msdn.com/b/windowsazurestorage/archive/2010/06/25/nagle-s-algorithm-is-not-friendly-towards-small-requests.aspx http://blogs.msdn.com/b/windowsazurestorage/archive/2010/06/25/nagle-s-algorithm-is-not-friendly-towards-small-requests.aspx
""" """
def init_poolmanager(self, *args, **kwargs): def init_poolmanager(self, *args, **kwargs):
if 'socket_options' not in kwargs and REQUESTS_VERSION >= (2, 4, 1): if 'socket_options' not in kwargs and REQUESTS_VERSION >= (2, 4, 1):
socket_options = [ socket_options = [

View File

@ -24,7 +24,6 @@ REQUEST = {'auth': {'identity': {'methods': ['kerberos'],
class TestCase(test_utils.TestCase): class TestCase(test_utils.TestCase):
"""Test case base class for Kerberos unit tests.""" """Test case base class for Kerberos unit tests."""
TEST_V3_URL = test_utils.TestCase.TEST_ROOT_URL + 'v3' TEST_V3_URL = test_utils.TestCase.TEST_ROOT_URL + 'v3'

View File

@ -38,11 +38,7 @@ commands = oslo_debug_helper -t keystoneauth1/tests {posargs}
# D105: Missing docstring in magic method # D105: Missing docstring in magic method
# D200: One-line docstring should fit on one line with quotes # D200: One-line docstring should fit on one line with quotes
# D203: 1 blank required before class docstring. # D203: 1 blank required before class docstring.
# D204: 1 blank required after class docstring ignore = H405,D100,D101,D102,D103,D104,D105,D200,D203
# D205: Blank line required between one-line summary and description.
# D208: Docstring is over-indented
# D211: No blank lines allowed before class docstring
ignore = H405,D100,D101,D102,D103,D104,D105,D200,D203,D204,D205,D208,D211
show-source = True show-source = True
exclude = .venv,.tox,dist,doc,*egg,build,*openstack/common* exclude = .venv,.tox,dist,doc,*egg,build,*openstack/common*