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