Permalink
Browse files

Make relative imports explicit

  • Loading branch information...
gholms authored and garnaat committed Mar 11, 2012
1 parent ca67a94 commit 39dd0940467680cb7e6e6e7dfd0c94d7d0a9b584
View
@@ -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
@@ -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
@@ -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):
View
@@ -56,8 +56,8 @@
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
View
@@ -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
View
@@ -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']
View
@@ -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
View
@@ -21,7 +21,7 @@
# File representation of connection, for use with "file://" URIs.
-from bucket import Bucket
+from .bucket import Bucket
class FileConnection(object):
View
@@ -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
View
@@ -21,7 +21,7 @@
# IN THE SOFTWARE.
import xml.sax
-import utils
+from . import utils
class XmlHandler(xml.sax.ContentHandler):
View
@@ -527,7 +527,7 @@ def get_ssh_key_file(self):
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
@@ -4,7 +4,7 @@
import boto.connection
import boto.jsonresponse
import boto.exception
-import awsqueryrequest
+from . import awsqueryrequest
class NoCredentialsError(boto.exception.BotoClientError):
View
@@ -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
@@ -30,8 +30,8 @@
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">
View
@@ -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
View
@@ -20,7 +20,7 @@
# IN THE SOFTWARE.
#
-from regioninfo import SDBRegionInfo
+from .regioninfo import SDBRegionInfo
def regions():
"""
@@ -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:
View
@@ -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
View
@@ -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():
View
@@ -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():
View
@@ -20,7 +20,7 @@
# IN THE SOFTWARE.
#
-from regioninfo import SQSRegionInfo
+from .regioninfo import SQSRegionInfo
def regions():
"""
View
@@ -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():
View
@@ -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
@@ -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)
View
@@ -3,11 +3,11 @@
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'),
@@ -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
View
@@ -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',],
+ )
+
@@ -3,7 +3,7 @@
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):
Oops, something went wrong.

0 comments on commit 39dd094

Please sign in to comment.