Skip to content
This repository has been archived by the owner on Jun 27, 2018. It is now read-only.

Commit

Permalink
Appease PEP8 spacing guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
gholms committed Jun 8, 2012
1 parent 9539206 commit abbae16
Show file tree
Hide file tree
Showing 28 changed files with 145 additions and 146 deletions.
8 changes: 4 additions & 4 deletions boto/ec2/cloudwatch/alarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ class MetricAlarm(object):
INSUFFICIENT_DATA = 'INSUFFICIENT_DATA'

_cmp_map = {
'>=' : 'GreaterThanOrEqualToThreshold',
'>' : 'GreaterThanThreshold',
'<' : 'LessThanThreshold',
'<=' : 'LessThanOrEqualToThreshold',
'>=': 'GreaterThanOrEqualToThreshold',
'>': 'GreaterThanThreshold',
'<': 'LessThanThreshold',
'<=': 'LessThanOrEqualToThreshold',
}
_rev_cmp_map = dict((v, k) for (k, v) in _cmp_map.iteritems())

Expand Down
2 changes: 1 addition & 1 deletion boto/ec2/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def build_filter_params(self, params, filters):
value = [value]
j = 1
for v in value:
params['Filter.%d.Value.%d' % (i,j)] = v
params['Filter.%d.Value.%d' % (i, j)] = v
j += 1
i += 1

Expand Down
2 changes: 1 addition & 1 deletion boto/manage/cmdshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def connect(self):
username=self.uname,
pkey=self._pkey)
return
except socket.error, (value,message):
except socket.error, (value, message):
if value == 61 or value == 111:
print 'SSH Connection refused, will retry in 5 seconds'
time.sleep(5)
Expand Down
4 changes: 2 additions & 2 deletions boto/manage/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def get_snapshots(self):
snapshot.date = boto.utils.parse_ts(snapshot.start_time)
snapshot.keep = True
snaps.append(snapshot)
snaps.sort(cmp=lambda x,y: cmp(x.date, y.date))
snaps.sort(cmp=lambda x, y: cmp(x.date, y.date))
return snaps

def attach(self, server=None):
Expand Down Expand Up @@ -376,7 +376,7 @@ def trim_snapshots(self, delete=False):
for snap in partial_week[1:]:
snap.keep = False
# Keep the first snapshot of each week for the previous 4 weeks
for i in range(0,4):
for i in range(0, 4):
weeks_worth = self.get_snapshot_range(snaps, week_boundary-one_week, week_boundary)
if len(weeks_worth) > 1:
for snap in weeks_worth[1:]:
Expand Down
26 changes: 13 additions & 13 deletions boto/mturk/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ def create_hit(self, hit_type=None, question=None,

# Handle basic required arguments and set up params dict
params = {'Question': question_param.get_as_xml(),
'LifetimeInSeconds' :
'LifetimeInSeconds':
self.duration_as_seconds(lifetime),
'MaxAssignments' : max_assignments,
'MaxAssignments': max_assignments,
}

# if hit type specified then add it
Expand Down Expand Up @@ -351,23 +351,23 @@ def get_assignments(self, hit_id, status=None,
def approve_assignment(self, assignment_id, feedback=None):
"""
"""
params = {'AssignmentId' : assignment_id,}
params = {'AssignmentId': assignment_id,}
if feedback:
params['RequesterFeedback'] = feedback
return self._process_request('ApproveAssignment', params)

def reject_assignment(self, assignment_id, feedback=None):
"""
"""
params = {'AssignmentId' : assignment_id,}
params = {'AssignmentId': assignment_id,}
if feedback:
params['RequesterFeedback'] = feedback
return self._process_request('RejectAssignment', params)

def get_hit(self, hit_id, response_groups=None):
"""
"""
params = {'HITId' : hit_id,}
params = {'HITId': hit_id,}
# Handle optional response groups argument
if response_groups:
self.build_list_params(params, response_groups, 'ResponseGroup')
Expand All @@ -383,7 +383,7 @@ def set_reviewing(self, hit_id, revert=None):
Reviewing. Similarly, only Reviewing HITs can be reverted back to a
status of Reviewable.
"""
params = {'HITId' : hit_id,}
params = {'HITId': hit_id,}
if revert:
params['Revert'] = revert
return self._process_request('SetHITAsReviewing', params)
Expand All @@ -405,7 +405,7 @@ def disable_hit(self, hit_id, response_groups=None):
It is not possible to re-enable a HIT once it has been disabled.
To make the work from a disabled HIT available again, create a new HIT.
"""
params = {'HITId' : hit_id,}
params = {'HITId': hit_id,}
# Handle optional response groups argument
if response_groups:
self.build_list_params(params, response_groups, 'ResponseGroup')
Expand All @@ -422,7 +422,7 @@ def dispose_hit(self, hit_id):
reviewable, then call GetAssignmentsForHIT to retrieve the
assignments. Disposing of a HIT removes the HIT from the
results of a call to GetReviewableHITs. """
params = {'HITId' : hit_id,}
params = {'HITId': hit_id,}
return self._process_request('DisposeHIT', params)

def expire_hit(self, hit_id):
Expand All @@ -439,7 +439,7 @@ def expire_hit(self, hit_id):
submitted, the expired HIT becomes"reviewable", and will be
returned by a call to GetReviewableHITs.
"""
params = {'HITId' : hit_id,}
params = {'HITId': hit_id,}
return self._process_request('ForceExpireHIT', params)

def extend_hit(self, hit_id, assignments_increment=None, expiration_increment=None):
Expand All @@ -461,7 +461,7 @@ def extend_hit(self, hit_id, assignments_increment=None, expiration_increment=No
(assignments_increment is not None and expiration_increment is not None):
raise ValueError("Must specify either assignments_increment or expiration_increment, but not both")

params = {'HITId' : hit_id,}
params = {'HITId': hit_id,}
if assignments_increment:
params['MaxAssignmentsIncrement'] = assignments_increment
if expiration_increment:
Expand Down Expand Up @@ -568,9 +568,9 @@ def create_qualification_type(self,
"""

params = {'Name' : name,
'Description' : description,
'QualificationTypeStatus' : status,
params = {'Name': name,
'Description': description,
'QualificationTypeStatus': status,
}
if retry_delay is not None:
params['RetryDelayInSeconds'] = retry_delay
Expand Down
2 changes: 1 addition & 1 deletion boto/mturk/qualification.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_as_params(self):
for n, req in enumerate(self.requirements):
reqparams = req.get_as_params()
for rp in reqparams:
params['QualificationRequirement.%s.%s' % ((n+1),rp) ] = reqparams[rp]
params['QualificationRequirement.%s.%s' % ((n+1), rp) ] = reqparams[rp]
return params


Expand Down
4 changes: 2 additions & 2 deletions boto/mturk/question.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ class Constraint(object):
def get_attributes(self):
pairs = zip(self.attribute_names, self.attribute_values)
attrs = ' '.join(
'%s="%d"' % (name,value)
for (name,value) in pairs
'%s="%d"' % (name, value)
for (name, value) in pairs
if value is not None
)
return attrs
Expand Down
112 changes: 56 additions & 56 deletions boto/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,93 +65,93 @@
class Provider(object):

CredentialMap = {
'aws' : ('aws_access_key_id', 'aws_secret_access_key'),
'google' : ('gs_access_key_id', 'gs_secret_access_key'),
'aws': ('aws_access_key_id', 'aws_secret_access_key'),
'google': ('gs_access_key_id', 'gs_secret_access_key'),
}

AclClassMap = {
'aws' : Policy,
'google' : ACL
'aws': Policy,
'google': ACL
}

CannedAclsMap = {
'aws' : CannedS3ACLStrings,
'google' : CannedGSACLStrings
'aws': CannedS3ACLStrings,
'google': CannedGSACLStrings
}

HostKeyMap = {
'aws' : 's3',
'google' : 'gs'
'aws': 's3',
'google': 'gs'
}

ChunkedTransferSupport = {
'aws' : False,
'google' : True
'aws': False,
'google': True
}

# If you update this map please make sure to put "None" for the
# right-hand-side for any headers that don't apply to a provider, rather
# than simply leaving that header out (which would cause KeyErrors).
HeaderInfoMap = {
'aws' : {
HEADER_PREFIX_KEY : AWS_HEADER_PREFIX,
METADATA_PREFIX_KEY : AWS_HEADER_PREFIX + 'meta-',
ACL_HEADER_KEY : AWS_HEADER_PREFIX + 'acl',
AUTH_HEADER_KEY : 'AWS',
COPY_SOURCE_HEADER_KEY : AWS_HEADER_PREFIX + 'copy-source',
COPY_SOURCE_VERSION_ID_HEADER_KEY : AWS_HEADER_PREFIX +
'aws': {
HEADER_PREFIX_KEY: AWS_HEADER_PREFIX,
METADATA_PREFIX_KEY: AWS_HEADER_PREFIX + 'meta-',
ACL_HEADER_KEY: AWS_HEADER_PREFIX + 'acl',
AUTH_HEADER_KEY: 'AWS',
COPY_SOURCE_HEADER_KEY: AWS_HEADER_PREFIX + 'copy-source',
COPY_SOURCE_VERSION_ID_HEADER_KEY: AWS_HEADER_PREFIX +
'copy-source-version-id',
COPY_SOURCE_RANGE_HEADER_KEY : AWS_HEADER_PREFIX +
COPY_SOURCE_RANGE_HEADER_KEY: AWS_HEADER_PREFIX +
'copy-source-range',
DATE_HEADER_KEY : AWS_HEADER_PREFIX + 'date',
DELETE_MARKER_HEADER_KEY : AWS_HEADER_PREFIX + 'delete-marker',
METADATA_DIRECTIVE_HEADER_KEY : AWS_HEADER_PREFIX +
DATE_HEADER_KEY: AWS_HEADER_PREFIX + 'date',
DELETE_MARKER_HEADER_KEY: AWS_HEADER_PREFIX + 'delete-marker',
METADATA_DIRECTIVE_HEADER_KEY: AWS_HEADER_PREFIX +
'metadata-directive',
RESUMABLE_UPLOAD_HEADER_KEY : None,
SECURITY_TOKEN_HEADER_KEY : AWS_HEADER_PREFIX + 'security-token',
SERVER_SIDE_ENCRYPTION_KEY : AWS_HEADER_PREFIX + 'server-side-encryption',
VERSION_ID_HEADER_KEY : AWS_HEADER_PREFIX + 'version-id',
STORAGE_CLASS_HEADER_KEY : AWS_HEADER_PREFIX + 'storage-class',
MFA_HEADER_KEY : AWS_HEADER_PREFIX + 'mfa',
RESUMABLE_UPLOAD_HEADER_KEY: None,
SECURITY_TOKEN_HEADER_KEY: AWS_HEADER_PREFIX + 'security-token',
SERVER_SIDE_ENCRYPTION_KEY: AWS_HEADER_PREFIX + 'server-side-encryption',
VERSION_ID_HEADER_KEY: AWS_HEADER_PREFIX + 'version-id',
STORAGE_CLASS_HEADER_KEY: AWS_HEADER_PREFIX + 'storage-class',
MFA_HEADER_KEY: AWS_HEADER_PREFIX + 'mfa',
},
'google' : {
HEADER_PREFIX_KEY : GOOG_HEADER_PREFIX,
METADATA_PREFIX_KEY : GOOG_HEADER_PREFIX + 'meta-',
ACL_HEADER_KEY : GOOG_HEADER_PREFIX + 'acl',
AUTH_HEADER_KEY : 'GOOG1',
COPY_SOURCE_HEADER_KEY : GOOG_HEADER_PREFIX + 'copy-source',
COPY_SOURCE_VERSION_ID_HEADER_KEY : GOOG_HEADER_PREFIX +
'google': {
HEADER_PREFIX_KEY: GOOG_HEADER_PREFIX,
METADATA_PREFIX_KEY: GOOG_HEADER_PREFIX + 'meta-',
ACL_HEADER_KEY: GOOG_HEADER_PREFIX + 'acl',
AUTH_HEADER_KEY: 'GOOG1',
COPY_SOURCE_HEADER_KEY: GOOG_HEADER_PREFIX + 'copy-source',
COPY_SOURCE_VERSION_ID_HEADER_KEY: GOOG_HEADER_PREFIX +
'copy-source-version-id',
COPY_SOURCE_RANGE_HEADER_KEY : None,
DATE_HEADER_KEY : GOOG_HEADER_PREFIX + 'date',
DELETE_MARKER_HEADER_KEY : GOOG_HEADER_PREFIX + 'delete-marker',
METADATA_DIRECTIVE_HEADER_KEY : GOOG_HEADER_PREFIX +
COPY_SOURCE_RANGE_HEADER_KEY: None,
DATE_HEADER_KEY: GOOG_HEADER_PREFIX + 'date',
DELETE_MARKER_HEADER_KEY: GOOG_HEADER_PREFIX + 'delete-marker',
METADATA_DIRECTIVE_HEADER_KEY: GOOG_HEADER_PREFIX +
'metadata-directive',
RESUMABLE_UPLOAD_HEADER_KEY : GOOG_HEADER_PREFIX + 'resumable',
SECURITY_TOKEN_HEADER_KEY : GOOG_HEADER_PREFIX + 'security-token',
SERVER_SIDE_ENCRYPTION_KEY : None,
RESUMABLE_UPLOAD_HEADER_KEY: GOOG_HEADER_PREFIX + 'resumable',
SECURITY_TOKEN_HEADER_KEY: GOOG_HEADER_PREFIX + 'security-token',
SERVER_SIDE_ENCRYPTION_KEY: None,
# Note that this version header is not to be confused with
# the Google Cloud Storage 'x-goog-api-version' header.
VERSION_ID_HEADER_KEY : GOOG_HEADER_PREFIX + 'version-id',
STORAGE_CLASS_HEADER_KEY : None,
MFA_HEADER_KEY : None,
VERSION_ID_HEADER_KEY: GOOG_HEADER_PREFIX + 'version-id',
STORAGE_CLASS_HEADER_KEY: None,
MFA_HEADER_KEY: None,
}
}

ErrorMap = {
'aws' : {
STORAGE_COPY_ERROR : boto.exception.S3CopyError,
STORAGE_CREATE_ERROR : boto.exception.S3CreateError,
STORAGE_DATA_ERROR : boto.exception.S3DataError,
STORAGE_PERMISSIONS_ERROR : boto.exception.S3PermissionsError,
STORAGE_RESPONSE_ERROR : boto.exception.S3ResponseError,
'aws': {
STORAGE_COPY_ERROR: boto.exception.S3CopyError,
STORAGE_CREATE_ERROR: boto.exception.S3CreateError,
STORAGE_DATA_ERROR: boto.exception.S3DataError,
STORAGE_PERMISSIONS_ERROR: boto.exception.S3PermissionsError,
STORAGE_RESPONSE_ERROR: boto.exception.S3ResponseError,
},
'google' : {
STORAGE_COPY_ERROR : boto.exception.GSCopyError,
STORAGE_CREATE_ERROR : boto.exception.GSCreateError,
STORAGE_DATA_ERROR : boto.exception.GSDataError,
STORAGE_PERMISSIONS_ERROR : boto.exception.GSPermissionsError,
STORAGE_RESPONSE_ERROR : boto.exception.GSResponseError,
'google': {
STORAGE_COPY_ERROR: boto.exception.GSCopyError,
STORAGE_CREATE_ERROR: boto.exception.GSCreateError,
STORAGE_DATA_ERROR: boto.exception.GSDataError,
STORAGE_PERMISSIONS_ERROR: boto.exception.GSPermissionsError,
STORAGE_RESPONSE_ERROR: boto.exception.GSResponseError,
}
}

Expand Down
2 changes: 1 addition & 1 deletion boto/roboto/awsqueryrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def process_filters(self):
self.request_params['Filter.%d.Name' % (i+1)] = name
for j, value in enumerate(boto.utils.mklist(filters[name])):
Encoder.encode(filter, self.request_params, value,
'Filter.%d.Value.%d' % (i+1,j+1))
'Filter.%d.Value.%d' % (i+1, j+1))

def process_args(self, **args):
"""
Expand Down
2 changes: 1 addition & 1 deletion boto/s3/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def get_key(self, key_name, headers=None, version_id=None, response_headers=None
if version_id:
query_args.append('versionId=%s' % version_id)
if response_headers:
for rk,rv in response_headers.iteritems():
for rk, rv in response_headers.iteritems():
query_args.append('%s=%s' % (rk, urllib.quote(rv)))
if query_args:
query_args = '&'.join(query_args)
Expand Down
2 changes: 1 addition & 1 deletion boto/s3/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def open_read(self, headers=None, query_args='',
response_headers = self.resp.msg
self.metadata = boto.utils.get_aws_metadata(response_headers,
provider)
for name,value in response_headers.items():
for name, value in response_headers.items():
# To get correct size for Range GETs, use Content-Range
# header if one was returned. If not, use Content-Length
# header.
Expand Down
Loading

0 comments on commit abbae16

Please sign in to comment.