diff options
author | Garrett Holmstrom <gholms@fedoraproject.org> | 2012-03-10 22:14:46 -0800 |
---|---|---|
committer | Mitch Garnaat <mitch@garnaat.com> | 2012-03-27 10:26:25 -0700 |
commit | 39dd0940467680cb7e6e6e7dfd0c94d7d0a9b584 (patch) | |
tree | a617a9cb360c4e1ee9341a16df72f0f8c4ac8c65 | |
parent | ca67a94fe4f01b5c4ced5457c632b1e4cdda7fc1 (diff) | |
download | boto-39dd0940467680cb7e6e6e7dfd0c94d7d0a9b584.tar.gz |
Make relative imports explicit
34 files changed, 188 insertions, 188 deletions
diff --git a/boto/auth_handler.py b/boto/auth_handler.py index ab2d3170..e3aaa275 100644 --- a/boto/auth_handler.py +++ b/boto/auth_handler.py @@ -23,7 +23,7 @@ Defines an interface which all Auth handlers need to implement. """ -from plugin import Plugin +from .plugin import Plugin class NotReadyToAuthenticate(Exception): pass diff --git a/boto/cloudformation/__init__.py b/boto/cloudformation/__init__.py index 4f8e090b..bc32bbab 100644 --- a/boto/cloudformation/__init__.py +++ b/boto/cloudformation/__init__.py @@ -22,4 +22,4 @@ # this is here for backward compatibility # originally, the SNSConnection class was defined here -from connection import CloudFormationConnection +from .connection import CloudFormationConnection diff --git a/boto/cloudfront/origin.py b/boto/cloudfront/origin.py index 57af846e..95ec0d8a 100644 --- a/boto/cloudfront/origin.py +++ b/boto/cloudfront/origin.py @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -from identity import OriginAccessIdentity +from .identity import OriginAccessIdentity def get_oai_value(origin_access_identity): if isinstance(origin_access_identity, OriginAccessIdentity): diff --git a/boto/connection.py b/boto/connection.py index d169a23c..a6c03432 100644 --- a/boto/connection.py +++ b/boto/connection.py @@ -56,8 +56,8 @@ import time import urllib, urlparse import xml.sax -import auth -import auth_handler +from . import auth +from . import auth_handler import boto import boto.utils import boto.handler diff --git a/boto/emr/__init__.py b/boto/emr/__init__.py index 3c33f9a0..adb5dd03 100644 --- a/boto/emr/__init__.py +++ b/boto/emr/__init__.py @@ -23,8 +23,8 @@ This module provies an interface to the Elastic MapReduce (EMR) service from AWS. """ -from connection import EmrConnection -from step import Step, StreamingStep, JarStep -from bootstrap_action import BootstrapAction +from .connection import EmrConnection +from .step import Step, StreamingStep, JarStep +from .bootstrap_action import BootstrapAction diff --git a/boto/file/__init__.py b/boto/file/__init__.py index 0210b47c..60ecae4c 100755 --- a/boto/file/__init__.py +++ b/boto/file/__init__.py @@ -21,8 +21,8 @@ import boto -from connection import FileConnection as Connection -from key import Key -from bucket import Bucket +from .connection import FileConnection as Connection +from .key import Key +from .bucket import Bucket __all__ = ['Connection', 'Key', 'Bucket'] diff --git a/boto/file/bucket.py b/boto/file/bucket.py index 8aec6773..7640e2b8 100644 --- a/boto/file/bucket.py +++ b/boto/file/bucket.py @@ -23,7 +23,7 @@ # File representation of bucket, for use with "file://" URIs. import os -from key import Key +from .key import Key from boto.file.simpleresultset import SimpleResultSet from boto.s3.bucketlistresultset import BucketListResultSet diff --git a/boto/file/connection.py b/boto/file/connection.py index f453f71e..22ce4fca 100755 --- a/boto/file/connection.py +++ b/boto/file/connection.py @@ -21,7 +21,7 @@ # File representation of connection, for use with "file://" URIs. -from bucket import Bucket +from .bucket import Bucket class FileConnection(object): diff --git a/boto/iam/__init__.py b/boto/iam/__init__.py index 498d736b..72fb10a8 100644 --- a/boto/iam/__init__.py +++ b/boto/iam/__init__.py @@ -22,6 +22,6 @@ # this is here for backward compatibility # originally, the IAMConnection class was defined here -from connection import IAMConnection +from .connection import IAMConnection diff --git a/boto/jsonresponse.py b/boto/jsonresponse.py index 01e1f54f..4f907bc2 100644 --- a/boto/jsonresponse.py +++ b/boto/jsonresponse.py @@ -21,7 +21,7 @@ # IN THE SOFTWARE. import xml.sax -import utils +from . import utils class XmlHandler(xml.sax.ContentHandler): diff --git a/boto/manage/server.py b/boto/manage/server.py index 3c7a3032..1a89dd30 100644 --- a/boto/manage/server.py +++ b/boto/manage/server.py @@ -527,7 +527,7 @@ class Server(Model): def get_cmdshell(self): if not self._cmdshell: - import cmdshell + from . import cmdshell self.get_ssh_key_file() self._cmdshell = cmdshell.start(self) return self._cmdshell diff --git a/boto/roboto/awsqueryservice.py b/boto/roboto/awsqueryservice.py index 0ca78c2d..0bcdff30 100644 --- a/boto/roboto/awsqueryservice.py +++ b/boto/roboto/awsqueryservice.py @@ -4,7 +4,7 @@ import boto import boto.connection import boto.jsonresponse import boto.exception -import awsqueryrequest +from . import awsqueryrequest class NoCredentialsError(boto.exception.BotoClientError): diff --git a/boto/route53/__init__.py b/boto/route53/__init__.py index d404bc73..7f753e19 100644 --- a/boto/route53/__init__.py +++ b/boto/route53/__init__.py @@ -23,4 +23,4 @@ # this is here for backward compatibility # originally, the Route53Connection class was defined here -from connection import Route53Connection +from .connection import Route53Connection diff --git a/boto/route53/connection.py b/boto/route53/connection.py index a5183da1..d366efa8 100644 --- a/boto/route53/connection.py +++ b/boto/route53/connection.py @@ -30,8 +30,8 @@ from boto.connection import AWSAuthConnection from boto import handler from boto.resultset import ResultSet import boto.jsonresponse -import exception -import hostedzone +from . import exception +from . import hostedzone HZXML = """<?xml version="1.0" encoding="UTF-8"?> <CreateHostedZoneRequest xmlns="%(xmlns)s"> diff --git a/boto/s3/multipart.py b/boto/s3/multipart.py index a2930333..d0fb3b54 100644 --- a/boto/s3/multipart.py +++ b/boto/s3/multipart.py @@ -20,8 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -import user -import key +from . import user +from . import key from boto import handler import xml.sax diff --git a/boto/sdb/__init__.py b/boto/sdb/__init__.py index 15e763dd..a6326b3d 100644 --- a/boto/sdb/__init__.py +++ b/boto/sdb/__init__.py @@ -20,7 +20,7 @@ # IN THE SOFTWARE. # -from regioninfo import SDBRegionInfo +from .regioninfo import SDBRegionInfo def regions(): """ diff --git a/boto/sdb/db/manager/__init__.py b/boto/sdb/db/manager/__init__.py index 55b32a4d..64cea9f3 100644 --- a/boto/sdb/db/manager/__init__.py +++ b/boto/sdb/db/manager/__init__.py @@ -72,18 +72,18 @@ def get_manager(cls): elif hasattr(cls.__bases__[0], "_manager"): return cls.__bases__[0]._manager if db_type == 'SimpleDB': - from sdbmanager import SDBManager + from .sdbmanager import SDBManager return SDBManager(cls, db_name, db_user, db_passwd, db_host, db_port, db_table, sql_dir, enable_ssl) elif db_type == 'PostgreSQL': - from pgmanager import PGManager + from .pgmanager import PGManager if db_table: return PGManager(cls, db_name, db_user, db_passwd, db_host, db_port, db_table, sql_dir, enable_ssl) else: return None elif db_type == 'XML': - from xmlmanager import XMLManager + from .xmlmanager import XMLManager return XMLManager(cls, db_name, db_user, db_passwd, db_host, db_port, db_table, sql_dir, enable_ssl) else: diff --git a/boto/sdb/db/property.py b/boto/sdb/db/property.py index 1387be9d..e3789e7b 100644 --- a/boto/sdb/db/property.py +++ b/boto/sdb/db/property.py @@ -20,7 +20,7 @@ # IN THE SOFTWARE. import datetime -from key import Key +from .key import Key from boto.utils import Password from boto.sdb.db.query import Query import re diff --git a/boto/ses/__init__.py b/boto/ses/__init__.py index f893423d..01cf8dec 100644 --- a/boto/ses/__init__.py +++ b/boto/ses/__init__.py @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -from connection import SESConnection +from .connection import SESConnection from boto.regioninfo import RegionInfo def regions(): diff --git a/boto/sns/__init__.py b/boto/sns/__init__.py index 8d2682f7..1ae5d197 100644 --- a/boto/sns/__init__.py +++ b/boto/sns/__init__.py @@ -22,7 +22,7 @@ # this is here for backward compatibility # originally, the SNSConnection class was defined here -from connection import SNSConnection +from .connection import SNSConnection from boto.regioninfo import RegionInfo def regions(): diff --git a/boto/sqs/__init__.py b/boto/sqs/__init__.py index 744dd401..170ca1ea 100644 --- a/boto/sqs/__init__.py +++ b/boto/sqs/__init__.py @@ -20,7 +20,7 @@ # IN THE SOFTWARE. # -from regioninfo import SQSRegionInfo +from .regioninfo import SQSRegionInfo def regions(): """ diff --git a/boto/sts/__init__.py b/boto/sts/__init__.py index 7ee10b42..0d02c4ac 100644 --- a/boto/sts/__init__.py +++ b/boto/sts/__init__.py @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -from connection import STSConnection +from .connection import STSConnection from boto.regioninfo import RegionInfo def regions(): diff --git a/boto/sts/connection.py b/boto/sts/connection.py index 7b860309..c39fef81 100644 --- a/boto/sts/connection.py +++ b/boto/sts/connection.py @@ -22,7 +22,7 @@ from boto.connection import AWSQueryConnection from boto.regioninfo import RegionInfo -from credentials import Credentials, FederationToken +from .credentials import Credentials, FederationToken import boto import boto.utils import datetime diff --git a/tests/mturk/_init_environment.py b/tests/mturk/_init_environment.py index e709785a..5fb7fa30 100644 --- a/tests/mturk/_init_environment.py +++ b/tests/mturk/_init_environment.py @@ -1,24 +1,24 @@ -import os
-import functools
-
-live_connection = False
-mturk_host = 'mechanicalturk.sandbox.amazonaws.com'
-external_url = 'http://www.example.com/'
-
-try:
- local = os.path.join(os.path.dirname(__file__), 'local.py')
- execfile(local)
-except:
- pass
-
-if live_connection:
- #TODO: you must set the auth credentials to something valid
- from boto.mturk.connection import MTurkConnection
-else:
- # Here the credentials must be set, but it doesn't matter what
- # they're set to.
- os.environ.setdefault('AWS_ACCESS_KEY_ID', 'foo')
- os.environ.setdefault('AWS_SECRET_ACCESS_KEY', 'bar')
- from mocks import MTurkConnection
-
-SetHostMTurkConnection = functools.partial(MTurkConnection, host=mturk_host)
+import os +import functools + +live_connection = False +mturk_host = 'mechanicalturk.sandbox.amazonaws.com' +external_url = 'http://www.example.com/' + +try: + local = os.path.join(os.path.dirname(__file__), 'local.py') + execfile(local) +except: + pass + +if live_connection: + #TODO: you must set the auth credentials to something valid + from boto.mturk.connection import MTurkConnection +else: + # Here the credentials must be set, but it doesn't matter what + # they're set to. + os.environ.setdefault('AWS_ACCESS_KEY_ID', 'foo') + os.environ.setdefault('AWS_SECRET_ACCESS_KEY', 'bar') + from .mocks import MTurkConnection + +SetHostMTurkConnection = functools.partial(MTurkConnection, host=mturk_host) diff --git a/tests/mturk/all_tests.py b/tests/mturk/all_tests.py index ba2e1228..6a148e2d 100644 --- a/tests/mturk/all_tests.py +++ b/tests/mturk/all_tests.py @@ -3,11 +3,11 @@ import unittest import doctest from glob import glob -from create_hit_test import * -from create_hit_with_qualifications import * -from create_hit_external import * -from create_hit_with_qualifications import * -from hit_persistence import * +from .create_hit_test import * +from .create_hit_with_qualifications import * +from .create_hit_external import * +from .create_hit_with_qualifications import * +from .hit_persistence import * doctest_suite = doctest.DocFileSuite( *glob('*.doctest'), diff --git a/tests/mturk/cleanup_tests.py b/tests/mturk/cleanup_tests.py index 2381dd9b..cee8c28c 100644 --- a/tests/mturk/cleanup_tests.py +++ b/tests/mturk/cleanup_tests.py @@ -1,6 +1,6 @@ import itertools -from _init_environment import SetHostMTurkConnection +from ._init_environment import SetHostMTurkConnection def description_filter(substring): return lambda hit: substring in hit.Title diff --git a/tests/mturk/common.py b/tests/mturk/common.py index 40e2726c..94cc15cb 100644 --- a/tests/mturk/common.py +++ b/tests/mturk/common.py @@ -1,44 +1,44 @@ -import unittest
-import uuid
-import datetime
-
-from boto.mturk.question import (
- Question, QuestionContent, AnswerSpecification, FreeTextAnswer,
-)
-from _init_environment import SetHostMTurkConnection
-
-class MTurkCommon(unittest.TestCase):
- def setUp(self):
- self.conn = SetHostMTurkConnection()
-
- @staticmethod
- def get_question():
- # create content for a question
- qn_content = QuestionContent()
- qn_content.append_field('Title', 'Boto no hit type question content')
- qn_content.append_field('Text', 'What is a boto no hit type?')
-
- # create the question specification
- qn = Question(identifier=str(uuid.uuid4()),
- content=qn_content,
- answer_spec=AnswerSpecification(FreeTextAnswer()))
- return qn
-
- @staticmethod
- def get_hit_params():
- return dict(
- lifetime=datetime.timedelta(minutes=65),
- max_assignments=2,
- title='Boto create_hit title',
- description='Boto create_hit description',
- keywords=['boto', 'test'],
- reward=0.23,
- duration=datetime.timedelta(minutes=6),
- approval_delay=60*60,
- annotation='An annotation from boto create_hit test',
- response_groups=['Minimal',
- 'HITDetail',
- 'HITQuestion',
- 'HITAssignmentSummary',],
- )
-
+import unittest +import uuid +import datetime + +from boto.mturk.question import ( + Question, QuestionContent, AnswerSpecification, FreeTextAnswer, +) +from ._init_environment import SetHostMTurkConnection + +class MTurkCommon(unittest.TestCase): + def setUp(self): + self.conn = SetHostMTurkConnection() + + @staticmethod + def get_question(): + # create content for a question + qn_content = QuestionContent() + qn_content.append_field('Title', 'Boto no hit type question content') + qn_content.append_field('Text', 'What is a boto no hit type?') + + # create the question specification + qn = Question(identifier=str(uuid.uuid4()), + content=qn_content, + answer_spec=AnswerSpecification(FreeTextAnswer())) + return qn + + @staticmethod + def get_hit_params(): + return dict( + lifetime=datetime.timedelta(minutes=65), + max_assignments=2, + title='Boto create_hit title', + description='Boto create_hit description', + keywords=['boto', 'test'], + reward=0.23, + duration=datetime.timedelta(minutes=6), + approval_delay=60*60, + annotation='An annotation from boto create_hit test', + response_groups=['Minimal', + 'HITDetail', + 'HITQuestion', + 'HITAssignmentSummary',], + ) + diff --git a/tests/mturk/create_hit_external.py b/tests/mturk/create_hit_external.py index 9e955a65..86c3cf2a 100644 --- a/tests/mturk/create_hit_external.py +++ b/tests/mturk/create_hit_external.py @@ -3,7 +3,7 @@ import uuid import datetime from boto.mturk.question import ExternalQuestion -from _init_environment import SetHostMTurkConnection, external_url +from ._init_environment import SetHostMTurkConnection, external_url class Test(unittest.TestCase): def test_create_hit_external(self): diff --git a/tests/mturk/create_hit_test.py b/tests/mturk/create_hit_test.py index ea134b4c..320515d7 100644 --- a/tests/mturk/create_hit_test.py +++ b/tests/mturk/create_hit_test.py @@ -1,21 +1,21 @@ -import unittest
-import os
-from boto.mturk.question import QuestionForm
-
-from common import MTurkCommon
-
-class TestHITCreation(MTurkCommon):
- def testCallCreateHitWithOneQuestion(self):
- create_hit_rs = self.conn.create_hit(
- question=self.get_question(),
- **self.get_hit_params()
- )
-
- def testCallCreateHitWithQuestionForm(self):
- create_hit_rs = self.conn.create_hit(
- questions=QuestionForm([self.get_question()]),
- **self.get_hit_params()
- )
-
-if __name__ == '__main__':
- unittest.main()
+import unittest +import os +from boto.mturk.question import QuestionForm + +from .common import MTurkCommon + +class TestHITCreation(MTurkCommon): + def testCallCreateHitWithOneQuestion(self): + create_hit_rs = self.conn.create_hit( + question=self.get_question(), + **self.get_hit_params() + ) + + def testCallCreateHitWithQuestionForm(self): + create_hit_rs = self.conn.create_hit( + questions=QuestionForm([self.get_question()]), + **self.get_hit_params() + ) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/mturk/hit_persistence.py b/tests/mturk/hit_persistence.py index 04ebd0c2..812f10f2 100644 --- a/tests/mturk/hit_persistence.py +++ b/tests/mturk/hit_persistence.py @@ -1,27 +1,27 @@ -import unittest
-import pickle
-
-from common import MTurkCommon
-
-class TestHITPersistence(MTurkCommon):
- def create_hit_result(self):
- return self.conn.create_hit(
- question=self.get_question(), **self.get_hit_params()
- )
-
- def test_pickle_hit_result(self):
- result = self.create_hit_result()
- new_result = pickle.loads(pickle.dumps(result))
-
- def test_pickle_deserialized_version(self):
- """
- It seems the technique used to store and reload the object must
- result in an equivalent object, or subsequent pickles may fail.
- This tests a double-pickle to elicit that error.
- """
- result = self.create_hit_result()
- new_result = pickle.loads(pickle.dumps(result))
- pickle.dumps(new_result)
-
-if __name__ == '__main__':
- unittest.main()
+import unittest +import pickle + +from .common import MTurkCommon + +class TestHITPersistence(MTurkCommon): + def create_hit_result(self): + return self.conn.create_hit( + question=self.get_question(), **self.get_hit_params() + ) + + def test_pickle_hit_result(self): + result = self.create_hit_result() + new_result = pickle.loads(pickle.dumps(result)) + + def test_pickle_deserialized_version(self): + """ + It seems the technique used to store and reload the object must + result in an equivalent object, or subsequent pickles may fail. + This tests a double-pickle to elicit that error. + """ + result = self.create_hit_result() + new_result = pickle.loads(pickle.dumps(result)) + pickle.dumps(new_result) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/mturk/test_disable_hit.py b/tests/mturk/test_disable_hit.py index 09134433..2368d890 100644 --- a/tests/mturk/test_disable_hit.py +++ b/tests/mturk/test_disable_hit.py @@ -1,11 +1,11 @@ -from boto.mturk.test.support import unittest
-
-from common import MTurkCommon
-from boto.mturk.connection import MTurkRequestError
-
-class TestDisableHITs(MTurkCommon):
- def test_disable_invalid_hit(self):
- self.assertRaises(MTurkRequestError, self.conn.disable_hit, 'foo')
-
-if __name__ == '__main__':
- unittest.main()
+from boto.mturk.test.support import unittest + +from .common import MTurkCommon +from boto.mturk.connection import MTurkRequestError + +class TestDisableHITs(MTurkCommon): + def test_disable_invalid_hit(self): + self.assertRaises(MTurkRequestError, self.conn.disable_hit, 'foo') + +if __name__ == '__main__': + unittest.main() diff --git a/tests/s3/test_resumable_downloads.py b/tests/s3/test_resumable_downloads.py index 38be659b..ac53517d 100755 --- a/tests/s3/test_resumable_downloads.py +++ b/tests/s3/test_resumable_downloads.py @@ -45,7 +45,7 @@ from boto.s3.resumable_download_handler import ResumableDownloadHandler from boto.exception import ResumableTransferDisposition from boto.exception import ResumableDownloadException from boto.exception import StorageResponseError -from cb_test_harnass import CallbackTestHarnass +from .cb_test_harnass import CallbackTestHarnass # We don't use the OAuth2 authentication plugin directly; importing it here # ensures that it's loaded and available by default. diff --git a/tests/s3/test_resumable_uploads.py b/tests/s3/test_resumable_uploads.py index 7dabfe08..aeb4ef87 100755 --- a/tests/s3/test_resumable_uploads.py +++ b/tests/s3/test_resumable_uploads.py @@ -45,7 +45,7 @@ from boto.exception import InvalidUriError from boto.exception import ResumableTransferDisposition from boto.exception import ResumableUploadException from boto.exception import StorageResponseError -from cb_test_harnass import CallbackTestHarnass +from .cb_test_harnass import CallbackTestHarnass # We don't use the OAuth2 authentication plugin directly; importing it here # ensures that it's loaded and available by default. diff --git a/tests/test.py b/tests/test.py index e9af4404..bb5ef6e3 100755 --- a/tests/test.py +++ b/tests/test.py @@ -29,26 +29,26 @@ import sys import unittest import getopt -from sqs.test_connection import SQSConnectionTest -from s3.test_connection import S3ConnectionTest -from s3.test_versioning import S3VersionTest -from s3.test_mfa import S3MFATest -from s3.test_encryption import S3EncryptionTest -from s3.test_bucket import S3BucketTest -from s3.test_key import S3KeyTest -from s3.test_multidelete import S3MultiDeleteTest -from s3.test_multipart import S3MultiPartUploadTest -from s3.test_gsconnection import GSConnectionTest -from s3.test_https_cert_validation import CertValidationTest -from ec2.test_connection import EC2ConnectionTest -from ec2.elb.test_connection import ELBConnectionTest -from ec2.cloudwatch.test_connection import CloudWatchConnectionTest -from autoscale.test_connection import AutoscaleConnectionTest -from sdb.test_connection import SDBConnectionTest -from cloudfront.test_signed_urls import CloudfrontSignedUrlsTest -from dynamodb.test_layer1 import DynamoDBLayer1Test -from dynamodb.test_layer2 import DynamoDBLayer2Test -from sts.test_session_token import SessionTokenTest +from .sqs.test_connection import SQSConnectionTest +from .s3.test_connection import S3ConnectionTest +from .s3.test_versioning import S3VersionTest +from .s3.test_mfa import S3MFATest +from .s3.test_encryption import S3EncryptionTest +from .s3.test_bucket import S3BucketTest +from .s3.test_key import S3KeyTest +from .s3.test_multidelete import S3MultiDeleteTest +from .s3.test_multipart import S3MultiPartUploadTest +from .s3.test_gsconnection import GSConnectionTest +from .s3.test_https_cert_validation import CertValidationTest +from .ec2.test_connection import EC2ConnectionTest +from .ec2.elb.test_connection import ELBConnectionTest +from .ec2.cloudwatch.test_connection import CloudWatchConnectionTest +from .autoscale.test_connection import AutoscaleConnectionTest +from .sdb.test_connection import SDBConnectionTest +from .cloudfront.test_signed_urls import CloudfrontSignedUrlsTest +from .dynamodb.test_layer1 import DynamoDBLayer1Test +from .dynamodb.test_layer2 import DynamoDBLayer2Test +from .sts.test_session_token import SessionTokenTest def usage(): print "test.py [-t testsuite] [-v verbosity]" |