Cleanup Imports to match HACKING guidelines
found using https://github.com/cloudscaling/nova-HACKING Change-Id: Ic010f0407e7a139f0f6436af2e72e817c140a4c3
This commit is contained in:
@@ -60,7 +60,7 @@ import glob
|
|||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
import netaddr
|
import netaddr
|
||||||
from optparse import OptionParser
|
import optparse
|
||||||
import os
|
import os
|
||||||
import StringIO
|
import StringIO
|
||||||
import sys
|
import sys
|
||||||
@@ -2355,7 +2355,7 @@ def main():
|
|||||||
options = getattr(fn, 'options', [])
|
options = getattr(fn, 'options', [])
|
||||||
|
|
||||||
usage = "%%prog %s %s <args> [options]" % (category, action)
|
usage = "%%prog %s %s <args> [options]" % (category, action)
|
||||||
parser = OptionParser(usage=usage)
|
parser = optparse.OptionParser(usage=usage)
|
||||||
for ar, kw in options:
|
for ar, kw in options:
|
||||||
parser.add_option(*ar, **kw)
|
parser.add_option(*ar, **kw)
|
||||||
(opts, fn_args) = parser.parse_args(argv)
|
(opts, fn_args) = parser.parse_args(argv)
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
Module dedicated functions/classes dealing with rate limiting requests.
|
Module dedicated functions/classes dealing with rate limiting requests.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from collections import defaultdict
|
import collections
|
||||||
import copy
|
import copy
|
||||||
import httplib
|
import httplib
|
||||||
import json
|
import json
|
||||||
@@ -283,7 +283,7 @@ class Limiter(object):
|
|||||||
@param limits: List of `Limit` objects
|
@param limits: List of `Limit` objects
|
||||||
"""
|
"""
|
||||||
self.limits = copy.deepcopy(limits)
|
self.limits = copy.deepcopy(limits)
|
||||||
self.levels = defaultdict(lambda: copy.deepcopy(limits))
|
self.levels = collections.defaultdict(lambda: copy.deepcopy(limits))
|
||||||
|
|
||||||
# Pick up any per-user limit information
|
# Pick up any per-user limit information
|
||||||
for key, value in kwargs.items():
|
for key, value in kwargs.items():
|
||||||
|
@@ -34,9 +34,8 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
|||||||
|
|
||||||
import boto
|
import boto
|
||||||
import nova
|
import nova
|
||||||
from boto.ec2.connection import EC2Connection
|
import boto.ec2.connection
|
||||||
import euca2ools
|
import euca2ools
|
||||||
from euca2ools import Euca2ool, InstanceValidationError, Util
|
|
||||||
|
|
||||||
usage_string = """
|
usage_string = """
|
||||||
Retrieves a url to an ajax console terminal
|
Retrieves a url to an ajax console terminal
|
||||||
@@ -53,7 +52,7 @@ OPTIONAL PARAMETERS
|
|||||||
|
|
||||||
|
|
||||||
# This class extends boto to add AjaxConsole functionality
|
# This class extends boto to add AjaxConsole functionality
|
||||||
class NovaEC2Connection(EC2Connection):
|
class NovaEC2Connection(boto.ec2.connection.EC2Connection):
|
||||||
|
|
||||||
def get_ajax_console(self, instance_id):
|
def get_ajax_console(self, instance_id):
|
||||||
"""
|
"""
|
||||||
@@ -104,12 +103,12 @@ euca2ools.EC2Connection = NovaEC2Connection
|
|||||||
|
|
||||||
def usage(status=1):
|
def usage(status=1):
|
||||||
print usage_string
|
print usage_string
|
||||||
Util().usage()
|
euca2ools.Util().usage()
|
||||||
sys.exit(status)
|
sys.exit(status)
|
||||||
|
|
||||||
|
|
||||||
def version():
|
def version():
|
||||||
print Util().version()
|
print euca2ools.Util().version()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
@@ -125,7 +124,7 @@ def display_ajax_console_output(console_output):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
euca = Euca2ool()
|
euca = euca2ools.Euca2ool()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
usage()
|
usage()
|
||||||
@@ -147,7 +146,7 @@ def main():
|
|||||||
if instance_id:
|
if instance_id:
|
||||||
try:
|
try:
|
||||||
euca.validate_instance_id(instance_id)
|
euca.validate_instance_id(instance_id)
|
||||||
except InstanceValidationError:
|
except euca2ools.InstanceValidationError:
|
||||||
print 'Invalid instance id'
|
print 'Invalid instance id'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user