Only pep8 violations fix

fix pep8 violations

fix tox configurtion for pep8

fix pretty print for actions that return a response body

Change-Id: I39a529bda8780649a5159761af7103eee8520412
This commit is contained in:
Vipul Sabhaya
2012-10-30 13:47:05 -07:00
parent 88c74ba804
commit 844492a8eb
9 changed files with 41 additions and 34 deletions

View File

@@ -209,6 +209,7 @@ COMMANDS = {'auth': common.Auth,
'version': VersionCommands, 'version': VersionCommands,
} }
def main(): def main():
# Parse arguments # Parse arguments
load_file = True load_file = True

View File

@@ -274,7 +274,6 @@ class ReddwarfHTTPClient(httplib2.Http):
self.service_url = service_url self.service_url = service_url
class Dbaas(object): class Dbaas(object):
""" """
Top-level object to access the Rackspace Database as a Service API. Top-level object to access the Rackspace Database as a Service API.

View File

@@ -111,7 +111,6 @@ class CliOptions(object):
print("ERROR: Token file found at %s was corrupt." % cls.APITOKEN) print("ERROR: Token file found at %s was corrupt." % cls.APITOKEN)
return cls.default() return cls.default()
@classmethod @classmethod
def save_from_instance_fields(cls, instance): def save_from_instance_fields(cls, instance):
apitoken = cls.default() apitoken = cls.default()
@@ -121,7 +120,6 @@ class CliOptions(object):
with open(cls.APITOKEN, 'wb') as token: with open(cls.APITOKEN, 'wb') as token:
pickle.dump(apitoken, token, protocol=2) pickle.dump(apitoken, token, protocol=2)
@classmethod @classmethod
def create_optparser(cls, load_file): def create_optparser(cls, load_file):
oparser = optparse.OptionParser( oparser = optparse.OptionParser(
@@ -131,6 +129,7 @@ class CliOptions(object):
file = cls.load_from_file() file = cls.load_from_file()
else: else:
file = cls.default() file = cls.default()
def add_option(*args, **kwargs): def add_option(*args, **kwargs):
if len(args) == 1: if len(args) == 1:
name = args[0] name = args[0]
@@ -165,7 +164,6 @@ class CliOptions(object):
add_option("token", help="Token from a prior login.") add_option("token", help="Token from a prior login.")
add_option("xml", action="store_true", help="Changes format to XML.") add_option("xml", action="store_true", help="Changes format to XML.")
oparser.add_option("--secure", action="store_false", dest="insecure", oparser.add_option("--secure", action="store_false", dest="insecure",
help="Run in insecure mode for https endpoints.") help="Run in insecure mode for https endpoints.")
oparser.add_option("--json", action="store_false", dest="xml", oparser.add_option("--json", action="store_false", dest="xml",
@@ -256,6 +254,7 @@ class CommandsBase(object):
if self.verbose: if self.verbose:
self._safe_exec(func, *args, **kwargs) self._safe_exec(func, *args, **kwargs)
return # Skip this, since the verbose stuff will show up anyway. return # Skip this, since the verbose stuff will show up anyway.
def wrapped_func(): def wrapped_func():
result = func(*args, **kwargs) result = func(*args, **kwargs)
if result: if result:

View File

@@ -35,8 +35,8 @@ class DiagnosticsInterrogator(base.ManagerWithFind):
""" """
Get the diagnostics of the guest on the instance. Get the diagnostics of the guest on the instance.
""" """
return self._get("/mgmt/instances/%s/diagnostics" % base.getid(instance), return self._get("/mgmt/instances/%s/diagnostics" %
"diagnostics") base.getid(instance), "diagnostics")
class HwInfo(base.Resource): class HwInfo(base.Resource):

View File

@@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
class UnsupportedVersion(Exception): class UnsupportedVersion(Exception):
"""Indicates that the user is trying to use an unsupported """Indicates that the user is trying to use an unsupported
version of the API""" version of the API"""
@@ -55,6 +56,7 @@ class ResponseFormatError(Exception):
"""Could not parse the response format.""" """Could not parse the response format."""
pass pass
class AmbiguousEndpoints(Exception): class AmbiguousEndpoints(Exception):
"""Found more than one matching endpoint in Service Catalog.""" """Found more than one matching endpoint in Service Catalog."""
def __init__(self, endpoints=None): def __init__(self, endpoints=None):

View File

@@ -158,6 +158,7 @@ class Instances(base.ManagerWithFind):
Instances.resize_flavor = Instances.resize_instance Instances.resize_flavor = Instances.resize_instance
class InstanceStatus(object): class InstanceStatus(object):
ACTIVE = "ACTIVE" ACTIVE = "ACTIVE"

View File

@@ -24,6 +24,7 @@ LISTIFY = {
REQUEST_AS_LIST = set(['databases', 'users']) REQUEST_AS_LIST = set(['databases', 'users'])
def element_ancestors_match_list(element, list): def element_ancestors_match_list(element, list):
""" """
For element root at <foo><blah><root></blah></foo> matches against For element root at <foo><blah><root></blah></foo> matches against
@@ -55,6 +56,7 @@ def element_to_json(name, element):
else: else:
return element_to_dict(element) return element_to_dict(element)
def root_element_to_json(name, element): def root_element_to_json(name, element):
"""Returns a tuple of the root JSON value, plus the links if found.""" """Returns a tuple of the root JSON value, plus the links if found."""
if name == "rootEnabled": # Why oh why were we inconsistent here? :'( if name == "rootEnabled": # Why oh why were we inconsistent here? :'(

View File

@@ -11,3 +11,6 @@ deps =
commands = commands =
sphinx-build -b doctest {toxinidir}/docs/source {envtmpdir}/html sphinx-build -b doctest {toxinidir}/docs/source {envtmpdir}/html
sphinx-build -b html {toxinidir}/docs/source {envtmpdir}/html sphinx-build -b html {toxinidir}/docs/source {envtmpdir}/html
[testenv:pep8]
commands = pep8 --repeat --show-source --exclude=.venv,.tox,dist,doc reddwarfclient setup.py