Start using Pyflakes and Hacking
Instead of globally ignoring pyflakes and hacking warnings, only blacklist those that trigger very frequently so far, in order to clean them up in followup commits. Fix and start gating on the rest already. Change-Id: Ied7c7250061e3bf379e8286e8ce3b9e4af817faf
This commit is contained in:
@@ -145,8 +145,7 @@ class HTTPClient(object):
|
||||
|
||||
@staticmethod
|
||||
def encode_headers(headers):
|
||||
"""
|
||||
Encodes headers.
|
||||
"""Encodes headers.
|
||||
|
||||
Note: This should be used right before
|
||||
sending anything out.
|
||||
@@ -159,7 +158,7 @@ class HTTPClient(object):
|
||||
return dict([(to_str(h), to_str(v)) for h, v in headers.iteritems()])
|
||||
|
||||
def _http_request(self, url, method, **kwargs):
|
||||
""" Send an http request with the specified characteristics.
|
||||
"""Send an http request with the specified characteristics.
|
||||
|
||||
Wrapper around httplib.HTTP(S)Connection.request to handle tasks such
|
||||
as setting headers and error handling.
|
||||
|
||||
+12
-12
@@ -26,7 +26,7 @@ class BaseException(Exception):
|
||||
|
||||
|
||||
class CommandError(BaseException):
|
||||
"""Invalid usage of CLI"""
|
||||
"""Invalid usage of CLI."""
|
||||
|
||||
|
||||
class InvalidEndpoint(BaseException):
|
||||
@@ -38,11 +38,11 @@ class CommunicationError(BaseException):
|
||||
|
||||
|
||||
class ClientException(Exception):
|
||||
"""DEPRECATED"""
|
||||
"""DEPRECATED!"""
|
||||
|
||||
|
||||
class HTTPException(ClientException):
|
||||
"""Base exception for all HTTP-derived exceptions"""
|
||||
"""Base exception for all HTTP-derived exceptions."""
|
||||
code = 'N/A'
|
||||
|
||||
def __init__(self, details=None):
|
||||
@@ -63,7 +63,7 @@ class HTTPMultipleChoices(HTTPException):
|
||||
|
||||
|
||||
class BadRequest(HTTPException):
|
||||
"""DEPRECATED"""
|
||||
"""DEPRECATED!"""
|
||||
code = 400
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class HTTPBadRequest(BadRequest):
|
||||
|
||||
|
||||
class Unauthorized(HTTPException):
|
||||
"""DEPRECATED"""
|
||||
"""DEPRECATED!"""
|
||||
code = 401
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class HTTPUnauthorized(Unauthorized):
|
||||
|
||||
|
||||
class Forbidden(HTTPException):
|
||||
"""DEPRECATED"""
|
||||
"""DEPRECATED!"""
|
||||
code = 403
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ class HTTPForbidden(Forbidden):
|
||||
|
||||
|
||||
class NotFound(HTTPException):
|
||||
"""DEPRECATED"""
|
||||
"""DEPRECATED!"""
|
||||
code = 404
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ class HTTPMethodNotAllowed(HTTPException):
|
||||
|
||||
|
||||
class Conflict(HTTPException):
|
||||
"""DEPRECATED"""
|
||||
"""DEPRECATED!"""
|
||||
code = 409
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ class HTTPConflict(Conflict):
|
||||
|
||||
|
||||
class OverLimit(HTTPException):
|
||||
"""DEPRECATED"""
|
||||
"""DEPRECATED!"""
|
||||
code = 413
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ class HTTPBadGateway(HTTPException):
|
||||
|
||||
|
||||
class ServiceUnavailable(HTTPException):
|
||||
"""DEPRECATED"""
|
||||
"""DEPRECATED!"""
|
||||
code = 503
|
||||
|
||||
|
||||
@@ -161,12 +161,12 @@ def from_response(response, body=None):
|
||||
|
||||
|
||||
class NoTokenLookupException(Exception):
|
||||
"""DEPRECATED"""
|
||||
"""DEPRECATED!"""
|
||||
pass
|
||||
|
||||
|
||||
class EndpointNotFound(Exception):
|
||||
"""DEPRECATED"""
|
||||
"""DEPRECATED!"""
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import traceback
|
||||
|
||||
|
||||
def import_class(import_str):
|
||||
"""Returns a class from a string including module and class"""
|
||||
"""Returns a class from a string including module and class."""
|
||||
mod_str, _sep, class_str = import_str.rpartition('.')
|
||||
try:
|
||||
__import__(mod_str)
|
||||
|
||||
@@ -296,7 +296,7 @@ class OpenStackImagesShell(object):
|
||||
# Compatibility check to remove API version as the trailing component
|
||||
# in a service endpoint; also removes a trailing '/'
|
||||
def _strip_version(self, endpoint):
|
||||
"""Strip a version from the last component of an endpoint if present"""
|
||||
"""Strip version from the last component of endpoint if present."""
|
||||
|
||||
# Get rid of trailing '/' if present
|
||||
if endpoint.endswith('/'):
|
||||
|
||||
@@ -13,4 +13,4 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from glanceclient.v1.client import Client
|
||||
from glanceclient.v1.client import Client # noqa
|
||||
|
||||
@@ -29,7 +29,7 @@ class Client(http.HTTPClient):
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
""" Initialize a new client for the Images v1 API. """
|
||||
"""Initialize a new client for the Images v1 API."""
|
||||
super(Client, self).__init__(*args, **kwargs)
|
||||
self.images = images.ImageManager(self)
|
||||
self.image_members = image_members.ImageMemberManager(self)
|
||||
|
||||
@@ -44,16 +44,16 @@ class ImageMemberManager(base.Manager):
|
||||
if image and member:
|
||||
try:
|
||||
out.append(self.get(image, member))
|
||||
#TODO: narrow this down to 404
|
||||
except:
|
||||
#TODO(bcwaldon): narrow this down to 404
|
||||
except Exception:
|
||||
pass
|
||||
elif image:
|
||||
out.extend(self._list_by_image(image))
|
||||
elif member:
|
||||
out.extend(self._list_by_member(member))
|
||||
else:
|
||||
#TODO: figure out what is appropriate to do here as we are
|
||||
# unable to provide the requested response
|
||||
#TODO(bcwaldon): figure out what is appropriate to do here as we
|
||||
# are unable to provide the requested response
|
||||
pass
|
||||
return out
|
||||
|
||||
@@ -81,7 +81,7 @@ class ImageMemberManager(base.Manager):
|
||||
self._delete("/v1/images/%s/members/%s" % (image_id, member_id))
|
||||
|
||||
def create(self, image, member_id, can_share=False):
|
||||
"""Create an image"""
|
||||
"""Creates an image."""
|
||||
url = '/v1/images/%s/members/%s' % (base.getid(image), member_id)
|
||||
body = {'member': {'can_share': can_share}}
|
||||
self._update(url, body=body)
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from glanceclient.common import utils
|
||||
|
||||
|
||||
class Controller(object):
|
||||
def __init__(self, http_client, model):
|
||||
|
||||
@@ -52,7 +52,7 @@ def do_image_show(gc, args):
|
||||
@utils.arg('--image-id', metavar='<IMAGE_ID>', required=True,
|
||||
help='Image to display members of.')
|
||||
def do_member_list(gc, args):
|
||||
"""Describe sharing permissions by image"""
|
||||
"""Describe sharing permissions by image."""
|
||||
|
||||
members = gc.image_members.list(args.image_id)
|
||||
columns = ['Image ID', 'Member ID', 'Status']
|
||||
|
||||
Reference in New Issue
Block a user